Skip to content

Commit

Permalink
Fix css/css-typed-om/the-stylepropertymap/properties/grid-template-co…
Browse files Browse the repository at this point in the history
…lumns-rows.html WPT test

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

Reviewed by Simon Fraser.

Fix css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows.html
WPT test to match the specification:
- https://w3c.github.io/csswg-drafts/css-grid/#track-sizing
- https://w3c.github.io/csswg-drafts/css-grid/#typedef-track-list
- https://w3c.github.io/csswg-drafts/css-grid/#typedef-track-size
- https://w3c.github.io/csswg-drafts/css-grid/#typedef-track-breadth

The specification indicates that the track size cannot be a negative value.
However, the test was expected -3.14% as computed value in one of the checks.

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows.html:

Canonical link: https://commits.webkit.org/258302@main
  • Loading branch information
cdumez committed Dec 23, 2022
1 parent 1315b2b commit a53256f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Expand Up @@ -10,7 +10,7 @@ PASS Can set 'grid-template-columns' to a length: -3.14em
PASS Can set 'grid-template-columns' to a length: 3.14cm
PASS Can set 'grid-template-columns' to a length: calc(0px + 0em)
PASS Can set 'grid-template-columns' to a percent: 0%
FAIL Can set 'grid-template-columns' to a percent: -3.14% assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
PASS Can set 'grid-template-columns' to a percent: -3.14%
PASS Can set 'grid-template-columns' to a percent: 3.14%
PASS Can set 'grid-template-columns' to a percent: calc(0% + 0%)
PASS Can set 'grid-template-columns' to a flexible length: 0fr
Expand Down Expand Up @@ -44,7 +44,7 @@ PASS Can set 'grid-template-rows' to a length: -3.14em
PASS Can set 'grid-template-rows' to a length: 3.14cm
PASS Can set 'grid-template-rows' to a length: calc(0px + 0em)
PASS Can set 'grid-template-rows' to a percent: 0%
FAIL Can set 'grid-template-rows' to a percent: -3.14% assert_approx_equals: expected -3.14 +/- 0.000001 but got 0
PASS Can set 'grid-template-rows' to a percent: -3.14%
PASS Can set 'grid-template-rows' to a percent: 3.14%
PASS Can set 'grid-template-rows' to a percent: calc(0% + 0%)
PASS Can set 'grid-template-rows' to a flexible length: 0fr
Expand Down
Expand Up @@ -13,6 +13,15 @@
<script>
'use strict';

function assert_is_equal_with_clamping_percentage(input, result) {
const percent = input.to('percent').value;

if (percent < 0)
assert_style_value_equals(result, new CSSUnitValue(0, 'percent'));
else
assert_style_value_equals(result, new CSSUnitValue(percent, 'percent'));
}

for (const suffix of ['columns', 'rows']) {
runPropertyTests(`grid-template-${suffix}`, [
{ syntax: 'none' },
Expand All @@ -22,7 +31,8 @@
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling
specified: assert_is_equal_with_range_handling,
computed: assert_is_equal_with_clamping_percentage
},
{
syntax: '<flex>',
Expand Down

0 comments on commit a53256f

Please sign in to comment.