Truly independent web browser
LibWeb: Preserve curly blocks in property initial descriptors
Andreas Kling97855e34f71d
diff --git a/Libraries/LibWeb/Rust/src/css/parser/syntax_parser.rs b/Libraries/LibWeb/Rust/src/css/parser/syntax_parser.rsindex 62baa39a423..2093a2fdd3f 100644--- a/Libraries/LibWeb/Rust/src/css/parser/syntax_parser.rs+++ b/Libraries/LibWeb/Rust/src/css/parser/syntax_parser.rs@@ -1806,7 +1806,10 @@ impl Parser {if is_custom_property && name.as_ref().len() == 2 {return None;}- if !is_custom_property {+ // INTEROP: The initial-value descriptor accepts arbitrary component values, including mixed curly blocks.+ let is_initial_value_descriptor = self.rule_context.last() == Some(&RuleContext::AtProperty)+ && equals_ascii_case_insensitive(name.as_ref(), b"initial-value");+ if !is_custom_property && !is_initial_value_descriptor {let mut contains_curly = false;let mut contains_non_whitespace = false;for component in &value {diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property.txtindex 452b4b7a958..ba4b0890201 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property.txt@@ -2,8 +2,8 @@ Harness status: OKFound 106 tests-103 Pass-3 Fail+105 Pass+1 FailPass Attribute 'syntax' returns expected value for ["<color>"]Pass Attribute 'syntax' returns expected value for ["<color> | none"]Pass Attribute 'syntax' returns expected value for ["<color># | <image> | none"]@@ -39,7 +39,7 @@ Pass Attribute 'initial-value' returns expected value for [10px]Pass Attribute 'initial-value' returns expected value for [rgb(1, 2, 3)]Pass Attribute 'initial-value' returns expected value for [red]Pass Attribute 'initial-value' returns expected value for [foo]-Fail Attribute 'initial-value' returns expected value for [foo(){}]+Pass Attribute 'initial-value' returns expected value for [foo(){}]Pass Attribute 'initial-value' makes the @property rule invalid for [3em]Fail Attribute 'initial-value' makes the @property rule invalid for [var(--x)]Pass Attribute 'inherits' returns expected value for [true]@@ -52,7 +52,7 @@ Pass Attribute 'inherits' makes the @property rule invalid for ["false"]Pass Attribute 'inherits' makes the @property rule invalid for [calc(0)]Pass Invalid property name does not parse [foo]Pass Invalid property name does not parse [-foo]-Fail Rule applied [*, foo(){}, false]+Pass Rule applied [*, foo(){}, false]Pass Rule applied [<angle>, 42deg, false]Pass Rule applied [<angle>, 1turn, false]Pass Rule applied [<color>, green, false]@@ -109,4 +109,4 @@ Pass Non-inherited properties do not inheritPass Inherited properties inheritPass Initial values substituted as computed valuePass Non-universal registration are invalid without an initial value-Pass Initial value may be omitted for universal registration+Pass Initial value may be omitted for universal registration\ No newline at end of file