Commit graph

1576 commits

Author SHA1 Message Date
Sam Atkins
61a0898f5f LibWeb/CSS: Stop inserting whitespace when serializing component values
Now that we don't remove whitespace when parsing, we don't need to
artificially insert it back in again when serializing. We do now need
to trim leading and trailing whitespace from UnresolvedStyleValues, as
this previously was done as part of the whitespace insertion.

This makes our serialization of UnresolvedStyleValues more correct and
gets us a few WPT passes for each property in the Typed OM tests.
2025-11-03 11:23:21 +00:00
Sam Atkins
427d7fabd7 LibWeb/CSS: Stop copying the input in parse_css_value()
Now that we don't strip out whitespace, this method was copying the
input TokenStream into a Vector, and then creating new TokenStreams
from that. So, stop doing that and use the input TokenStream instead.
2025-11-03 11:23:21 +00:00
Sam Atkins
2bbf578737 LibWeb/CSS: Commit transaction when parsing valid anchor()
I'm honestly not sure how this worked before.
2025-11-03 11:23:21 +00:00
Sam Atkins
1b1bb3b897 LibWeb/CSS: Remove "strip-whitespace" flag from Properties.json
Now that it's not on any properties, remove support for it entirely.
2025-11-03 11:23:21 +00: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
Sam Atkins
3bde5b4e68 LibWeb/CSS: Stop stripping whitespace from transition properties 2025-11-03 11:23:21 +00:00
Sam Atkins
b2ef053be9 LibWeb/CSS: Stop stripping whitespace from text properties 2025-11-03 11:23:21 +00:00
Sam Atkins
b3e53b0bd2 LibWeb/CSS: Stop stripping whitespace from stroke properties 2025-11-03 11:23:21 +00:00
Sam Atkins
fccddca498 LibWeb/CSS: Stop stripping whitespace from shape properties 2025-11-03 11:23:21 +00:00
Sam Atkins
971c0d0126 LibWeb/CSS: Handle whitespace properly for scrollbar properties
Imported a WPT test that regressed without these changes.
2025-11-03 11:23:21 +00:00
Sam Atkins
60a46b86e4 LibWeb/CSS: Stop stripping whitespace from position-* properties 2025-11-03 11:23:21 +00:00
Sam Atkins
28422e80f2 LibWeb/CSS: Stop stripping whitespace from place-* properties 2025-11-03 11:23:21 +00:00
Sam Atkins
4f5126e52f LibWeb/CSS: Handle whitespace properly in list-style properties 2025-11-03 11:23:21 +00:00
Sam Atkins
8c8168c65c LibWeb/CSS: Handle whitespace properly in grid properties 2025-11-03 11:23:21 +00:00
Sam Atkins
049cc09ae4 LibWeb/CSS: Stop stripping whitespace from flex properties 2025-11-03 11:23:21 +00:00
Sam Atkins
123a3dbbc5 LibWeb/CSS: Handle whitespace properly in mask properties 2025-11-03 11:23:21 +00:00
Sam Atkins
fd682386b8 LibWeb/CSS: Stop stripping whitespace from margin properties 2025-11-03 11:23:21 +00:00
Sam Atkins
d5a0838521 LibWeb/CSS: Stop stripping whitespace from padding properties 2025-11-03 11:23:21 +00:00
Sam Atkins
826eb067c0 LibWeb/CSS: Stop stripping whitespace from overflow properties 2025-11-03 11:23:21 +00:00
Sam Atkins
c4b76d7a49 LibWeb/CSS: Stop stripping whitespace for outline properties 2025-11-03 11:23:21 +00:00
Sam Atkins
85b87378bd LibWeb/CSS: Stop stripping whitespace for size properties 2025-11-03 11:23:21 +00:00
Sam Atkins
eda72541b8 LibWeb/CSS: Stop stripping whitespace for inset properties 2025-11-03 11:23:21 +00:00
Sam Atkins
34e3df1769 LibWeb/CSS: Stop stripping whitespace for SVG geometry properties 2025-11-03 11:23:21 +00:00
Sam Atkins
941ad24abd LibWeb/CSS: Handle whitespace properly in column properties 2025-11-03 11:23:21 +00:00
Sam Atkins
ee13de8426 LibWeb/CSS: Stop stripping whitespace for filter properties 2025-11-03 11:23:21 +00:00
Sam Atkins
cb3773755a LibWeb/CSS: Handle whitespace properly in font properties 2025-11-03 11:23:21 +00:00
Sam Atkins
372ae7c697 LibWeb/CSS: Reformat anchor-size() allowed properties, one per line
Having them grouped as they were is nice, but clang-format 21 really
hates these having multiple values per line.
2025-11-03 11:23:21 +00:00
Sam Atkins
39e0d06987 LibWeb/CSS: Discard whitespace at the start of simple parsing functions 2025-11-03 11:23:21 +00:00
Sam Atkins
003d9e4b49 LibWeb/CSS: Stop stripping whitespace for counter properties 2025-11-03 11:23:21 +00:00
Sam Atkins
17bbf238ed LibWeb/CSS: Stop stripping whitespace for corner-shape properties 2025-11-03 11:23:21 +00:00
Sam Atkins
a348f919be LibWeb/CSS: Handle whitespace properly for shadow properties 2025-11-03 11:23:21 +00:00
Sam Atkins
c5fa5fb80e LibWeb/CSS: Handle whitespace properly for border-image properties 2025-11-03 11:23:21 +00:00
Sam Atkins
a2cd5d5ec8 LibWeb/CSS: Handle whitespace properly for border-radius properties 2025-11-03 11:23:21 +00:00
Sam Atkins
d44c3a0b34 LibWeb/CSS: Stop stripping whitespace for basic border properties
That is, excluding border-image and border-radius properties.
2025-11-03 11:23:21 +00:00
Sam Atkins
e3332dc5c6 LibWeb/CSS: Handle whitespace properly for background properties 2025-11-03 11:23:21 +00:00
Sam Atkins
d2e4f113a2 LibWeb/CSS: Stop stripping whitespace for animation properties 2025-11-03 11:23:21 +00:00
Sam Atkins
821bf4a289 LibWeb/CSS: Discard whitespace when parsing comma-separated lists 2025-11-03 11:23:21 +00:00
Sam Atkins
9dc9e98d14 LibWeb/CSS: Skip whitespace before and after property values
To make this a bit easier, we now wrap the per-property parsing
functions in a parse_all_as() lambda, which skips whitespace, and
returns an error if parsing failed or there are trailing tokens.
2025-11-03 11:23:21 +00:00
Sam Atkins
4fffbf9ba1 LibWeb/CSS: Stop stripping whitespace for simple keyword properties
This is, I believe, all properties that take a single keyword, either
listed literally or using an Enums.json definition.
2025-11-03 11:23:21 +00:00
Sam Atkins
926f5285df LibWeb/CSS: Stop stripping whitespace for all 2025-11-03 11:23:21 +00:00
Sam Atkins
9463526277 LibWeb/CSS: Stop stripping whitespace for align/justify properties 2025-11-03 11:23:21 +00:00
Sam Atkins
f73f7c8209 LibWeb/CSS: Stop stripping whitespace for basic color properties 2025-11-03 11:23:21 +00:00
Sam Atkins
6d38ad32cb LibWeb/CSS: Let Properties.json specify whether to strip whitespace
Removing all whitespace before parsing StyleValues seemed like a good
idea back when I did it, but causes issues. Serialization cares about
whether there was whitespace or not, and we also weren't removing
whitespace from inside blocks and functions so it was inconsistent
whether we needed to deal with whitespace or not.

So currently, some parsing code is conscious of whitespace, some isn't,
and some tries to be but is incorrect. Rather than try to fix all of
this in a single large, messy change, this commit introduces
a "strip-whitespace" flag to Properties.json. We can then disable
whitespace-stripping a few properties at a time and debug any issues
more easily. Eventually (hopefully soon), this will go away entirely.
2025-11-03 11:23:21 +00:00