Truly independent web browser
LibWeb: Preserve unitless zero for numeric properties
Andreas Klingbfa02c82a641
diff --git a/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cppindex 54f8d5e73e8..b9ecf03bba6 100644--- a/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp+++ b/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp@@ -27,7 +27,9 @@ GC::Ref<CSSStyleValue> NumberStyleValue::reify(Utf16FlyString const& associated_// FIXME: Do this for registered custom properties.if (auto property_id = property_id_from_string(associated_property); property_id.has_value()&& property_id != PropertyID::Custom- && property_accepts_type(*property_id, ValueType::Length)) {+ && property_accepts_type(*property_id, ValueType::Length)+ && !property_accepts_type(*property_id, ValueType::Number)+ && !property_accepts_type(*property_id, ValueType::Integer)) {return CSSUnitValue::create(0, "px"_utf16_fly_string);}}diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/line-height.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/line-height.txtindex 55f17285b42..286d41780be 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/line-height.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/line-height.txt@@ -2,8 +2,7 @@ Harness status: OKFound 32 tests-30 Pass-2 Fail+32 PassPass Can set 'line-height' to CSS-wide keywords: initialPass Can set 'line-height' to CSS-wide keywords: inheritPass Can set 'line-height' to CSS-wide keywords: unset@@ -14,8 +13,8 @@ Pass Can set 'line-height' to a length: 0pxPass Can set 'line-height' to a length: -3.14emPass Can set 'line-height' to a length: 3.14cmPass Can set 'line-height' to a length: calc(0px + 0em)-Fail Can set 'line-height' to a number: 0-Fail Can set 'line-height' to a number: -3.14+Pass Can set 'line-height' to a number: 0+Pass Can set 'line-height' to a number: -3.14Pass Can set 'line-height' to a number: 3.14Pass Can set 'line-height' to a number: calc(2 + 3)Pass Can set 'line-height' to a percent: 0%diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/tab-size.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/tab-size.txtindex d4bb56bc398..0f10ce8127b 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/tab-size.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/tab-size.txt@@ -2,15 +2,14 @@ Harness status: OKFound 31 tests-29 Pass-2 Fail+31 PassPass Can set 'tab-size' to CSS-wide keywords: initialPass Can set 'tab-size' to CSS-wide keywords: inheritPass Can set 'tab-size' to CSS-wide keywords: unsetPass Can set 'tab-size' to CSS-wide keywords: revertPass Can set 'tab-size' to var() references: var(--A)-Fail Can set 'tab-size' to a number: 0-Fail Can set 'tab-size' to a number: -3.14+Pass Can set 'tab-size' to a number: 0+Pass Can set 'tab-size' to a number: -3.14Pass Can set 'tab-size' to a number: 3.14Pass Can set 'tab-size' to a number: calc(2 + 3)Pass Can set 'tab-size' to a length: 0px