Skip to content

Commit 6d38ad3

Browse files
committed
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.
1 parent abcc5bc commit 6d38ad3

File tree

3 files changed

+385
-1
lines changed

3 files changed

+385
-1
lines changed

Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
474474
}
475475

476476
// FIXME: Stop removing whitespace here. It's less helpful than it seems.
477-
if (property_id != PropertyID::Custom && token.is(Token::Type::Whitespace))
477+
if (property_requires_whitespace_stripped_before_parsing(property_id) && token.is(Token::Type::Whitespace))
478478
continue;
479479

480480
if (token.is_function())

0 commit comments

Comments
 (0)