Truly independent web browser
LibWeb: Accept numeric calculations for integer properties
Andreas Kling4364006c6821
diff --git a/Libraries/LibWeb/CSS/CSSMathValue.cpp b/Libraries/LibWeb/CSS/CSSMathValue.cppindex 68764c7eb55..74313104c59 100644--- a/Libraries/LibWeb/CSS/CSSMathValue.cpp+++ b/Libraries/LibWeb/CSS/CSSMathValue.cpp@@ -46,7 +46,7 @@ WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSMathValue::create_an_intif (type().matches_length(context.percentages_resolve_as))return property_accepts_type(property.id(), ValueType::Length);if (type().matches_number(context.percentages_resolve_as))- return property_accepts_type(property.id(), ValueType::Number) || property_accepts_type(property.id(), ValueType::OpacityValue);+ return property_accepts_type(property.id(), ValueType::Number) || property_accepts_type(property.id(), ValueType::Integer) || property_accepts_type(property.id(), ValueType::OpacityValue);if (type().matches_percentage())return property_accepts_type(property.id(), ValueType::Percentage) || property_accepts_type(property.id(), ValueType::OpacityValue);if (type().matches_resolution(context.percentages_resolve_as))diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/column-count.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/column-count.txtindex 01953952c2c..0a0f111b113 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/column-count.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/column-count.txt@@ -2,8 +2,7 @@ Harness status: OKFound 32 tests-31 Pass-1 Fail+32 PassPass Can set 'column-count' to CSS-wide keywords: initialPass Can set 'column-count' to CSS-wide keywords: inheritPass Can set 'column-count' to CSS-wide keywords: unset@@ -13,7 +12,7 @@ Pass Can set 'column-count' to the 'auto' keyword: autoPass Can set 'column-count' to a number: 0Pass Can set 'column-count' to a number: -3.14Pass Can set 'column-count' to a number: 3.14-Fail Can set 'column-count' to a number: calc(2 + 3)+Pass Can set 'column-count' to a number: calc(2 + 3)Pass Setting 'column-count' to a length: 0px throws TypeErrorPass Setting 'column-count' to a length: -3.14em throws TypeErrorPass Setting 'column-count' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/order.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/order.txtindex 55d50ef4a5a..59a56924508 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/order.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/order.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'order' to CSS-wide keywords: initialPass Can set 'order' to CSS-wide keywords: inheritPass Can set 'order' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'order' to var() references: var(--A)Pass Can set 'order' to a number: 0Pass Can set 'order' to a number: -3.14Pass Can set 'order' to a number: 3.14-Fail Can set 'order' to a number: calc(2 + 3)+Pass Can set 'order' to a number: calc(2 + 3)Pass Setting 'order' to a length: 0px throws TypeErrorPass Setting 'order' to a length: -3.14em throws TypeErrorPass Setting 'order' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/orphans.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/orphans.txtindex 643b80a299e..fd3b37c9c27 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/orphans.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/orphans.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'orphans' to CSS-wide keywords: initialPass Can set 'orphans' to CSS-wide keywords: inheritPass Can set 'orphans' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'orphans' to var() references: var(--A)Pass Can set 'orphans' to a number: 0Pass Can set 'orphans' to a number: -3.14Pass Can set 'orphans' to a number: 3.14-Fail Can set 'orphans' to a number: calc(2 + 3)+Pass Can set 'orphans' to a number: calc(2 + 3)Pass Setting 'orphans' to a length: 0px throws TypeErrorPass Setting 'orphans' to a length: -3.14em throws TypeErrorPass Setting 'orphans' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/widows.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/widows.txtindex 48d9d09629c..d7eabc9bd19 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/widows.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/widows.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'widows' to CSS-wide keywords: initialPass Can set 'widows' to CSS-wide keywords: inheritPass Can set 'widows' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'widows' to var() references: var(--A)Pass Can set 'widows' to a number: 0Pass Can set 'widows' to a number: -3.14Pass Can set 'widows' to a number: 3.14-Fail Can set 'widows' to a number: calc(2 + 3)+Pass Can set 'widows' to a number: calc(2 + 3)Pass Setting 'widows' to a length: 0px throws TypeErrorPass Setting 'widows' to a length: -3.14em throws TypeErrorPass Setting 'widows' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/z-index.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/z-index.txtindex 79cb86a18eb..dbcdd7d2473 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/z-index.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/z-index.txt@@ -2,8 +2,7 @@ Harness status: OKFound 32 tests-31 Pass-1 Fail+32 PassPass Can set 'z-index' to CSS-wide keywords: initialPass Can set 'z-index' to CSS-wide keywords: inheritPass Can set 'z-index' to CSS-wide keywords: unset@@ -13,7 +12,7 @@ Pass Can set 'z-index' to the 'auto' keyword: autoPass Can set 'z-index' to a number: 0Pass Can set 'z-index' to a number: -3.14Pass Can set 'z-index' to a number: 3.14-Fail Can set 'z-index' to a number: calc(2 + 3)+Pass Can set 'z-index' to a number: calc(2 + 3)Pass Setting 'z-index' to a length: 0px throws TypeErrorPass Setting 'z-index' to a length: -3.14em throws TypeErrorPass Setting 'z-index' to a length: 3.14cm throws TypeError