Commit graph

35477 commits

Author SHA1 Message Date
Andreas Kling
aae356baf1 LibWeb: Port inline elements to the new Paintable system
This patch adds InlinePaintable which corresponds to Layout::InlineNode.
2022-03-11 00:21:49 +01:00
Andreas Kling
053766d79c LibWeb: Split Paintable into Paintable and PaintableBox
To prepare for paintable inline content, we take the basic painting
functionality and hoist it into a base class.
2022-03-11 00:21:49 +01:00
Andreas Kling
0500dbc3f6 LibWeb: Add Paintable::layout_box() accessor
Let's move away from accessing the m_layout_box member directly.
2022-03-11 00:21:49 +01:00
Andreas Kling
9461e44afa LibWeb: Use Layout::Box::paint_box() accessor in more places 2022-03-11 00:21:49 +01:00
Andreas Kling
02b316fd5c LibWeb: Let Paintable perform the painting
This patch adds a bunch of Paintable subclasses, each corresponding to
the Layout::Node subclasses that had a paint() override. All painting
logic is moved from layout nodes into their corresponding paintables.

Paintables are now created by asking a Layout::Box to produce one:

    static NonnullOwnPtr<Paintable> Layout::Box::create_paintable()

Note that inline nodes still have their painting logic. Since they
are not boxes, and all paintables have a corresponding box, we'll need
to come up with some other solution for them.
2022-03-11 00:21:49 +01:00
Andreas Kling
f6497b64ac LibWeb: Rename Painting::Box => Paintable
Calling this "Box" made it very confusing to look at code that used both
Layout::Box and Painting::Box. Let's try calling it Paintable instead.
2022-03-11 00:21:49 +01:00
Andreas Kling
7af03df4c3 LibWeb: Make Painting::Box virtual and add Painting::BoxWithLines
BlockContainer paint boxes are the only ones that have line boxes
associated, so let's not waste memory on line boxes in all the other
types of boxes.

This also adds Layout::Box::paint_box() and the more tightly typed
Layout::BlockContainer::paint_box() to get at the paint box from the
corresponding layout box.
2022-03-11 00:21:49 +01:00
Andreas Kling
9f5cbcaad3 LibWeb: Hang StackingContext off of the paint boxes
Stacking contexts have nothing to do with layout and everything with
painting, so let's keep them in Painting::Box.
2022-03-11 00:21:49 +01:00
Andreas Kling
cc8e429126 LibWeb: Make StackingContext paint functions const 2022-03-11 00:21:49 +01:00
Andreas Kling
f0d833a3d7 LibWeb: Move StackingContext and PaintPhase into the Painting namespace 2022-03-11 00:21:49 +01:00
Andreas Kling
a4d51b3dc2 LibWeb: Add Painting::Box and move things from Layout::Box into it
The "paintable" state in Layout::Box was actually not safe to access
until after layout had been performed.

As a first step towards making this harder to mess up accidentally,
this patch moves painting information from Layout::Box to a new class:
Painting::Box. Every layout can have a corresponding paint box, and
it holds the final used metrics determined by layout.

The paint box is created and populated by FormattingState::commit().

I've also added DOM::Node::paint_box() as a convenient way to access
the paint box (if available) of a given DOM node.

Going forward, I believe this will allow us to better separate data
that belongs to layout vs painting, and also open up opportunities
for naturally invalidating caches in the paint box (since it's
reconstituted by every layout.)
2022-03-11 00:21:49 +01:00
diogenes
db404af6df Base: Add some more Transport and Map to Katica 10
Added:
1F684 - 1F692, 1F694, 1F697 - 1F69C, 1F6A3 - 1F6A7,
1F6AC - 1F6AE, 1F6B0 - 1F6B2, 1F6BA, 1F6CB - 1F6CE,
1F6E2, 1F6E4
2022-03-11 00:12:59 +01:00
Linus Groh
251f5e8885 LibJS: Use CreateTemporalCalendar in GetBuiltinCalendar
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/f6b3a10
2022-03-10 23:20:39 +01:00
Linus Groh
7f5b4842f2 LibJS: Replace dead code in ParseTimeZoneOffsetString with an assertion
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a29c40b
2022-03-10 23:20:39 +01:00
Linus Groh
55f9733316 LibJS: Add missing check in ParseTemporalInstant
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/baead4d
2022-03-10 23:20:39 +01:00
Linus Groh
f75052ff7c LibJS: Assert CreateTemporalDuration does not throw given correct input
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/881dd22
2022-03-10 23:20:39 +01:00
Linus Groh
d2c2a9bcbf LibJS: Assert CreateTemporalDuration does not throw in Record cases
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/43e954c
2022-03-10 23:20:39 +01:00
Linus Groh
4553512321 LibJS: Assert CreateTemporalDuration does not throw in trivial cases
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/685e20e
2022-03-10 23:20:39 +01:00
Linus Groh
54af3a5396 LibJS: Adjust grammar for DateExtendedYear to exclude -000000
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fb3e656

We lose the custom error message, but it's not the end of the world.
2022-03-10 23:20:39 +01:00
Linus Groh
68af8649fb LibJS: Follow rules for consuming completion records
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/1c19b96
2022-03-10 23:20:39 +01:00
Linus Groh
2bae040bc9 LibJS: Remove Sign abstract operation
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bbc1ebc
2022-03-10 23:20:39 +01:00
Linus Groh
0d06f3655f LibJS: Move string-parsing code into ToTemporalDurationRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a68b97b
2022-03-10 23:20:39 +01:00
Linus Groh
87fb005a8d LibJS: Move IsValidDuration check into ToTemporalDurationRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/00958d0
2022-03-10 23:20:39 +01:00
Linus Groh
34371b9b61 LibJS: Fix numeric type confusion in ToTemporalRoundingIncrement
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6e59366
2022-03-10 23:20:39 +01:00
Linus Groh
4ceff91893 LibJS: Use different variable name in DifferenceISODateTime
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c32cc4d
2022-03-10 23:20:39 +01:00
Linus Groh
a009e834dc LibJS: Add clarifying assertion to BalanceDurationRelative
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9a3477a
2022-03-10 23:20:39 +01:00
Linus Groh
17da627b4c LibJS: Fix "set it to" language to be more explicit
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/de58241
2022-03-10 23:20:39 +01:00
Linus Groh
4722045e28 LibJS: Do not expose mathematical values to script in Duration methods
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/26a4c4f

No behavioral change as we already did this correctly, but I changed
some implicit JS::Value creations to explicit ones.
2022-03-10 23:20:39 +01:00
Linus Groh
a496868ee5 LibJS: Create Duration Records with their own abstract operations
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/387c405
- https://github.com/tc39/proposal-temporal/commit/b203e26
- https://github.com/tc39/proposal-temporal/commit/387c405
2022-03-10 23:20:39 +01:00
Linus Groh
64e43c89bc LibJS: Remove assertions that are now part of structured headers
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/7fbdd28
- https://github.com/tc39/proposal-temporal/commit/f666243
- https://github.com/tc39/proposal-temporal/commit/8c7d066
- https://github.com/tc39/proposal-temporal/commit/307d108
- https://github.com/tc39/proposal-temporal/commit/d9ca402

In practical terms this means we can now get rid of a couple of awkward
assertion steps that were no-ops anyway, since the types are enforced
by the compiler.
2022-03-10 23:20:39 +01:00
Linus Groh
97bd4cebab LibJS: Refactor return value of RoundDuration
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/3641adf
- https://github.com/tc39/proposal-temporal/commit/8ea590c
2022-03-10 23:20:39 +01:00
Linus Groh
bdb13a74b0 LibJS: Describe various kinds of "Duration Records"
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/983902e

We already had these defined as structs, but now they're properly
defined in the spec (opposed to the previous anonymous records), and we
don't have to make up our own names anymore :^)

Note that while we're usually not including 'record' in the name, in
this case the 'Duration Record' has a name clash with the Duration
object. Additionally, later editorial changes introduce CreateFooRecord
AOs, so let's just go with FooRecord structs here.
2022-03-10 23:20:39 +01:00
Jelle Raaijmakers
2ac415f728 LibGL: Keep track of active matrix and stack
This simplifies a lot of code in `GLContext` and prevents potential
errors when testing against the current matrix mode.
2022-03-10 20:20:05 +01:00
Jelle Raaijmakers
5d0a64bfde LibGL: Only normalize in glRotate* if possible
Vectors of length 0 cannot be normalized, so prevent dividing by zero
in the `glRotate*` API. This fixes the skybox rendering of Quake2.
2022-03-10 20:20:05 +01:00
Sam Atkins
2362cc2943 AK: Remove unused String[256] from JsonParser
This shrinks the JsonParser class from 2072 bytes to 24. :^)
2022-03-10 18:43:09 +01:00
Sam Atkins
cc874f2b82 LibTest: Port JavaScriptTestRunner to Core::Stream 2022-03-10 12:04:22 -05:00
Sam Atkins
82605e2dff Tests: Port TestHTMLTokenizer to Core::Stream 2022-03-10 12:04:22 -05:00
Sam Atkins
2b2ddee77c Tests: Port TestCommonmark to Core::Stream
This passes the same number of tests that it did before this change:
> Out of 652 tests, 273 passed and 379 failed.
2022-03-10 12:04:22 -05:00
Sam Atkins
7ff99c3972 Tests: Port test-wasm to Core::Stream 2022-03-10 12:04:22 -05:00
Sam Atkins
aca28f00de Tests: Port test-cpp-preprocessor to Core::Stream 2022-03-10 12:04:22 -05:00
Sam Atkins
5833c55389 Tests: Port test-cpp-parser to Core::Stream 2022-03-10 12:04:22 -05:00
Sam Atkins
10429e1043 WebContent: Return empty JSON object if element has no box model
The blank string "" does not parse as JSON, and so the InspectorWidget
would fail to update the box-model information when inspecting elements
with no box, (for example, `<head>`) showing stale values instead. Now,
they show all 0s.

You could argue that InspectorWidget should be more resilient when given
invalid JSON strings, but making sure we only pass valid ones works
too.
2022-03-10 17:30:09 +01:00
Sam Atkins
b5ea14b884 WebContent: Show box-model metrics for (some) pseudo-elements
This only applies to pseudo-elements which have a Layout::Box, so this
excludes any that are InlineNodes.
2022-03-10 17:30:09 +01:00
Sam Atkins
0326ad34df Browser+LibWeb+WebContent: Show style for pseudo-elements :^)
This expands the InspectorWidget::Selection to include an optional
PseudoElement, which is then passed over IPC to request style
information for it.

As noted, this has some pretty big limitations because pseudo-elements
don't have DOM nodes:
- Declared style has to be recalculated when it's requested.
- We don't display the computed style.
- We don't display custom properties.
2022-03-10 17:30:09 +01:00
Sam Atkins
2c970b9516 Browser: Replace inspector's dom_node_id with a Selection struct 2022-03-10 17:30:09 +01:00
Sam Atkins
6de2b62906 LibWeb: Display pseudo-elements in the DOM inspector
This patch only makes them appear in the tree - they are not yet
inspectable themselves.
2022-03-10 17:30:09 +01:00
Sam Atkins
1c18bb13a2 LibWeb: Move pseudo-element-from-string code into Selector 2022-03-10 17:30:09 +01:00
Sam Atkins
adc08d0646 LibWeb: Move pseudo-class/element names into the header
These are constexpr, meaning that while the implementations were in the
cpp file, nobody outside that file could actually call them.
2022-03-10 17:30:09 +01:00
Sam Atkins
eb6e4e6775 Meta: Port Generate_CSS_PropertyID_cpp to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins
a850465a4b Meta: Port Generate_CSS_PropertyID_h to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00