Sam Atkins
35bb1e20ee
LibWeb/CSS: Don't serialize "in oklab" in color-mix()
...
This is the default interpolation method, so should be skipped according
to the rule of the shortest serialization.
2026-01-09 19:11:59 +00:00
Sam Atkins
ade44c7ddb
LibWeb/CSS: Make color-interpolation-method optional in color-mix()
2026-01-09 19:11:59 +00:00
Tim Ledbetter
89a391198e
LibWeb: Avoid intermediate string allocations in typed om serialization
2026-01-09 17:14:20 +00:00
Tim Ledbetter
cac2ad5ec4
LibWeb: Avoid intermediate string allocation in CSSPropertyRule::dump()
2026-01-09 15:20:06 +00:00
Tim Ledbetter
7335b90c40
LibWeb: Prefer serialize() to to_string() when serializing at-rules
2026-01-09 15:20:06 +00:00
Sam Atkins
960558f30a
LibWeb: Register and unregister @property rules when added or removed
...
Previously, we registered `@property` rules during parsing, and treated
them the same as `CSS.registerProperty()` calls. This is not correct
for a couple of reasons: One, the spec wants us to distinguish between
those two sources of registered custom properties, with
`CSS.registerProperty()` calls taking precedence. Two, we never removed
the registered property when its `@property` was removed from the
document.
This commit deals with this by iterating active CSSPropertyRules to find
which ones currently apply, and storing those in a cache. This cache is
invalidated whenever the Document's style is invalidated, which happens
whenever a CSSRule is added or removed from the Document.
The attached test demonstrates this now working as it should.
2026-01-09 10:54:37 +00:00
Sam Atkins
7c773e73e0
LibWeb/CSS: Read @property initial values in computed style
...
If a custom property is registered, then it may have an initial value
which we should fall back to here.
This is a temporary hack until we cascade our custom properties (see
https://github.com/LadybirdBrowser/ladybird/pull/6608 ).
2026-01-09 10:54:37 +00:00
Sam Atkins
02149a8032
LibWeb: Store registered custom properties as CustomPropertyRegistration
...
This brings us closer to the spec.
2026-01-09 10:54:37 +00:00
Shannon Booth
d901e937b6
LibWeb/CSS: Do not give internal stylesheets a location URL
...
This fixes Acid3 numbered test 72.
2026-01-09 10:54:11 +00:00
Tim Ledbetter
65f6da8d92
LibWeb: Reduce String allocations in serialize_layer lambdas
2026-01-09 10:00:58 +01:00
Tim Ledbetter
1d2e4e4273
LibWeb: Use StringBuilder when serializing basic grid types
2026-01-09 10:00:58 +01:00
Tim Ledbetter
17ee0e3a19
LibWeb: Use StringBuilder when serializing more CSS types
2026-01-09 10:00:58 +01:00
Tim Ledbetter
d28d04f78e
LibWeb: Make InterpolationMethod serialization take a StringBuilder
2026-01-09 10:00:58 +01:00
Tim Ledbetter
b4cf7e8060
LibWeb: Avoid String allocations in easing values serialization methods
2026-01-09 10:00:58 +01:00
Tim Ledbetter
0d7f2b8cba
LibWeb: Avoid String allocations in BasicShape serialization methods
2026-01-09 10:00:58 +01:00
Tim Ledbetter
a27d269721
LibWeb: Pass StringBuilder around during StyleValue serialization
...
Previously, some StyleValues created a large number of intermediate
strings during serialization. Passing a StringBUilder into the
serialization function allows us to avoid a large number of these
unnecessary allocations.
2026-01-09 10:00:58 +01:00
Jelle Raaijmakers
ae20ecf857
AK+Everywhere: Add Vector::contains(predicate) and use it
...
No functional changes.
2026-01-08 15:27:30 +00:00
Callum Law
2ba1141e3c
LibWeb: Don't round when absolutizing lengths
...
Lengths should be rounded at use-time rather than compute-time
Also removes an unnecessary if statement which was always true
2026-01-08 10:51:35 +01:00
Callum Law
09799e794e
LibWeb: Update Length::absolutize() to take a ResolutionContext
...
All callers are passing individual values from a `ResolutionContext`
anyway so we may as well do it in a single place.
2026-01-08 10:51:35 +01:00
Callum Law
30c6f45702
LibWeb: Remove unused Length::absolutized()
2026-01-08 10:51:35 +01:00
Andreas Kling
a9cc425cde
LibJS+LibWeb: Add missing GC marking visits
...
This adds visit_edges(Cell::Visitor&) methods to various helper structs
that contain GC pointers, and makes sure they are called from owning
GC-heap-allocated objects as needed.
These were found by our Clang plugin after expanding its capabilities.
The added rules will be enforced by CI going forward.
2026-01-07 12:48:58 +01:00
Callum Law
388616b315
LibWeb: More efficiently pack ComputedValues struct
...
This reduces the size of `ComputedValues` from 3240 bytes to 3064 bytes
2026-01-06 20:32:14 +01:00
Aliaksandr Kalenik
d7fb5ba35f
LibWeb: Use value-comparing RefPtr in ColorStopListElement
...
The color stop members were RefPtr which compares by pointer identity.
This caused false positives in style invalidation when the same gradient
color values were recomputed as different objects.
2026-01-06 13:23:00 +00:00
Aliaksandr Kalenik
b6da3aaa3f
LibWeb: Use value-comparing RefPtr in CursorStyleValue
...
The x and y members were RefPtr which compares by pointer identity.
This caused false positives in style invalidation when the same values
were recomputed as different objects.
2026-01-06 13:23:00 +00:00
Aliaksandr Kalenik
9cd583ff6e
LibWeb: Use value-comparing RefPtr in TextIndentStyleValue
...
The member type was NonnullRefPtr which compares by pointer identity.
This caused false positives in style invalidation when the same values
were recomputed as different objects.
2026-01-06 13:23:00 +00:00
Aliaksandr Kalenik
fee49c3837
LibWeb: Use value-comparing RefPtr in ScrollbarColorStyleValue
...
The member types were NonnullRefPtr which compares by pointer identity.
This caused false positives in style invalidation when the same color
values were recomputed as different objects.
2026-01-06 13:23:00 +00:00
Tim Ledbetter
e4fb4d7c1a
LibWeb: Extract animation-composition value from keyframe at-rules
...
Previously, we weren't respecting the value of this property, so the
composite operation always defaulted to
`AnimationComposition::Replace`.
2026-01-06 12:58:54 +01:00
Tim Ledbetter
2ff77589df
LibWeb: Add FontFaceSetLoadEvent
2026-01-06 12:24:42 +01:00
Tim Ledbetter
581d6ce6e7
LibWeb: Mark font status promise as handled when rejecting it
2026-01-06 12:24:42 +01:00
Tim Ledbetter
3ec53f5a3f
LibWeb: Clamp filter function values to valid range when interpolating
2026-01-06 12:13:13 +01:00
Tim Ledbetter
5de5e7522b
LibWeb: Implement interpolation of drop-shadow() filter functions
2026-01-06 12:13:13 +01:00
Tim Ledbetter
584e0996c9
LibWeb: Store color as a StyleValue in FilterOperation::DropShadow
2026-01-06 12:13:13 +01:00
Callum Law
72a00a17cc
LibWeb: Omit nonzero fill rule when serializing polygon()
...
Gains us ~160 WPT passes
2026-01-06 10:49:51 +00:00
Callum Law
ed8eab03d0
LibWeb: Support interpolation of BorderRadiusRectStyleValue
2026-01-06 10:50:06 +01:00
Callum Law
4f5bab7e5d
LibWeb: Support border radius in xywh() function
2026-01-06 10:50:06 +01:00
Callum Law
02a8d22a4e
LibWeb: Support border radius in rect() function
2026-01-06 10:50:06 +01:00
Callum Law
1b7567cc86
LibWeb: Support parsing of border radius in inset() function
...
Respecting this value during basic shape path resolution is yet to be
implemented
2026-01-06 10:50:06 +01:00
Callum Law
84c6fd5730
LibWeb: Make parsing of border-radius value reusable
...
This is also useful for `<basic-shape-rect>`
2026-01-06 10:50:06 +01:00
Callum Law
cb1425877a
LibWeb: Serialize inset() arguments as positional value list
2026-01-06 10:50:06 +01:00
Callum Law
00af50d49e
LibWeb: Make serialization of positional value list reusable
...
This is useful for more than just shorthands (e.g. it is also useful for
the arguments of the `inset()` function)
2026-01-06 10:50:06 +01:00
Tim Ledbetter
3fd4eb56ee
LibWeb: Implement FontFaceSet.clear()
2026-01-05 16:15:58 +00:00
Tim Ledbetter
6e0bdd79e4
LibWeb: Mark FontFace as CSS-disconnected when font-face rule is removed
2026-01-05 16:15:58 +00:00
Tim Ledbetter
7b8099bb89
LibWeb: Disconnect and replace FontFace on @font-face src change
2026-01-05 16:15:58 +00:00
Tim Ledbetter
dab22f770d
LibWeb: Add a corresponding FontFace object for a parsed @font-face rule
2026-01-05 16:15:58 +00:00
Tim Ledbetter
2a8db3b1f9
LibWeb: Propagate FontFace changes to CSSFontFaceRule
2026-01-05 16:15:58 +00:00
Callum Law
96a4e33eaf
LibWeb: Resolve circle()/ellipse() position keywords at parse time
2026-01-05 11:42:19 +00:00
Callum Law
41b2496d3e
LibWeb: Clamp <radial-size> calculated length percentages
...
The spec requires `<radial-size>` to be non-negative
2026-01-05 11:42:19 +00:00
Callum Law
2e66203ede
LibWeb: Add early return from ComputedProperties::animations()
...
If all the values of `animation-name` are `none` we can exit early and
save a bunch of work.
Reduces time spent in this function from 1.23% to 0.01% when loading
https://en.wikipedia.org/wiki/2023_in_American_television
2026-01-05 11:35:26 +00:00
Callum Law
79740b04b3
LibWeb: Don't generate layer for background-image none entry
...
Reduces the time spent in `background_layers()` from 1.5% to 0.04% when
loading https://en.wikipedia.org/wiki/2023_in_American_television
2026-01-05 11:35:26 +00:00
Callum Law
1708ce2e2b
LibWeb: Propagate background-clip value for color layer separately
...
This is required for an optimization in a later commit
2026-01-05 11:35:26 +00:00