1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

LibWeb: Make consume_a_qualified_rule() understand block tokens

This now matches the spec, and fixes the situation where if it was given
a TokenStream of StyleComponentValueRules, it would drop any Blocks on
the floor instead of adding them to the result StyleRule.
This commit is contained in:
Sam Atkins 2021-09-29 15:43:47 +01:00 committed by Andreas Kling
parent f1af136925
commit 9c5430b9ee

View file

@ -785,7 +785,13 @@ RefPtr<StyleRule> Parser::consume_a_qualified_rule(TokenStream<T>& tokens)
return rule;
}
// how is "simple block with an associated token of <{-token>" a valid token?
if constexpr (IsSame<T, StyleComponentValueRule>) {
StyleComponentValueRule const& component_value = token;
if (component_value.is_block() && component_value.block().is_curly()) {
rule->m_block = component_value.block();
return rule;
}
}
tokens.reconsume_current_input_token();
auto value = consume_a_component_value(tokens);