Skip to content

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.cpp
index 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_int
if (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.txt
index 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: OK
Found 32 tests
-31 Pass
-1 Fail
+32 Pass
Pass Can set 'column-count' to CSS-wide keywords: initial
Pass Can set 'column-count' to CSS-wide keywords: inherit
Pass Can set 'column-count' to CSS-wide keywords: unset
@@ -13,7 +12,7 @@ Pass Can set 'column-count' to the 'auto' keyword: auto
Pass Can set 'column-count' to a number: 0
Pass Can set 'column-count' to a number: -3.14
Pass 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 TypeError
Pass Setting 'column-count' to a length: -3.14em throws TypeError
Pass Setting 'column-count' to a length: 3.14cm throws TypeError
diff --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.txt
index 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: OK
Found 31 tests
-30 Pass
-1 Fail
+31 Pass
Pass Can set 'order' to CSS-wide keywords: initial
Pass Can set 'order' to CSS-wide keywords: inherit
Pass 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: 0
Pass Can set 'order' to a number: -3.14
Pass 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 TypeError
Pass Setting 'order' to a length: -3.14em throws TypeError
Pass Setting 'order' to a length: 3.14cm throws TypeError
diff --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.txt
index 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: OK
Found 31 tests
-30 Pass
-1 Fail
+31 Pass
Pass Can set 'orphans' to CSS-wide keywords: initial
Pass Can set 'orphans' to CSS-wide keywords: inherit
Pass 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: 0
Pass Can set 'orphans' to a number: -3.14
Pass 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 TypeError
Pass Setting 'orphans' to a length: -3.14em throws TypeError
Pass Setting 'orphans' to a length: 3.14cm throws TypeError
diff --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.txt
index 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: OK
Found 31 tests
-30 Pass
-1 Fail
+31 Pass
Pass Can set 'widows' to CSS-wide keywords: initial
Pass Can set 'widows' to CSS-wide keywords: inherit
Pass 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: 0
Pass Can set 'widows' to a number: -3.14
Pass 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 TypeError
Pass Setting 'widows' to a length: -3.14em throws TypeError
Pass Setting 'widows' to a length: 3.14cm throws TypeError
diff --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.txt
index 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: OK
Found 32 tests
-31 Pass
-1 Fail
+32 Pass
Pass Can set 'z-index' to CSS-wide keywords: initial
Pass Can set 'z-index' to CSS-wide keywords: inherit
Pass Can set 'z-index' to CSS-wide keywords: unset
@@ -13,7 +12,7 @@ Pass Can set 'z-index' to the 'auto' keyword: auto
Pass Can set 'z-index' to a number: 0
Pass Can set 'z-index' to a number: -3.14
Pass 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 TypeError
Pass Setting 'z-index' to a length: -3.14em throws TypeError
Pass Setting 'z-index' to a length: 3.14cm throws TypeError