1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibWeb: Fix greedy CSS Tokenizer whitespace parsing

Whitespace parsing was too greedy, consuming the first non-
whitespace character after it.
This commit is contained in:
Sam Atkins 2021-07-09 13:58:44 +01:00 committed by Andreas Kling
parent 06fc099310
commit 9115c23bd5

View file

@ -725,8 +725,11 @@ Token Tokenizer::consume_a_token()
if (is_whitespace(input)) {
dbgln_if(CSS_TOKENIZER_TRACE, "is whitespace");
while (is_whitespace(peek_code_point().value()))
auto next = peek_code_point();
while (next.has_value() && is_whitespace(next.value())) {
(void)next_code_point();
next = peek_code_point();
}
return create_new_token(Token::TokenType::Whitespace);
}