From 9c5430b9eef7eb464e35ded24100649900a5a0ea Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 29 Sep 2021 15:43:47 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index f6beda5ad6..3f8a182783 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -785,7 +785,13 @@ RefPtr Parser::consume_a_qualified_rule(TokenStream& tokens) return rule; } - // how is "simple block with an associated token of <{-token>" a valid token? + if constexpr (IsSame) { + 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);