Skip to content

Commit

Permalink
Update CSS-Typed-OM tests to more consistently add range checks for p…
Browse files Browse the repository at this point in the history
…roperties not allowing negative values

https://bugs.webkit.org/show_bug.cgi?id=249582

Reviewed by Simon Fraser.

Update CSS-Typed-OM tests to more consistently add range checks for properties
not allowing negative values:

- animation-duration
https://w3c.github.io/csswg-drafts/css-animations/#animation-duration

- animation-iteration-count
https://w3c.github.io/csswg-drafts/css-animations/#animation-iteration-count
https://w3c.github.io/csswg-drafts/css-animations/#typedef-single-animation-iteration-count

- background-size
https://w3c.github.io/csswg-drafts/css-backgrounds/#the-background-size
https://w3c.github.io/csswg-drafts/css-backgrounds/#typedef-bg-size

- border-image-outset
https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-image-outset

- border-image-slice
https://w3c.github.io/csswg-drafts/css-backgrounds/#border-image-slice

- border-image-width
https://w3c.github.io/csswg-drafts/css-backgrounds/#border-image-width

- border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius
https://w3c.github.io/csswg-drafts/css-backgrounds/#border-radius

- font-weight
https://w3c.github.io/csswg-drafts/css-fonts/#font-weight-prop
https://w3c.github.io/csswg-drafts/css-fonts/#font-weight-absolute-values

- grid-auto-columns, grid-auto-rows
https://w3c.github.io/csswg-drafts/css-grid/#auto-tracks
https://w3c.github.io/csswg-drafts/css-grid/#typedef-track-size
https://w3c.github.io/csswg-drafts/css-grid/#typedef-track-breadth

- padding-block-start, padding-block-end, padding-inline-start, padding-inline-end
https://w3c.github.io/csswg-drafts/css-logical/#padding-properties
https://w3c.github.io/csswg-drafts/css-box-4/#propdef-padding-top

- border-block-start-width, border-block-end-width, border-inline-start-width, border-inline-end-width
https://w3c.github.io/csswg-drafts/css-logical/#border-width
https://w3c.github.io/csswg-drafts/css-backgrounds-3/#propdef-border-top-width
https://w3c.github.io/csswg-drafts/css-backgrounds-3/#typedef-line-width

- scroll-padding-top, scroll-padding-right, scroll-padding-bottom, scroll-padding-left
https://w3c.github.io/csswg-drafts/css-scroll-snap/#padding-longhands-physical

- scroll-padding-inline-start, scroll-padding-block-start, scroll-padding-inline-end, scroll-padding-block-end
https://w3c.github.io/csswg-drafts/css-scroll-snap/#padding-longhands-logical

- stroke-miterlimit
https://svgwg.org/svg2-draft/painting.html#StrokeMiterlimitProperty

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-duration-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-duration.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/animation-iteration-count.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-size-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/background-size.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-outset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-outset.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-slice-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-slice.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-width-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-image-width.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-radius-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/border-radius.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-weight-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-weight.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-auto-columns-rows-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-auto-columns-rows.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/logical-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/logical.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-padding-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/scroll-padding.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/stroke-miterlimit.html:

Canonical link: https://commits.webkit.org/258100@main
  • Loading branch information
cdumez committed Dec 19, 2022
1 parent 7764885 commit 21f9d87
Show file tree
Hide file tree
Showing 24 changed files with 327 additions and 256 deletions.
Expand Up @@ -5,7 +5,7 @@ PASS Can set 'animation-duration' to CSS-wide keywords: unset
PASS Can set 'animation-duration' to CSS-wide keywords: revert
PASS Can set 'animation-duration' to var() references: var(--A)
PASS Can set 'animation-duration' to a time: 0s
FAIL Can set 'animation-duration' to a time: -3.14ms assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
FAIL Can set 'animation-duration' to a time: -3.14ms assert_approx_equals: expected -0.00314 +/- 0.000001 but got 0
PASS Can set 'animation-duration' to a time: 3.14s
PASS Can set 'animation-duration' to a time: calc(0s + 0ms)
PASS Setting 'animation-duration' to a length: 0px throws TypeError
Expand Down
Expand Up @@ -13,7 +13,10 @@
'use strict';

runListValuedPropertyTests('animation-duration', [
{ syntax: '<time>' },
{
syntax: '<time>',
specified: assert_is_equal_with_range_handling
},
]);

</script>
Expand Up @@ -6,7 +6,7 @@ PASS Can set 'animation-iteration-count' to CSS-wide keywords: revert
PASS Can set 'animation-iteration-count' to var() references: var(--A)
PASS Can set 'animation-iteration-count' to the 'infinite' keyword: infinite
PASS Can set 'animation-iteration-count' to a number: 0
FAIL Can set 'animation-iteration-count' to a number: -3.14 assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
FAIL Can set 'animation-iteration-count' to a number: -3.14 assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
PASS Can set 'animation-iteration-count' to a number: 3.14
PASS Can set 'animation-iteration-count' to a number: calc(2 + 3)
PASS Setting 'animation-iteration-count' to a length: 0px throws TypeError
Expand Down
Expand Up @@ -15,7 +15,10 @@

runListValuedPropertyTests('animation-iteration-count', [
{ syntax: 'infinite' },
{ syntax: '<number>' },
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling
},
]);

</script>
Expand Up @@ -5,11 +5,11 @@ PASS Can set 'background-size' to CSS-wide keywords: unset
PASS Can set 'background-size' to CSS-wide keywords: revert
PASS Can set 'background-size' to var() references: var(--A)
PASS Can set 'background-size' to a length: 0px
FAIL Can set 'background-size' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'background-size' to a length: -3.14em
PASS Can set 'background-size' to a length: 3.14cm
PASS Can set 'background-size' to a length: calc(0px + 0em)
PASS Can set 'background-size' to a percent: 0%
FAIL Can set 'background-size' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
FAIL Can set 'background-size' to a percent: -3.14% assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
PASS Can set 'background-size' to a percent: 3.14%
PASS Can set 'background-size' to a percent: calc(0% + 0%)
PASS Can set 'background-size' to the 'auto' keyword: auto
Expand Down
Expand Up @@ -14,8 +14,14 @@
'use strict';

runListValuedPropertyTests('background-size', [
{ syntax: '<length>' },
{ syntax: '<percentage>' },
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling
},
{ syntax: 'auto' },
{ syntax: 'cover' },
{ syntax: 'contain' },
Expand Down
Expand Up @@ -5,11 +5,11 @@ PASS Can set 'border-image-outset' to CSS-wide keywords: unset
PASS Can set 'border-image-outset' to CSS-wide keywords: revert
PASS Can set 'border-image-outset' to var() references: var(--A)
PASS Can set 'border-image-outset' to a length: 0px
FAIL Can set 'border-image-outset' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-outset' to a length: -3.14em
PASS Can set 'border-image-outset' to a length: 3.14cm
PASS Can set 'border-image-outset' to a length: calc(0px + 0em)
PASS Can set 'border-image-outset' to a number: 0
FAIL Can set 'border-image-outset' to a number: -3.14 assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-outset' to a number: -3.14
PASS Can set 'border-image-outset' to a number: 3.14
PASS Can set 'border-image-outset' to a number: calc(2 + 3)
PASS Setting 'border-image-outset' to a percent: 0% throws TypeError
Expand Down
Expand Up @@ -18,10 +18,12 @@
// Typed OM level 1.
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
]);
Expand Down
Expand Up @@ -5,11 +5,11 @@ PASS Can set 'border-image-slice' to CSS-wide keywords: unset
PASS Can set 'border-image-slice' to CSS-wide keywords: revert
PASS Can set 'border-image-slice' to var() references: var(--A)
PASS Can set 'border-image-slice' to a number: 0
FAIL Can set 'border-image-slice' to a number: -3.14 assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-slice' to a number: -3.14
PASS Can set 'border-image-slice' to a number: 3.14
PASS Can set 'border-image-slice' to a number: calc(2 + 3)
PASS Can set 'border-image-slice' to a percent: 0%
FAIL Can set 'border-image-slice' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-slice' to a percent: -3.14%
PASS Can set 'border-image-slice' to a percent: 3.14%
PASS Can set 'border-image-slice' to a percent: calc(0% + 0%)
PASS Setting 'border-image-slice' to a length: 0px throws TypeError
Expand Down
Expand Up @@ -18,10 +18,12 @@
// Typed OM level 1.
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
]);
Expand Down
Expand Up @@ -5,15 +5,15 @@ PASS Can set 'border-image-width' to CSS-wide keywords: unset
PASS Can set 'border-image-width' to CSS-wide keywords: revert
PASS Can set 'border-image-width' to var() references: var(--A)
PASS Can set 'border-image-width' to a length: 0px
FAIL Can set 'border-image-width' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-width' to a length: -3.14em
PASS Can set 'border-image-width' to a length: 3.14cm
PASS Can set 'border-image-width' to a length: calc(0px + 0em)
PASS Can set 'border-image-width' to a percent: 0%
FAIL Can set 'border-image-width' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-width' to a percent: -3.14%
PASS Can set 'border-image-width' to a percent: 3.14%
PASS Can set 'border-image-width' to a percent: calc(0% + 0%)
PASS Can set 'border-image-width' to a number: 0
FAIL Can set 'border-image-width' to a number: -3.14 assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-image-width' to a number: -3.14
PASS Can set 'border-image-width' to a number: 3.14
PASS Can set 'border-image-width' to a number: calc(2 + 3)
PASS Can set 'border-image-width' to the 'auto' keyword: auto
Expand Down
Expand Up @@ -18,14 +18,17 @@
// Typed OM level 1.
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
{
Expand Down
Expand Up @@ -5,11 +5,11 @@ PASS Can set 'border-top-left-radius' to CSS-wide keywords: unset
PASS Can set 'border-top-left-radius' to CSS-wide keywords: revert
PASS Can set 'border-top-left-radius' to var() references: var(--A)
PASS Can set 'border-top-left-radius' to a length: 0px
FAIL Can set 'border-top-left-radius' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-top-left-radius' to a length: -3.14em
PASS Can set 'border-top-left-radius' to a length: 3.14cm
PASS Can set 'border-top-left-radius' to a length: calc(0px + 0em)
PASS Can set 'border-top-left-radius' to a percent: 0%
FAIL Can set 'border-top-left-radius' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-top-left-radius' to a percent: -3.14%
PASS Can set 'border-top-left-radius' to a percent: 3.14%
PASS Can set 'border-top-left-radius' to a percent: calc(0% + 0%)
PASS Setting 'border-top-left-radius' to a time: 0s throws TypeError
Expand All @@ -36,11 +36,11 @@ PASS Can set 'border-top-right-radius' to CSS-wide keywords: unset
PASS Can set 'border-top-right-radius' to CSS-wide keywords: revert
PASS Can set 'border-top-right-radius' to var() references: var(--A)
PASS Can set 'border-top-right-radius' to a length: 0px
FAIL Can set 'border-top-right-radius' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-top-right-radius' to a length: -3.14em
PASS Can set 'border-top-right-radius' to a length: 3.14cm
PASS Can set 'border-top-right-radius' to a length: calc(0px + 0em)
PASS Can set 'border-top-right-radius' to a percent: 0%
FAIL Can set 'border-top-right-radius' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-top-right-radius' to a percent: -3.14%
PASS Can set 'border-top-right-radius' to a percent: 3.14%
PASS Can set 'border-top-right-radius' to a percent: calc(0% + 0%)
PASS Setting 'border-top-right-radius' to a time: 0s throws TypeError
Expand All @@ -67,11 +67,11 @@ PASS Can set 'border-bottom-left-radius' to CSS-wide keywords: unset
PASS Can set 'border-bottom-left-radius' to CSS-wide keywords: revert
PASS Can set 'border-bottom-left-radius' to var() references: var(--A)
PASS Can set 'border-bottom-left-radius' to a length: 0px
FAIL Can set 'border-bottom-left-radius' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-bottom-left-radius' to a length: -3.14em
PASS Can set 'border-bottom-left-radius' to a length: 3.14cm
PASS Can set 'border-bottom-left-radius' to a length: calc(0px + 0em)
PASS Can set 'border-bottom-left-radius' to a percent: 0%
FAIL Can set 'border-bottom-left-radius' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-bottom-left-radius' to a percent: -3.14%
PASS Can set 'border-bottom-left-radius' to a percent: 3.14%
PASS Can set 'border-bottom-left-radius' to a percent: calc(0% + 0%)
PASS Setting 'border-bottom-left-radius' to a time: 0s throws TypeError
Expand All @@ -98,11 +98,11 @@ PASS Can set 'border-bottom-right-radius' to CSS-wide keywords: unset
PASS Can set 'border-bottom-right-radius' to CSS-wide keywords: revert
PASS Can set 'border-bottom-right-radius' to var() references: var(--A)
PASS Can set 'border-bottom-right-radius' to a length: 0px
FAIL Can set 'border-bottom-right-radius' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-bottom-right-radius' to a length: -3.14em
PASS Can set 'border-bottom-right-radius' to a length: 3.14cm
PASS Can set 'border-bottom-right-radius' to a length: calc(0px + 0em)
PASS Can set 'border-bottom-right-radius' to a percent: 0%
FAIL Can set 'border-bottom-right-radius' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'border-bottom-right-radius' to a percent: -3.14%
PASS Can set 'border-bottom-right-radius' to a percent: 3.14%
PASS Can set 'border-bottom-right-radius' to a percent: calc(0% + 0%)
PASS Setting 'border-bottom-right-radius' to a time: 0s throws TypeError
Expand Down
Expand Up @@ -19,10 +19,12 @@
runPropertyTests('border-' + suffix + '-radius', [
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unsupported(result)
},
]);
Expand Down
Expand Up @@ -8,7 +8,7 @@ PASS Can set 'font-weight' to the 'normal' keyword: normal
PASS Can set 'font-weight' to the 'bold' keyword: bold
PASS Can set 'font-weight' to the 'bolder' keyword: bolder
PASS Can set 'font-weight' to the 'lighter' keyword: lighter
FAIL Can set 'font-weight' to a number: 0 assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'font-weight' to a number: 0
FAIL Can set 'font-weight' to a number: -3.14 assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
FAIL Can set 'font-weight' to a number: 3.14 assert_approx_equals: expected 3.14 +/- 0.000001 but got 3
PASS Can set 'font-weight' to a number: calc(2 + 3)
Expand Down
Expand Up @@ -38,7 +38,7 @@
syntax: '<number>',
specified: (input, result) => {
if (input instanceof CSSUnitValue &&
(input.value < 0 || input.value > 1000))
(input.value < 1 || input.value > 1000))
assert_style_value_equals(result, new CSSMathSum(input));
else
assert_style_value_equals(result, input);
Expand Down
Expand Up @@ -8,11 +8,11 @@ PASS Can set 'grid-auto-columns' to the 'min-content' keyword: min-content
PASS Can set 'grid-auto-columns' to the 'max-content' keyword: max-content
PASS Can set 'grid-auto-columns' to the 'auto' keyword: auto
PASS Can set 'grid-auto-columns' to a length: 0px
FAIL Can set 'grid-auto-columns' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'grid-auto-columns' to a length: -3.14em
PASS Can set 'grid-auto-columns' to a length: 3.14cm
PASS Can set 'grid-auto-columns' to a length: calc(0px + 0em)
PASS Can set 'grid-auto-columns' to a percent: 0%
FAIL Can set 'grid-auto-columns' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
FAIL Can set 'grid-auto-columns' to a percent: -3.14% assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
PASS Can set 'grid-auto-columns' to a percent: 3.14%
PASS Can set 'grid-auto-columns' to a percent: calc(0% + 0%)
PASS Can set 'grid-auto-columns' to a flexible length: 0fr
Expand Down Expand Up @@ -44,11 +44,11 @@ PASS Can set 'grid-auto-rows' to the 'min-content' keyword: min-content
PASS Can set 'grid-auto-rows' to the 'max-content' keyword: max-content
PASS Can set 'grid-auto-rows' to the 'auto' keyword: auto
PASS Can set 'grid-auto-rows' to a length: 0px
FAIL Can set 'grid-auto-rows' to a length: -3.14em assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
PASS Can set 'grid-auto-rows' to a length: -3.14em
PASS Can set 'grid-auto-rows' to a length: 3.14cm
PASS Can set 'grid-auto-rows' to a length: calc(0px + 0em)
PASS Can set 'grid-auto-rows' to a percent: 0%
FAIL Can set 'grid-auto-rows' to a percent: -3.14% assert_equals: expected "CSSUnitValue" but got "CSSMathSum"
FAIL Can set 'grid-auto-rows' to a percent: -3.14% assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
PASS Can set 'grid-auto-rows' to a percent: 3.14%
PASS Can set 'grid-auto-rows' to a percent: calc(0% + 0%)
PASS Can set 'grid-auto-rows' to a flexible length: 0fr
Expand Down
Expand Up @@ -20,8 +20,14 @@
{ syntax: 'min-content' },
{ syntax: 'max-content' },
{ syntax: 'auto' },
{ syntax: '<length>' },
{ syntax: '<percentage>' },
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling
},
{ syntax: '<flex>' },
]);

Expand Down

0 comments on commit 21f9d87

Please sign in to comment.