Truly independent web browser
LibWeb: Create an empty numeric type from an empty unit map
Andreas Kling6113acd90dcd
diff --git a/Libraries/LibWeb/CSS/NumericType.cpp b/Libraries/LibWeb/CSS/NumericType.cppindex 17c6bac3524..f8ad01e295a 100644--- a/Libraries/LibWeb/CSS/NumericType.cpp+++ b/Libraries/LibWeb/CSS/NumericType.cpp@@ -143,8 +143,9 @@ Optional<NumericType> NumericType::create_from_unit_map(UnitMap const& unit_map)}// 3. Return the result of multiplying all the items of types.+ // NB: Multiplying no types at all, as for the empty unit map of a plain number, results in an empty type.if (types.is_empty())- return {};+ return NumericType {};auto result = types.first();bool first = true;for (auto const& type : types) {diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count.txtindex 75c8550dee8..0e56b6a0105 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count.txt@@ -2,8 +2,7 @@ Harness status: OKFound 32 tests-31 Pass-1 Fail+32 PassPass Can set 'animation-iteration-count' to CSS-wide keywords: initialPass Can set 'animation-iteration-count' to CSS-wide keywords: inheritPass Can set 'animation-iteration-count' to CSS-wide keywords: unset@@ -13,7 +12,7 @@ Pass Can set 'animation-iteration-count' to the 'infinite' keyword: infinitePass Can set 'animation-iteration-count' to a number: 0Pass Can set 'animation-iteration-count' to a number: -3.14Pass Can set 'animation-iteration-count' to a number: 3.14-Fail Can set 'animation-iteration-count' to a number: calc(2 + 3)+Pass Can set 'animation-iteration-count' to a number: calc(2 + 3)Pass Setting 'animation-iteration-count' to a length: 0px throws TypeErrorPass Setting 'animation-iteration-count' to a length: -3.14em throws TypeErrorPass Setting 'animation-iteration-count' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/fill-opacity.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/fill-opacity.txtindex 1642b9c57aa..18873967914 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/fill-opacity.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/fill-opacity.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'fill-opacity' to CSS-wide keywords: initialPass Can set 'fill-opacity' to CSS-wide keywords: inheritPass Can set 'fill-opacity' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'fill-opacity' to var() references: var(--A)Pass Can set 'fill-opacity' to a number: 0Pass Can set 'fill-opacity' to a number: -3.14Pass Can set 'fill-opacity' to a number: 3.14-Fail Can set 'fill-opacity' to a number: calc(2 + 3)+Pass Can set 'fill-opacity' to a number: calc(2 + 3)Pass Can set 'fill-opacity' to a percent: 0%Pass Can set 'fill-opacity' to a percent: -3.14%Pass Can set 'fill-opacity' to a percent: 3.14%diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-grow.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-grow.txtindex 54c86357c31..d9abf5f4206 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-grow.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-grow.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'flex-grow' to CSS-wide keywords: initialPass Can set 'flex-grow' to CSS-wide keywords: inheritPass Can set 'flex-grow' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'flex-grow' to var() references: var(--A)Pass Can set 'flex-grow' to a number: 0Pass Can set 'flex-grow' to a number: -3.14Pass Can set 'flex-grow' to a number: 3.14-Fail Can set 'flex-grow' to a number: calc(2 + 3)+Pass Can set 'flex-grow' to a number: calc(2 + 3)Pass Setting 'flex-grow' to a length: 0px throws TypeErrorPass Setting 'flex-grow' to a length: -3.14em throws TypeErrorPass Setting 'flex-grow' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-shrink.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-shrink.txtindex f27d3d14355..22ff28ae119 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-shrink.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flex-shrink.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'flex-shrink' to CSS-wide keywords: initialPass Can set 'flex-shrink' to CSS-wide keywords: inheritPass Can set 'flex-shrink' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'flex-shrink' to var() references: var(--A)Pass Can set 'flex-shrink' to a number: 0Pass Can set 'flex-shrink' to a number: -3.14Pass Can set 'flex-shrink' to a number: 3.14-Fail Can set 'flex-shrink' to a number: calc(2 + 3)+Pass Can set 'flex-shrink' to a number: calc(2 + 3)Pass Setting 'flex-shrink' to a length: 0px throws TypeErrorPass Setting 'flex-shrink' to a length: -3.14em throws TypeErrorPass Setting 'flex-shrink' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flood-opacity.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flood-opacity.txtindex 0fd23dc6a0d..d6f7f5b548e 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flood-opacity.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/flood-opacity.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'flood-opacity' to CSS-wide keywords: initialPass Can set 'flood-opacity' to CSS-wide keywords: inheritPass Can set 'flood-opacity' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'flood-opacity' to var() references: var(--A)Pass Can set 'flood-opacity' to a number: 0Pass Can set 'flood-opacity' to a number: -3.14Pass Can set 'flood-opacity' to a number: 3.14-Fail Can set 'flood-opacity' to a number: calc(2 + 3)+Pass Can set 'flood-opacity' to a number: calc(2 + 3)Pass Can set 'flood-opacity' to a percent: 0%Pass Can set 'flood-opacity' to a percent: -3.14%Pass Can set 'flood-opacity' to a percent: 3.14%diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.txtindex cb3e9b9b1b6..4d7eb9fdbd3 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.txt@@ -2,8 +2,7 @@ Harness status: OKFound 32 tests-31 Pass-1 Fail+32 PassPass Can set 'font-size-adjust' to CSS-wide keywords: initialPass Can set 'font-size-adjust' to CSS-wide keywords: inheritPass Can set 'font-size-adjust' to CSS-wide keywords: unset@@ -13,7 +12,7 @@ Pass Can set 'font-size-adjust' to the 'none' keyword: nonePass Can set 'font-size-adjust' to a number: 0Pass Can set 'font-size-adjust' to a number: -3.14Pass Can set 'font-size-adjust' to a number: 3.14-Fail Can set 'font-size-adjust' to a number: calc(2 + 3)+Pass Can set 'font-size-adjust' to a number: calc(2 + 3)Pass Setting 'font-size-adjust' to a length: 0px throws TypeErrorPass Setting 'font-size-adjust' to a length: -3.14em throws TypeErrorPass Setting 'font-size-adjust' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-weight.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-weight.txtindex 3cab31292e3..4f5aa695ecd 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-weight.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/font-weight.txt@@ -2,8 +2,7 @@ Harness status: OKFound 35 tests-34 Pass-1 Fail+35 PassPass Can set 'font-weight' to CSS-wide keywords: initialPass Can set 'font-weight' to CSS-wide keywords: inheritPass Can set 'font-weight' to CSS-wide keywords: unset@@ -16,7 +15,7 @@ Pass Can set 'font-weight' to the 'lighter' keyword: lighterPass Can set 'font-weight' to a number: 0Pass Can set 'font-weight' to a number: -3.14Pass Can set 'font-weight' to a number: 3.14-Fail Can set 'font-weight' to a number: calc(2 + 3)+Pass Can set 'font-weight' to a number: calc(2 + 3)Pass Setting 'font-weight' to a length: 0px throws TypeErrorPass Setting 'font-weight' to a length: -3.14em throws TypeErrorPass Setting 'font-weight' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/opacity.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/opacity.txtindex 6daeff3d778..dfee2d38907 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/opacity.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/opacity.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'opacity' to CSS-wide keywords: initialPass Can set 'opacity' to CSS-wide keywords: inheritPass Can set 'opacity' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'opacity' to var() references: var(--A)Pass Can set 'opacity' to a number: 0Pass Can set 'opacity' to a number: -3.14Pass Can set 'opacity' to a number: 3.14-Fail Can set 'opacity' to a number: calc(2 + 3)+Pass Can set 'opacity' to a number: calc(2 + 3)Pass Can set 'opacity' to a percent: 0%Pass Can set 'opacity' to a percent: -3.14%Pass Can set 'opacity' to a percent: 3.14%diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-image-threshold.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-image-threshold.txtindex 8f520e74e4e..f1f9ae88a68 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-image-threshold.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/shape-image-threshold.txt@@ -2,8 +2,8 @@ Harness status: OKFound 31 tests-26 Pass-5 Fail+27 Pass+4 FailPass Can set 'shape-image-threshold' to CSS-wide keywords: initialPass Can set 'shape-image-threshold' to CSS-wide keywords: inheritPass Can set 'shape-image-threshold' to CSS-wide keywords: unset@@ -12,7 +12,7 @@ Pass Can set 'shape-image-threshold' to var() references: var(--A)Pass Can set 'shape-image-threshold' to a number: 0Pass Can set 'shape-image-threshold' to a number: -3.14Pass Can set 'shape-image-threshold' to a number: 3.14-Fail Can set 'shape-image-threshold' to a number: calc(2 + 3)+Pass Can set 'shape-image-threshold' to a number: calc(2 + 3)Pass Setting 'shape-image-threshold' to a length: 0px throws TypeErrorPass Setting 'shape-image-threshold' to a length: -3.14em throws TypeErrorPass Setting 'shape-image-threshold' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stop-opacity.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stop-opacity.txtindex 658a05c13ab..bcdf9064a60 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stop-opacity.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stop-opacity.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'stop-opacity' to CSS-wide keywords: initialPass Can set 'stop-opacity' to CSS-wide keywords: inheritPass Can set 'stop-opacity' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'stop-opacity' to var() references: var(--A)Pass Can set 'stop-opacity' to a number: 0Pass Can set 'stop-opacity' to a number: -3.14Pass Can set 'stop-opacity' to a number: 3.14-Fail Can set 'stop-opacity' to a number: calc(2 + 3)+Pass Can set 'stop-opacity' to a number: calc(2 + 3)Pass Can set 'stop-opacity' to a percent: 0%Pass Can set 'stop-opacity' to a percent: -3.14%Pass Can set 'stop-opacity' to a percent: 3.14%diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit.txtindex f1552f3ebc9..dbaac6d7f24 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'stroke-miterlimit' to CSS-wide keywords: initialPass Can set 'stroke-miterlimit' to CSS-wide keywords: inheritPass Can set 'stroke-miterlimit' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'stroke-miterlimit' to var() references: var(--A)Pass Can set 'stroke-miterlimit' to a number: 0Pass Can set 'stroke-miterlimit' to a number: -3.14Pass Can set 'stroke-miterlimit' to a number: 3.14-Fail Can set 'stroke-miterlimit' to a number: calc(2 + 3)+Pass Can set 'stroke-miterlimit' to a number: calc(2 + 3)Pass Setting 'stroke-miterlimit' to a length: 0px throws TypeErrorPass Setting 'stroke-miterlimit' to a length: -3.14em throws TypeErrorPass Setting 'stroke-miterlimit' to a length: 3.14cm throws TypeErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-opacity.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-opacity.txtindex d9218da598a..5c17f33e0ed 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-opacity.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/properties/stroke-opacity.txt@@ -2,8 +2,7 @@ Harness status: OKFound 31 tests-30 Pass-1 Fail+31 PassPass Can set 'stroke-opacity' to CSS-wide keywords: initialPass Can set 'stroke-opacity' to CSS-wide keywords: inheritPass Can set 'stroke-opacity' to CSS-wide keywords: unset@@ -12,7 +11,7 @@ Pass Can set 'stroke-opacity' to var() references: var(--A)Pass Can set 'stroke-opacity' to a number: 0Pass Can set 'stroke-opacity' to a number: -3.14Pass Can set 'stroke-opacity' to a number: 3.14-Fail Can set 'stroke-opacity' to a number: calc(2 + 3)+Pass Can set 'stroke-opacity' to a number: calc(2 + 3)Pass Can set 'stroke-opacity' to a percent: 0%Pass Can set 'stroke-opacity' to a percent: -3.14%Pass Can set 'stroke-opacity' to a percent: 3.14%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 66aec03c842..d4bb56bc398 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,8 +2,8 @@ Harness status: OKFound 31 tests-28 Pass-3 Fail+29 Pass+2 FailPass 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: unset@@ -12,7 +12,7 @@ Pass Can set 'tab-size' to var() references: var(--A)Fail Can set 'tab-size' to a number: 0Fail Can set 'tab-size' to a number: -3.14Pass Can set 'tab-size' to a number: 3.14-Fail Can set 'tab-size' to a number: calc(2 + 3)+Pass Can set 'tab-size' to a number: calc(2 + 3)Pass Can set 'tab-size' to a length: 0pxPass Can set 'tab-size' to a length: -3.14emPass Can set 'tab-size' to a length: 3.14cm