Commit Graph

226 Commits

Author SHA1 Message Date
Callum Law
630117e111 LibWeb: Reuse logic for parsing font-variant-alternates
This means that we only need to add support for parsing of alternates
functions in one place
2026-02-20 22:01:44 +00:00
Callum Law
04fd7e00e9 LibWeb: Disallow disjointed numeric component of font-variant
The grammar groups this component together meaning that all
sub-components must occur together i.e.
`ordinal slashed-zero small-caps` is valid but
`ordinal small-caps slashed-zero` is not.

We also reuse the logic for parsing from the longhand
`font-variant-numeric` property for simplicity.
2026-02-20 22:01:44 +00:00
Callum Law
d97098ec80 LibWeb: Disallow disjointed ligatures component of font-variant
The grammar groups this component together meaning that all
sub-components must occur together i.e.
`common-ligatures no-contextual small-caps` is valid but
`common-ligatures small-caps no-contextual` is not.

We also reuse the logic for parsing from the longhand
`font-variant-ligatures` property for simplicity.
2026-02-20 22:01:44 +00:00
Callum Law
75dd7b767f LibWeb: Disallow disjointed east asian component of font-variant
The grammar groups this component together meaning that all
sub-components must occur together i.e. `jis78 full-width small-caps` is
valid but `jis78 small-caps full-width` is not.

We also reuse the logic for parsing from the longhand
`font-variant-east-asian` property for simplicity.
2026-02-20 22:01:44 +00:00
Psychpsyo
a7267f711b LibWeb: Add overflow-clip-margin-* properties
The corner radius isn't quite right yet, but this gives us
another couple WPT passes for these.
2026-02-14 22:58:21 +01:00
Callum Law
9418981398 LibWeb: Mark initial color value as requiring computation
Previously we only computed if we had a cascaded value, but the initial
value of `canvastext` requires computation as well

Fixes a test failure in `slot-style-inheritance.html` introduced in
6358432
2026-02-13 23:26:27 +01:00
Callum Law
63584321fe LibWeb: Skip property computation in some cases
There are cases where we can skip the property value computation process
because we know that the computed value will be equal to the specified
value
2026-02-13 21:54:06 +01:00
Tim Ledbetter
991b3d87e5 LibWeb: Add missing -webkit- legacy property aliases
These are mandated by the compat specification.
2026-02-13 11:13:54 +00:00
Callum Law
8a82d116d6 LibWeb: Always parse <counter-style> as such
Previously we parsed it as `<custom-ident>` in `<counter>` and as a
keyword in `list-style-type`.

The practical effect of this is:
 - Spec defined counter style names in `<counter>` are ASCII lowercased
   on parse.
 - Non spec defined counter style names are allowed in `list-style-type.

We are still to parse the `symbols()` function but this gives us a
better base for that.
2026-02-12 10:33:09 +00:00
Callum Law
05cafdb5d0 LibWeb: Remove none from counter-style-name-keyword
`none` isn't a supported value for `<counter-style-name>` and is only
supported directly by `list-style-type` (i.e. not within `counter{s}()`
functions)
2026-02-12 10:33:09 +00:00
Callum Law
046dfdd192 LibWeb: Parse CSS timeline-scope property 2026-02-11 11:27:16 +01:00
Tim Ledbetter
e863a04b12 LibWeb: Include grid-auto-* longhands in grid shorthand parsing 2026-02-09 17:36:12 +01:00
Callum Law
11d524bda4 LibWeb: Support CSS font-optical-sizing property 2026-02-03 11:44:25 +00:00
Andreas Kling
35839af2d2 LibWeb: Optimize getComputedStyle() to avoid layout when possible
Previously, getComputedStyle() would always call update_layout() for
most properties. This was expensive since layout involves a full tree
traversal even when only style information is needed.

This change introduces a more granular approach:
- Properties needing layout computation (used values like width/height)
  still call update_layout()
- Properties needing a layout node for resolved value computation
  (colors, border widths, etc.) also call update_layout()
- All other properties now only call update_style()

The set of properties needing layout node for resolution is now defined
in Properties.json via the "needs-layout-node-for-resolved-value" flag,
rather than being hardcoded. This is generated into a new function
property_needs_layout_node_for_resolved_value().
2026-01-26 12:40:36 +01:00
Callum Law
9b20fe6902 LibWeb: Promote font-style to ValueType
This means we now allow oblique angles when parsing the `font`
shorthand.

This also required us to rename the existing `FontStyle` enum to
`FontStyleKeyword`
2026-01-13 10:21:26 +00:00
Callum Law
252e1d86bd LibWeb: Dont serialize font with non-initial reset-only sub-properties 2026-01-13 10:21:26 +00:00
Jonathan Gamble
4579bb5bed LibWeb: Add resize property plumbing 2026-01-12 11:00:14 +00:00
Callum Law
cbd07b2153 LibWeb: Don't mark whether shorthand properties are inherited
Inheritance applies to longhands individually so whether a shorthand was
marked as inherit or not is irrelevant
2025-12-29 16:11:13 +01:00
Callum Law
e79644bf6b LibWeb: Mark scrollbar-color property as inherited 2025-12-29 16:11:13 +01:00
Andreas Kling
b3b3a8602a LibWeb: Mark a handful of CSS properties as not affecting layout
I noticed us invalidating layouts in the wild (e.g on reddit) for
properties that can't possibly affect layout.
2025-12-20 08:21:18 +00:00
Callum Law
a11666e097 LibWeb: Simplify creation of background layers
We can deduplicate some code by using `assemble_coordinated_value_list`,
also moves this to a method in `ComputedProperties` to be in line with
other values
2025-12-08 11:46:50 +00:00
Callum Law
540b26e426 LibWeb: Remove unnecessary parse_overflow_value method
This is handled by the generic logic for parsing positional value list
shorthands once we register the legacy value alias of `overlay>auto` on
the shorthand as well as longhand properties.
2025-12-08 11:41:13 +00:00
Callum Law
953f9775a4 LibWeb: Mark animation-* properties as list-valued 2025-12-02 12:47:10 +00:00
Callum Law
758432c1cd LibWeb: Don't mark mask-type as list-valued
This is distinct from the other `mask-*` properties and is not a
longhand of `mask`, and is thus not a coordinating value list longhand
2025-12-02 12:14:27 +00:00
Sam Atkins
cdc81e8921 LibWeb/CSS: Add -moz-appearance property alias 2025-12-01 11:10:13 +00:00
Callum Law
c8d91c127e LibWeb: Parse view() for the animation-timeline CSS property 2025-11-28 13:24:11 +00:00
Callum Law
7d70714eac LibWeb: Parse scroll() for the animation-timeline CSS property 2025-11-28 13:24:11 +00:00
Callum Law
5bbcd0a48f LibWeb: Parse the animation-timeline CSS property 2025-11-28 13:24:11 +00:00
Callum Law
6bb7224f4e LibWeb: Parse the view-timeline shorthand CSS property
The remaining failing tests in view-timeline-shorthand.html are due to
either:
 a) incorrect tests, see web-platform-tests/wpt#56181 or;
 b) a wider issue where we collapse coordinating value list longhand
properties to a single value when we shouldn't.
2025-11-28 13:24:11 +00:00
Callum Law
e093c76eea LibWeb: Parse the view-timeline-inset CSS property 2025-11-28 13:24:11 +00:00
Callum Law
21ff35691a LibWeb: Parse the view-timeline-axis CSS property 2025-11-28 13:24:11 +00:00
Callum Law
d9d3e66197 LibWeb: Parse the view-timeline-name CSS property 2025-11-28 13:24:11 +00:00
Callum Law
13ce2d1857 LibWeb: Parse the scroll-timeline shorthand CSS property
The remaining failing tests in scroll-timeline-shorthand.html are due to
either:
 a) incorrect tests, see web-platform-tests/wpt#56181 or;
 b) a wider issue where we collapse coordinating value list longhand
properties to a single value when we shouldn't.
2025-11-28 13:24:11 +00:00
Callum Law
992b0a4dc6 LibWeb: Parse the scroll-timeline-axis CSS property 2025-11-28 13:24:11 +00:00
Callum Law
e95f326f3d LibWeb: Parse the scroll-timeline-name CSS property 2025-11-28 13:24:11 +00:00
Psychpsyo
2db3796fd3 LibWeb: Implement CSS perspective-origin 2025-11-21 11:14:28 +00:00
Sam Atkins
c4b9e7eadf LibWeb: Parse and propagate extended text-indent property values
CSS Text 3 gives `text-indent` a couple of optional keywords to control
which lines are affected. This commit parses them, but doesn't yet do
anything with them.
2025-11-20 16:02:40 +01:00
Sam Atkins
44326c4d7f LibWeb/CSS: Define value ranges for grid properties
Grid track sizes cannot be negative.
2025-11-19 23:45:52 +00:00
Psychpsyo
e064fa19d2 LibWeb: Add transform-style and have it make a stacking context 2025-11-12 15:47:36 +01:00
Psychpsyo
eb21ea890c LibWeb: Implement CSS perspective property 2025-11-12 00:41:14 +01:00
Sam Atkins
7292714592 LibWeb/CSS: Mark cursor as not a list-valued property
This is apparently supposed to always be treated as a single composite
value, for Typed OM at least.
2025-11-06 10:34:48 +00:00
Sam Atkins
d739c8c22a LibWeb/CSS: Mark transform as not a list-valued property
The different transform functions together form a single transform, so
this isn't a list.
2025-11-03 10:21:51 -08:00
Sam Atkins
01417d1e53 LibWeb/CSS: Stop stripping whitespace from remaining properties 2025-11-03 11:23:21 +00:00
Sam Atkins
4286a2c154 LibWeb/CSS: Handle whitespace properly in quotes property 2025-11-03 11:23:21 +00:00
Sam Atkins
b12851427b LibWeb/CSS: Handle whitespace properly in transformation properties
We can no longer rely on the remaining token count, so these required
significant rearranging.
2025-11-03 11:23:21 +00:00
Sam Atkins
3341a526a3 LibWeb/CSS: Stop stripping whitespace from display property 2025-11-03 11:23:21 +00:00
Sam Atkins
fd40df12e8 LibWeb/CSS: Stop stripping whitespace from cursor property 2025-11-03 11:23:21 +00:00
Sam Atkins
ed55d968e8 LibWeb/CSS: Stop stripping whitespace from opacity properties 2025-11-03 11:23:21 +00:00
Sam Atkins
12588b6f9d LibWeb/CSS: Handle whitespace properly in content property 2025-11-03 11:23:21 +00:00
Sam Atkins
676a343525 LibWeb/CSS: Stop stripping whitespace from clip properties 2025-11-03 11:23:21 +00:00