Skip to content

Commit 4286a2c

Browse files
committed
LibWeb/CSS: Handle whitespace properly in quotes property
1 parent b128514 commit 4286a2c

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4526,30 +4526,30 @@ RefPtr<StyleValue const> Parser::parse_quotes_value(TokenStream<ComponentValue>&
45264526
{
45274527
// https://www.w3.org/TR/css-content-3/#quotes-property
45284528
// auto | none | [ <string> <string> ]+
4529-
auto transaction = tokens.begin_transaction();
45304529

4531-
if (tokens.remaining_token_count() == 1) {
4532-
auto keyword = parse_keyword_value(tokens);
4533-
if (keyword && property_accepts_keyword(PropertyID::Quotes, keyword->to_keyword())) {
4534-
transaction.commit();
4535-
return keyword;
4536-
}
4537-
return nullptr;
4538-
}
4530+
if (auto auto_keyword = parse_all_as_single_keyword_value(tokens, Keyword::Auto))
4531+
return auto_keyword.release_nonnull();
45394532

4540-
// Parse an even number of <string> values.
4541-
if (tokens.remaining_token_count() % 2 != 0)
4542-
return nullptr;
4533+
if (auto none_keyword = parse_all_as_single_keyword_value(tokens, Keyword::None))
4534+
return none_keyword.release_nonnull();
4535+
4536+
auto transaction = tokens.begin_transaction();
4537+
tokens.discard_whitespace();
45434538

4539+
// Parse an even number of <string> values.
45444540
StyleValueVector string_values;
45454541
while (tokens.has_next_token()) {
45464542
auto maybe_string = parse_string_value(tokens);
45474543
if (!maybe_string)
45484544
return nullptr;
45494545

45504546
string_values.append(maybe_string.release_nonnull());
4547+
tokens.discard_whitespace();
45514548
}
45524549

4550+
if (string_values.size() % 2 != 0)
4551+
return nullptr;
4552+
45534553
transaction.commit();
45544554
return StyleValueList::create(move(string_values), StyleValueList::Separator::Space);
45554555
}

Libraries/LibWeb/CSS/Properties.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3327,7 +3327,6 @@
33273327
]
33283328
},
33293329
"quotes": {
3330-
"strip-whitespace": true,
33313330
"animation-type": "discrete",
33323331
"inherited": true,
33333332
"initial": "auto",

0 commit comments

Comments
 (0)