Skip to content

Truly independent web browser

LibWeb: Preserve empty registered initial values

Andreas Klingc75e1d051d84
diff --git a/Libraries/LibWeb/Rust/src/css/parser/descriptor_parser.rs b/Libraries/LibWeb/Rust/src/css/parser/descriptor_parser.rs
index f06bdd9d0a5..034e48a5073 100644
--- a/Libraries/LibWeb/Rust/src/css/parser/descriptor_parser.rs
+++ b/Libraries/LibWeb/Rust/src/css/parser/descriptor_parser.rs
@@ -427,7 +427,7 @@ fn parse_value_type(
Some(value_list(parsed, 0, false))
}
DescriptorValueType::OptionalDeclarationValue => {
- if !declaration_value_is_valid(values) {
+ if !values.is_empty() && !declaration_value_is_valid(values) {
return None;
}
Some(unresolved_value(
diff --git a/Libraries/LibWeb/Rust/src/css/parser/syntax.rs b/Libraries/LibWeb/Rust/src/css/parser/syntax.rs
index 7e9ebcb6db4..d612f724882 100644
--- a/Libraries/LibWeb/Rust/src/css/parser/syntax.rs
+++ b/Libraries/LibWeb/Rust/src/css/parser/syntax.rs
@@ -401,7 +401,7 @@ pub(crate) fn parse_with_syntax_component_values(
original_source: Option<&[u16]>,
) -> Option<StyleValueData> {
if matches!(syntax, SyntaxNode::Universal) {
- if !declaration_value_is_valid(values) {
+ if !values.is_empty() && !declaration_value_is_valid(values) {
return None;
}
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property-optional-initial-value.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property-optional-initial-value.txt
index f318cee8101..3466744dc20 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property-optional-initial-value.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-properties-values-api/at-property-optional-initial-value.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail @property with empty initial-value should use space character
\ No newline at end of file
+1 Pass
+Pass @property with empty initial-value should use space character
\ No newline at end of file