diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 1ead40652e..cb0e850c4f 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -4294,9 +4294,9 @@ RefPtr<StyleValue> Parser::parse_as_css_value(PropertyID property_id) Result<NonnullRefPtr<StyleValue>, Parser::ParsingResult> Parser::parse_css_value(PropertyID property_id, TokenStream<StyleComponentValueRule>& tokens) { - auto block_contains_var = [](StyleBlockRule const& block, auto&& recurse) -> bool { + auto block_contains_var_or_attr = [](StyleBlockRule const& block, auto&& recurse) -> bool { for (auto const& token : block.values()) { - if (token.is_function() && token.function().name().equals_ignoring_case("var"sv)) + if (token.is_function() && (token.function().name().equals_ignoring_case("var"sv) || token.function().name().equals_ignoring_case("attr"sv))) return true; if (token.is_block() && recurse(token.block(), recurse)) return true; @@ -4306,7 +4306,7 @@ Result<NonnullRefPtr<StyleValue>, Parser::ParsingResult> Parser::parse_css_value m_context.set_current_property_id(property_id); Vector<StyleComponentValueRule> component_values; - bool contains_var = false; + bool contains_var_or_attr = false; while (tokens.has_next_token()) { auto& token = tokens.next_token(); @@ -4324,18 +4324,18 @@ Result<NonnullRefPtr<StyleValue>, Parser::ParsingResult> Parser::parse_css_value return ParsingResult::IncludesIgnoredVendorPrefix; } - if (!contains_var) { - if (token.is_function() && token.function().name().equals_ignoring_case("var"sv)) - contains_var = true; - else if (token.is_block() && block_contains_var(token.block(), block_contains_var)) - contains_var = true; + if (!contains_var_or_attr) { + if (token.is_function() && (token.function().name().equals_ignoring_case("var"sv) || token.function().name().equals_ignoring_case("attr"sv))) + contains_var_or_attr = true; + else if (token.is_block() && block_contains_var_or_attr(token.block(), block_contains_var_or_attr)) + contains_var_or_attr = true; } component_values.append(token); } - if (property_id == PropertyID::Custom || contains_var) - return { UnresolvedStyleValue::create(move(component_values), contains_var) }; + if (property_id == PropertyID::Custom || contains_var_or_attr) + return { UnresolvedStyleValue::create(move(component_values), contains_var_or_attr) }; if (component_values.is_empty()) return ParsingResult::SyntaxError; |