Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a5f4bb317a21ecac43636ca62237877d6627f83b
      
https://github.com/WebKit/WebKit/commit/a5f4bb317a21ecac43636ca62237877d6627f83b
  Author: Chris Dumez <cdu...@apple.com>
  Date:   2022-12-19 (Mon, 19 Dec 2022)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-auto-columns-rows-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js
    M Source/WebCore/css/typedom/CSSUnitValue.cpp
    M Source/WebCore/style/StyleBuilderConverter.h

  Log Message:
  -----------
  Fix handling of grid-template-columns / grid-template-rows in CSS Typed OM
https://bugs.webkit.org/show_bug.cgi?id=249601

Reviewed by Simon Fraser.

Fix handling of grid-template-columns / grid-template-rows in CSS Typed OM.

I updated the grid-template-columns-rows.html WPT test to allow <length>,
<percentage> and <flex>, as per the specification:
- 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

In doing so, I found several issues with our implementation:
- While we allowed setting such values, the returned computed value after
  setting would always be "none". This was due to a bug in our style builder
  converter where we assumed that the value was the "none" keyword if its
  type was a CSSPrimitiveValue. However, when coming from CSS-Typed-OM (and
  not the CSS parser), the input CSSPrimitiveValue may not have been converted
  to a CSSValueList yet. As a result, I updated the style builder converter
  to create the CSSValueList on the fly if needed.
- Per the specification, negative values are not allowed. However, those
  properties were not handled in isValueOutOfRangeForProperty() and we would
  thus fail to wrap the negative values into a `calc()`.

Finally, I updated the tests to separate the testing of positive and negative
<flex> values ('fr' unit). The reason for this is that these properties allow
<flex> values but do not allow negative <flex> values. Normally, such values
would get wrapped into a `calc()` so they could be set without throwing an
exception. However, <flex> values are currently invalid inside a calc(), as
per:
- https://w3c.github.io/csswg-drafts/css-grid/#fr-unit
"Note: <flex> values are not <length>s (nor are they compatible with <length>s,
 like some <percentage> values), so they cannot be represented in or combined
 with other unit types in calc() expressions."

As a result, we throw a TypeError when trying to set a negative <flex> value
for these 2 properties, which I believe is the expected behavior.

* 
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-template-columns-rows-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/grid-template-columns-rows.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js:
* Source/WebCore/css/typedom/CSSUnitValue.cpp:
(WebCore::isValueOutOfRangeForProperty):
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::createGridTrackList):

Canonical link: https://commits.webkit.org/258102@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to