summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-09-29 15:43:47 +0100
committerAndreas Kling <kling@serenityos.org>2021-10-01 20:03:03 +0200
commit9c5430b9eef7eb464e35ded24100649900a5a0ea (patch)
treee185ee03900b2b8e272aa741c6fb059dcdd838df /Userland
parentf1af136925bd2728d15b2094879628c8738b4180 (diff)
downloadserenity-9c5430b9eef7eb464e35ded24100649900a5a0ea.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp8
1 files changed, 7 insertions, 1 deletions
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<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);