mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb/CSS: Discard whitespace when parsing comma-separated lists
This commit is contained in:
parent
9dc9e98d14
commit
821bf4a289
Notes:
github-actions[bot]
2025-11-03 11:29:43 +00:00
Author: https://github.com/AtkinsSJ
Commit: 821bf4a289
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6646
Reviewed-by: https://github.com/tcl3
3 changed files with 14 additions and 8 deletions
|
|
@ -186,6 +186,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
|
|||
return {};
|
||||
};
|
||||
|
||||
tokens.discard_whitespace();
|
||||
auto& peek_token = tokens.next_token();
|
||||
|
||||
auto parse_for_type = [&](ValueType const type) -> Optional<PropertyAndValue> {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ namespace Web::CSS::Parser {
|
|||
|
||||
RefPtr<StyleValue const> Parser::parse_comma_separated_value_list(TokenStream<ComponentValue>& tokens, ParseFunction parse_one_value)
|
||||
{
|
||||
tokens.discard_whitespace();
|
||||
auto first = parse_one_value(tokens);
|
||||
tokens.discard_whitespace();
|
||||
if (!first || !tokens.has_next_token())
|
||||
return first;
|
||||
|
||||
|
|
@ -91,8 +93,11 @@ RefPtr<StyleValue const> Parser::parse_comma_separated_value_list(TokenStream<Co
|
|||
if (!tokens.consume_a_token().is(Token::Type::Comma))
|
||||
return nullptr;
|
||||
|
||||
tokens.discard_whitespace();
|
||||
|
||||
if (auto maybe_value = parse_one_value(tokens)) {
|
||||
values.append(maybe_value.release_nonnull());
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue