From e2fa8cf7a862dc615cfa6c23716ed83ab1f8598e Mon Sep 17 00:00:00 2001 From: rmg-x Date: Fri, 16 May 2025 06:07:33 -0500 Subject: [PATCH] LibWeb+Tests: Continue variable expansion if CSS-wide keyword is parsed This allows the existing fallback logic in `Parser::expand_variables` to run when a CSS-wide keyword is encountered. --- Libraries/LibWeb/CSS/Parser/ValueParsing.cpp | 3 +++ .../Ref/expected/css-custom-prop-fallback-ref.html | 7 +++++++ Tests/LibWeb/Ref/input/css-custom-prop-fallback.html | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 Tests/LibWeb/Ref/expected/css-custom-prop-fallback-ref.html create mode 100644 Tests/LibWeb/Ref/input/css-custom-prop-fallback.html diff --git a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp index 0d4dcf673c0..8f83441728d 100644 --- a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp @@ -4051,6 +4051,9 @@ bool Parser::expand_variables(DOM::Element& element, Optional pse }; while (source.has_next_token()) { + // FIXME: We should properly cascade here instead of doing a basic fallback for CSS-wide keywords. + if (auto builtin_value = parse_builtin_value(source)) + continue; auto const& value = source.consume_a_token(); if (value.is_block()) { auto const& source_block = value.block(); diff --git a/Tests/LibWeb/Ref/expected/css-custom-prop-fallback-ref.html b/Tests/LibWeb/Ref/expected/css-custom-prop-fallback-ref.html new file mode 100644 index 00000000000..d8a968fc225 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/css-custom-prop-fallback-ref.html @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/Tests/LibWeb/Ref/input/css-custom-prop-fallback.html b/Tests/LibWeb/Ref/input/css-custom-prop-fallback.html new file mode 100644 index 00000000000..c1695a1ffcb --- /dev/null +++ b/Tests/LibWeb/Ref/input/css-custom-prop-fallback.html @@ -0,0 +1,12 @@ + + + + \ No newline at end of file