Title: [288544] trunk
Revision
288544
Author
z...@igalia.com
Date
2022-01-25 01:57:44 -0800 (Tue, 25 Jan 2022)

Log Message

[css-grid] Fix grid shorthand expansion of initial values
https://bugs.webkit.org/show_bug.cgi?id=234430

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt:
* web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt:

Source/WebCore:

This CL is to add the InitialValue support when parsing the grid shorthand for 6 grid properties
including grid-auto-columns, grid-auto-flow, grid-auto-rows, grid-template-areas,
grid-template-columns and grid-template-rows. The original code only adds a CSSInitial.

This is an import of chromium change at
https://chromium-review.googlesource.com/c/chromium/src/+/3299364

Apart from fixing wpt test imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand.html,
The CL also updates the expectation file for test
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid.html. This test fails before
this CL and need to be investigated as a seperated issue. Related bugs have been raised at -
https://bugs.chromium.org/p/chromium/issues/detail?id=1028283 &
https://bugs.webkit.org/show_bug.cgi?id=204611

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeImplicitGridAutoFlow):
(WebCore::CSSPropertyParser::consumeGridShorthand):
* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertGridTrackSizeList):
(WebCore::Style::BuilderConverter::convertGridAutoFlow):

LayoutTests:

* fast/css-grid-layout/grid-shorthand-get-set-expected.txt:
* fast/css-grid-layout/grid-shorthand-get-set.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288543 => 288544)


--- trunk/LayoutTests/ChangeLog	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/LayoutTests/ChangeLog	2022-01-25 09:57:44 UTC (rev 288544)
@@ -1,3 +1,13 @@
+2022-01-25  Ziran Sun  <z...@igalia.com>
+
+        [css-grid] Fix grid shorthand expansion of initial values
+        https://bugs.webkit.org/show_bug.cgi?id=234430
+
+        Reviewed by Sergio Villar Senin.
+
+        * fast/css-grid-layout/grid-shorthand-get-set-expected.txt:
+        * fast/css-grid-layout/grid-shorthand-get-set.html:
+        
 2022-01-24  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt (288543 => 288544)


--- trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set-expected.txt	2022-01-25 09:57:44 UTC (rev 288544)
@@ -201,11 +201,11 @@
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
 PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row"
-PASS element.style.gridAutoFlow is "initial"
+PASS element.style.gridAutoFlow is "row"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto"
-PASS element.style.gridAutoColumns is "initial"
+PASS element.style.gridAutoColumns is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "10px"
 PASS element.style.gridTemplateColumns is "10px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "[line] 20px"
@@ -213,59 +213,59 @@
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "\"a\""
 PASS element.style.gridTemplateAreas is "\"a\""
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row"
-PASS element.style.gridAutoFlow is "initial"
+PASS element.style.gridAutoFlow is "row"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto"
-PASS element.style.gridAutoColumns is "initial"
+PASS element.style.gridAutoColumns is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
 PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
-PASS element.style.gridTemplateRows is "initial"
+PASS element.style.gridTemplateRows is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
-PASS element.style.gridTemplateAreas is "initial"
+PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "dense"
-PASS element.style.gridAutoFlow is "row dense"
+PASS element.style.gridAutoFlow is "dense"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto"
-PASS element.style.gridAutoColumns is "initial"
+PASS element.style.gridAutoColumns is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "20px"
 PASS element.style.gridAutoRows is "20px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
-PASS element.style.gridTemplateColumns is "initial"
+PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "20px"
 PASS element.style.gridTemplateRows is "20px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
-PASS element.style.gridTemplateAreas is "initial"
+PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column"
 PASS element.style.gridAutoFlow is "column"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "10px"
 PASS element.style.gridAutoColumns is "10px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
-PASS element.style.gridTemplateColumns is "initial"
+PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
 PASS element.style.gridTemplateRows is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
-PASS element.style.gridTemplateAreas is "initial"
+PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column dense"
 PASS element.style.gridAutoFlow is "column dense"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "20px"
 PASS element.style.gridAutoColumns is "20px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
-PASS element.style.gridTemplateColumns is "initial"
+PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "10px"
 PASS element.style.gridTemplateRows is "10px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
-PASS element.style.gridTemplateAreas is "initial"
+PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column"
 PASS element.style.gridAutoFlow is "column"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "20px"
 PASS element.style.gridAutoColumns is "20px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 
 Test the initial value
 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
@@ -283,17 +283,17 @@
 
 Test setting grid-template-columns and grid-template-rows back to 'none' through JS
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
-PASS element.style.gridTemplateColumns is "initial"
+PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "10px"
 PASS element.style.gridTemplateRows is "10px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
-PASS element.style.gridTemplateAreas is "initial"
+PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column"
 PASS element.style.gridAutoFlow is "column"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "20px"
 PASS element.style.gridAutoColumns is "20px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
 PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
@@ -301,23 +301,23 @@
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
 PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row"
-PASS element.style.gridAutoFlow is "initial"
+PASS element.style.gridAutoFlow is "row"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto"
-PASS element.style.gridAutoColumns is "initial"
+PASS element.style.gridAutoColumns is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
-PASS element.style.gridTemplateColumns is "initial"
+PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "20px"
 PASS element.style.gridTemplateRows is "20px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
-PASS element.style.gridTemplateAreas is "initial"
+PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "column"
 PASS element.style.gridAutoFlow is "column"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "10px"
 PASS element.style.gridAutoColumns is "10px"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
 PASS element.style.gridTemplateColumns is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
@@ -325,11 +325,11 @@
 PASS getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none"
 PASS element.style.gridTemplateAreas is "none"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-flow') is "row"
-PASS element.style.gridAutoFlow is "initial"
+PASS element.style.gridAutoFlow is "row"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-columns') is "auto"
-PASS element.style.gridAutoColumns is "initial"
+PASS element.style.gridAutoColumns is "auto"
 PASS getComputedStyle(element, '').getPropertyValue('grid-auto-rows') is "auto"
-PASS element.style.gridAutoRows is "initial"
+PASS element.style.gridAutoRows is "auto"
 
 Test the inherit value does not affect gutter properties (grid-*-gap)
 PASS getComputedStyle(anotherElement, '').getPropertyValue('grid-column-gap') is "normal"

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html (288543 => 288544)


--- trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html	2022-01-25 09:57:44 UTC (rev 288544)
@@ -178,12 +178,12 @@
 
     debug("");
     debug("Test getting and setting 'grid' shorthand through JS");
-    testGridDefinitionsSetJSValues("20px / 10px", "10px", "20px", "none", "row", "auto", "auto", "10px", "20px", "none", "initial", "initial", "initial");
-    testGridDefinitionsSetJSValues("[line] 'a' 20px / 10px", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto", "10px", "[line] 20px", "\"a\"", "initial", "initial", "initial");
-    testGridDefinitionsSetJSValues("auto-flow dense 20px / none", "none", "none", "none", "dense", "auto", "20px", "none", "initial", "initial", "row dense", "initial", "20px");
-    testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "initial", "20px", "initial", "column", "10px", "initial");
-    testGridDefinitionsSetJSValues("none / auto-flow dense 20px", "none", "none", "none", "column dense", "20px", "auto", "initial", "none", "initial", "column dense", "20px", "initial");
-    testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "initial", "10px", "initial", "column", "20px", "initial");
+    testGridDefinitionsSetJSValues("20px / 10px", "10px", "20px", "none", "row", "auto", "auto", "10px", "20px", "none", "row", "auto", "auto");
+    testGridDefinitionsSetJSValues("[line] 'a' 20px / 10px", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto", "10px", "[line] 20px", "\"a\"", "row", "auto", "auto");
+    testGridDefinitionsSetJSValues("auto-flow dense 20px / none", "none", "none", "none", "dense", "auto", "20px", "none", "none", "none", "dense", "auto", "20px");
+    testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "none", "20px", "none", "column", "10px", "auto");
+    testGridDefinitionsSetJSValues("none / auto-flow dense 20px", "none", "none", "none", "column dense", "20px", "auto", "none", "none", "none", "column dense", "20px", "auto");
+    testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "none", "10px", "none", "column", "20px", "auto");
 
     debug("");
     debug("Test the initial value");
@@ -199,10 +199,10 @@
 
     debug("");
     debug("Test setting grid-template-columns and grid-template-rows back to 'none' through JS");
-    testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "initial", "10px", "initial", "column", "20px", "initial");
-    testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "initial", "initial", "initial");
-    testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "initial", "20px", "initial", "column", "10px", "initial");
-    testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "initial", "initial", "initial");
+    testGridDefinitionsSetJSValues("10px / auto-flow 20px", "none", "10px", "none", "column", "20px", "auto", "none", "10px", "none", "column", "20px", "auto");
+    testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "row", "auto", "auto");
+    testGridDefinitionsSetJSValues("20px / auto-flow 10px", "none", "20px", "none", "column", "10px", "auto", "none", "20px", "none", "column", "10px", "auto");
+    testGridDefinitionsSetJSValues("none", "none", "none", "none", "row", "auto", "auto", "none", "none", "none", "row", "auto", "auto");
 
     debug("");
     debug("Test the inherit value does not affect gutter properties (grid-*-gap)");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288543 => 288544)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-25 09:57:44 UTC (rev 288544)
@@ -1,3 +1,13 @@
+2022-01-25  Ziran Sun  <z...@igalia.com>
+
+        [css-grid] Fix grid shorthand expansion of initial values
+        https://bugs.webkit.org/show_bug.cgi?id=234430
+
+        Reviewed by Sergio Villar Senin.
+
+        * web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt:
+        * web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt:
+
 2022-01-24  Youenn Fablet  <you...@apple.com>
 
         A sandboxed document should not reuse its service worker client ID

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt (288543 => 288544)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt	2022-01-25 09:57:44 UTC (rev 288544)
@@ -1,42 +1,42 @@
 
-FAIL e.style['grid'] = "none" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "none" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial"
-FAIL e.style['grid'] = "none" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
+PASS e.style['grid'] = "none" should set grid-auto-columns
+PASS e.style['grid'] = "none" should set grid-auto-flow
+PASS e.style['grid'] = "none" should set grid-auto-rows
 PASS e.style['grid'] = "none" should set grid-template-areas
 PASS e.style['grid'] = "none" should set grid-template-columns
 PASS e.style['grid'] = "none" should set grid-template-rows
 PASS e.style['grid'] = "none" should not set unrelated longhands
-FAIL e.style['grid'] = "10px / 20%" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "10px / 20%" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial"
-FAIL e.style['grid'] = "10px / 20%" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
+PASS e.style['grid'] = "10px / 20%" should set grid-auto-columns
+PASS e.style['grid'] = "10px / 20%" should set grid-auto-flow
+PASS e.style['grid'] = "10px / 20%" should set grid-auto-rows
 PASS e.style['grid'] = "10px / 20%" should set grid-template-areas
 PASS e.style['grid'] = "10px / 20%" should set grid-template-columns
 PASS e.style['grid'] = "10px / 20%" should set grid-template-rows
 PASS e.style['grid'] = "10px / 20%" should not set unrelated longhands
-FAIL e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial"
-FAIL e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
+PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-columns
+PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-flow
+PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-auto-rows
 PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-template-areas
 PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-template-columns
 PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should set grid-template-rows
 PASS e.style['grid'] = "fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))" should not set unrelated longhands
-FAIL e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial"
-FAIL e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
+PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-auto-columns
+PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-auto-flow
+PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-auto-rows
 PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-template-areas
 PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-template-columns
 PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should set grid-template-rows
 PASS e.style['grid'] = "[header-top] \"a a a\"     [header-bottom]  [main-top] \"b b b\" 1fr [main-bottom]           / auto 1fr auto" should not set unrelated longhands
-FAIL e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial"
-FAIL e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
+PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-columns
+PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-flow
+PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-auto-rows
 PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-template-areas
 PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-template-columns
 PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should set grid-template-rows
 PASS e.style['grid'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should not set unrelated longhands
-FAIL e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "row" but got "initial"
-FAIL e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
+PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-columns
+PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-flow
+PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-rows
 PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-areas
 PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-columns
 PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-rows
@@ -43,16 +43,16 @@
 PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should not set unrelated longhands
 PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-columns
 PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-flow
-FAIL e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-areas assert_equals: grid-template-areas should be canonical expected "none" but got "initial"
-FAIL e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-columns assert_equals: grid-template-columns should be canonical expected "none" but got "initial"
+PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-rows
+PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-areas
+PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-columns
 PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-template-rows
 PASS e.style['grid'] = "10px / auto-flow dense 20px" should not set unrelated longhands
-FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-columns assert_equals: grid-auto-columns should be canonical expected "auto" but got "initial"
-FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-flow assert_equals: grid-auto-flow should be canonical expected "dense" but got "row dense"
+PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-columns
+PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-flow
 PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-auto-rows
-FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-areas assert_equals: grid-template-areas should be canonical expected "none" but got "initial"
+PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-areas
 PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-columns
-FAIL e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-rows assert_equals: grid-template-rows should be canonical expected "none" but got "initial"
+PASS e.style['grid'] = "auto-flow dense 30px / 40px" should set grid-template-rows
 PASS e.style['grid'] = "auto-flow dense 30px / 40px" should not set unrelated longhands
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt (288543 => 288544)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt	2022-01-25 09:57:44 UTC (rev 288544)
@@ -1,39 +1,39 @@
 
-FAIL e.style['grid'] = "none" should set the property value assert_equals: serialization should be canonical expected "none" but got "none / none / none"
-FAIL e.style['grid'] = "none / none" should set the property value assert_equals: serialization should be canonical expected "none" but got "none / none / none"
-FAIL e.style['grid'] = "auto / auto" should set the property value assert_equals: serialization should be canonical expected "auto / auto" but got "auto / auto / none"
-FAIL e.style['grid'] = "none / [a] 0px" should set the property value assert_equals: serialization should be canonical expected "none / [a] 0px" but got "none / [a] 0px / none"
-FAIL e.style['grid'] = "none / [] 0px" should set the property value assert_equals: serialization should be canonical expected "none / 0px" but got "none / 0px / none"
-FAIL e.style['grid'] = "[a] 10px / auto" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / auto" but got "[a] 10px / auto / none"
-FAIL e.style['grid'] = "[a] 10px / none" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / none" but got "[a] 10px / none / none"
-FAIL e.style['grid'] = "[] 10px [] / [] auto []" should set the property value assert_equals: serialization should be canonical expected "10px / auto" but got "10px / auto / none"
-FAIL e.style['grid'] = "[a] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px / none / \"a\""
-FAIL e.style['grid'] = "[a] \"a\" 10px []" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px / none / \"a\""
-FAIL e.style['grid'] = "\"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px / none / \"a\""
-FAIL e.style['grid'] = "[] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px / none / \"a\""
-FAIL e.style['grid'] = "[a] \"a\" 10px [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px [a]" but got "[a] 10px [a] / none / \"a\""
-FAIL e.style['grid'] = "\"a\"" should set the property value assert_equals: serialization should be canonical expected "\"a\"" but got "auto / none / \"a\""
-FAIL e.style['grid'] = "\"a\" auto" should set the property value assert_equals: serialization should be canonical expected "\"a\"" but got "auto / none / \"a\""
-FAIL e.style['grid'] = "\"a\" / 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 10px" but got "auto / 10px / \"a\""
-FAIL e.style['grid'] = "\"a\" / 20%" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 20%" but got "auto / 20% / \"a\""
-FAIL e.style['grid'] = "\"a\" / 5fr" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 5fr" but got "auto / 5fr / \"a\""
-FAIL e.style['grid'] = "[a] \"a\"" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\"" but got "[a] auto / none / \"a\""
-FAIL e.style['grid'] = "[a] \"a\" [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" [a]" but got "[a] auto [a] / none / \"a\""
-FAIL e.style['grid'] = "[] \"a\"" should set the property value assert_equals: serialization should be canonical expected "\"a\"" but got "auto / none / \"a\""
-FAIL e.style['grid'] = "\"a\" [] [] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"b\"" but got "auto auto / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"b\"" but got "auto auto / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] [b] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a b] \"b\"" but got "auto [a b] auto / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\"" but got "auto [a] auto / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" / 0" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 0px" but got "auto / 0px / \"a\""
-FAIL e.style['grid'] = "\"a\" 10px / 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px / 10px" but got "10px / 10px / \"a\""
-FAIL e.style['grid'] = "\"a\" [a] \"b\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" 10px" but got "auto [a] 10px / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] \"b\" 10px [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" 10px [a]" but got "auto [a] 10px [a] / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] [a] \"b\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a a] \"b\" 10px" but got "auto [a a] 10px / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] [] \"b\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" 10px" but got "auto [a] 10px / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" 10px [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px [a] \"b\" [a]" but got "10px [a] auto [a] / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" [a]" but got "auto [a] auto [a] / none / \"a\" \"b\""
-FAIL e.style['grid'] = "[a] \"a\" [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" [a] \"b\" [a]" but got "[a] auto [a] auto [a] / none / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" \"a\" [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"a\" [a] \"b\" [a]" but got "auto auto [a] auto [a] / none / \"a\" \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" [a] \"b\" [a] / 0" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" [a] / 0px" but got "auto [a] auto [a] / 0px / \"a\" \"b\""
-FAIL e.style['grid'] = "\"a\" \"a\" [a] [a] \"b\" / auto" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"a\" [a a] \"b\" / auto" but got "auto auto [a a] auto / auto / \"a\" \"a\" \"b\""
+FAIL e.style['grid'] = "none" should set the property value assert_equals: serialization should be canonical expected "none" but got "none / none / none / row / auto / auto"
+FAIL e.style['grid'] = "none / none" should set the property value assert_equals: serialization should be canonical expected "none" but got "none / none / none / row / auto / auto"
+FAIL e.style['grid'] = "auto / auto" should set the property value assert_equals: serialization should be canonical expected "auto / auto" but got "auto / auto / none / row / auto / auto"
+FAIL e.style['grid'] = "none / [a] 0px" should set the property value assert_equals: serialization should be canonical expected "none / [a] 0px" but got "none / [a] 0px / none / row / auto / auto"
+FAIL e.style['grid'] = "none / [] 0px" should set the property value assert_equals: serialization should be canonical expected "none / 0px" but got "none / 0px / none / row / auto / auto"
+FAIL e.style['grid'] = "[a] 10px / auto" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / auto" but got "[a] 10px / auto / none / row / auto / auto"
+FAIL e.style['grid'] = "[a] 10px / none" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / none" but got "[a] 10px / none / none / row / auto / auto"
+FAIL e.style['grid'] = "[] 10px [] / [] auto []" should set the property value assert_equals: serialization should be canonical expected "10px / auto" but got "10px / auto / none / row / auto / auto"
+FAIL e.style['grid'] = "[a] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "[a] \"a\" 10px []" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "[] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "[a] \"a\" 10px [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px [a]" but got "[a] 10px [a] / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\"" should set the property value assert_equals: serialization should be canonical expected "\"a\"" but got "auto / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" auto" should set the property value assert_equals: serialization should be canonical expected "\"a\"" but got "auto / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" / 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 10px" but got "auto / 10px / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" / 20%" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 20%" but got "auto / 20% / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" / 5fr" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 5fr" but got "auto / 5fr / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "[a] \"a\"" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\"" but got "[a] auto / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "[a] \"a\" [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" [a]" but got "[a] auto [a] / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "[] \"a\"" should set the property value assert_equals: serialization should be canonical expected "\"a\"" but got "auto / none / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [] [] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"b\"" but got "auto auto / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"b\"" but got "auto auto / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] [b] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a b] \"b\"" but got "auto [a b] auto / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] \"b\"" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\"" but got "auto [a] auto / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" / 0" should set the property value assert_equals: serialization should be canonical expected "\"a\" / 0px" but got "auto / 0px / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" 10px / 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px / 10px" but got "10px / 10px / \"a\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] \"b\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" 10px" but got "auto [a] 10px / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] \"b\" 10px [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" 10px [a]" but got "auto [a] 10px [a] / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] [a] \"b\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a a] \"b\" 10px" but got "auto [a a] 10px / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] [] \"b\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" 10px" but got "auto [a] 10px / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" 10px [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px [a] \"b\" [a]" but got "10px [a] auto [a] / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" [a]" but got "auto [a] auto [a] / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "[a] \"a\" [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" [a] \"b\" [a]" but got "[a] auto [a] auto [a] / none / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" \"a\" [a] \"b\" [a]" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"a\" [a] \"b\" [a]" but got "auto auto [a] auto [a] / none / \"a\" \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" [a] \"b\" [a] / 0" should set the property value assert_equals: serialization should be canonical expected "\"a\" [a] \"b\" [a] / 0px" but got "auto [a] auto [a] / 0px / \"a\" \"b\" / row / auto / auto"
+FAIL e.style['grid'] = "\"a\" \"a\" [a] [a] \"b\" / auto" should set the property value assert_equals: serialization should be canonical expected "\"a\" \"a\" [a a] \"b\" / auto" but got "auto auto [a a] auto / auto / \"a\" \"a\" \"b\" / row / auto / auto"
 

Modified: trunk/Source/WebCore/ChangeLog (288543 => 288544)


--- trunk/Source/WebCore/ChangeLog	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/Source/WebCore/ChangeLog	2022-01-25 09:57:44 UTC (rev 288544)
@@ -1,3 +1,31 @@
+2022-01-25  Ziran Sun  <z...@igalia.com>
+
+        [css-grid] Fix grid shorthand expansion of initial values
+        https://bugs.webkit.org/show_bug.cgi?id=234430
+
+        Reviewed by Sergio Villar Senin.
+
+        This CL is to add the InitialValue support when parsing the grid shorthand for 6 grid properties
+        including grid-auto-columns, grid-auto-flow, grid-auto-rows, grid-template-areas, 
+        grid-template-columns and grid-template-rows. The original code only adds a CSSInitial.
+
+        This is an import of chromium change at
+        https://chromium-review.googlesource.com/c/chromium/src/+/3299364
+
+        Apart from fixing wpt test imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand.html,
+        The CL also updates the expectation file for test
+        imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid.html. This test fails before
+        this CL and need to be investigated as a seperated issue. Related bugs have been raised at -
+        https://bugs.chromium.org/p/chromium/issues/detail?id=1028283 &
+        https://bugs.webkit.org/show_bug.cgi?id=204611        
+        
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeImplicitGridAutoFlow):
+        (WebCore::CSSPropertyParser::consumeGridShorthand):
+        * style/StyleBuilderConverter.h:
+        (WebCore::Style::BuilderConverter::convertGridTrackSizeList):
+        (WebCore::Style::BuilderConverter::convertGridAutoFlow):
+
 2022-01-24  Youenn Fablet  <you...@apple.com>
 
         A sandboxed document should not reuse its service worker client ID

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (288543 => 288544)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-25 09:57:44 UTC (rev 288544)
@@ -5913,23 +5913,23 @@
     // [ auto-flow && dense? ]
     if (range.atEnd())
         return nullptr;
-    auto list = CSSValueList::createSpaceSeparated();
-    list->append(WTFMove(flowDirection));
+    RefPtr<CSSValue> denseIdent;
     if (range.peek().id() == CSSValueAutoFlow) {
         range.consumeIncludingWhitespace();
-        RefPtr<CSSValue> denseIdent = consumeIdent<CSSValueDense>(range);
-        if (denseIdent)
-            list->append(denseIdent.releaseNonNull());
+        denseIdent = consumeIdent<CSSValueDense>(range);
     } else {
         // Dense case
         if (range.peek().id() != CSSValueDense)
             return nullptr;
-        range.consumeIncludingWhitespace();
-        if (range.atEnd() || range.peek().id() != CSSValueAutoFlow)
+        denseIdent = consumeIdent<CSSValueDense>(range);
+        if (!denseIdent || !consumeIdent<CSSValueAutoFlow>(range))
             return nullptr;
-        range.consumeIncludingWhitespace();
-        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueDense));
     }
+    auto list = CSSValueList::createSpaceSeparated();
+    if (flowDirection->valueID() == CSSValueColumn || !denseIdent)
+        list->append(WTFMove(flowDirection));
+    if (denseIdent)
+        list->append(denseIdent.releaseNonNull());
     
     return list;
 }
@@ -5944,9 +5944,10 @@
     if (consumeGridTemplateShorthand(CSSPropertyGrid, important)) {
         // It can only be specified the explicit or the implicit grid properties in a single grid declaration.
         // The sub-properties not specified are set to their initial value, as normal for shorthands.
-        addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, CSSValuePool::singleton().createImplicitInitialValue(), important);
-        addProperty(CSSPropertyGridAutoColumns, CSSPropertyGrid, CSSValuePool::singleton().createImplicitInitialValue(), important);
-        addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, CSSValuePool::singleton().createImplicitInitialValue(), important);
+        addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, CSSValuePool::singleton().createIdentifierValue(CSSValueRow), important);
+        addProperty(CSSPropertyGridAutoColumns, CSSPropertyGrid, CSSValuePool::singleton().createIdentifierValue(CSSValueAuto), important);
+        addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, CSSValuePool::singleton().createIdentifierValue(CSSValueAuto), important);
+
         return true;
     }
 
@@ -5964,7 +5965,7 @@
         if (!gridAutoFlow || m_range.atEnd())
             return false;
         if (consumeSlashIncludingWhitespace(m_range))
-            autoRowsValue = CSSValuePool::singleton().createImplicitInitialValue();
+            autoRowsValue = CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
         else {
             autoRowsValue = consumeGridTrackList(m_range, m_context.mode, GridAuto);
             if (!autoRowsValue)
@@ -5977,8 +5978,8 @@
         templateColumns = consumeGridTemplatesRowsOrColumns(m_range, m_context.mode);
         if (!templateColumns)
             return false;
-        templateRows = CSSValuePool::singleton().createImplicitInitialValue();
-        autoColumnsValue = CSSValuePool::singleton().createImplicitInitialValue();
+        templateRows = CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+        autoColumnsValue = CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
     } else {
         // 3- <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>?
         templateRows = consumeGridTemplatesRowsOrColumns(m_range, m_context.mode);
@@ -5990,14 +5991,14 @@
         if (!gridAutoFlow)
             return false;
         if (m_range.atEnd())
-            autoColumnsValue = CSSValuePool::singleton().createImplicitInitialValue();
+            autoColumnsValue = CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
         else {
             autoColumnsValue = consumeGridTrackList(m_range, m_context.mode, GridAuto);
             if (!autoColumnsValue)
                 return false;
         }
-        templateColumns = CSSValuePool::singleton().createImplicitInitialValue();
-        autoRowsValue = CSSValuePool::singleton().createImplicitInitialValue();
+        templateColumns = CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
+        autoRowsValue = CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
     }
     
     if (!m_range.atEnd())
@@ -6007,7 +6008,7 @@
     // The sub-properties not specified are set to their initial value, as normal for shorthands.
     addProperty(CSSPropertyGridTemplateColumns, CSSPropertyGrid, templateColumns.releaseNonNull(), important);
     addProperty(CSSPropertyGridTemplateRows, CSSPropertyGrid, templateRows.releaseNonNull(), important);
-    addProperty(CSSPropertyGridTemplateAreas, CSSPropertyGrid, CSSValuePool::singleton().createImplicitInitialValue(), important);
+    addProperty(CSSPropertyGridTemplateAreas, CSSPropertyGrid, CSSValuePool::singleton().createIdentifierValue(CSSValueNone), important);
     addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, gridAutoFlow.releaseNonNull(), important);
     addProperty(CSSPropertyGridAutoColumns, CSSPropertyGrid, autoColumnsValue.releaseNonNull(), important);
     addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, autoRowsValue.releaseNonNull(), important);

Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (288543 => 288544)


--- trunk/Source/WebCore/style/StyleBuilderConverter.h	2022-01-25 07:13:34 UTC (rev 288543)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h	2022-01-25 09:57:44 UTC (rev 288544)
@@ -1129,6 +1129,11 @@
 
 inline Vector<GridTrackSize> BuilderConverter::convertGridTrackSizeList(BuilderState& builderState, const CSSValue& value)
 {
+    if (is<CSSPrimitiveValue>(value)) {
+        ASSERT(downcast<CSSPrimitiveValue>(value).isValueID() && downcast<CSSPrimitiveValue>(value).valueID() == CSSValueAuto);
+        return RenderStyle::initialGridAutoRows();
+    }
+
     ASSERT(value.isValueList());
     auto& valueList = downcast<CSSValueList>(value);
     Vector<GridTrackSize> trackSizes;
@@ -1157,13 +1162,18 @@
 
 inline GridAutoFlow BuilderConverter::convertGridAutoFlow(BuilderState&, const CSSValue& value)
 {
-    auto& list = downcast<CSSValueList>(value);
-    if (!list.length())
-        return RenderStyle::initialGridAutoFlow();
+    ASSERT(!is<CSSPrimitiveValue>(value) || downcast<CSSPrimitiveValue>(value).isValueID());
 
-    auto& first = downcast<CSSPrimitiveValue>(*list.item(0));
-    auto* second = downcast<CSSPrimitiveValue>(list.item(1));
+    bool isValuelist = is<CSSValueList>(value);
+    if (isValuelist) {
+        auto& list = downcast<CSSValueList>(value);
+        if (!list.length())
+            return RenderStyle::initialGridAutoFlow();
+    }
 
+    auto& first = downcast<CSSPrimitiveValue>(isValuelist ? *(downcast<CSSValueList>(value).item(0)) : value);
+    auto* second = downcast<CSSPrimitiveValue>(isValuelist && downcast<CSSValueList>(value).length() == 2 ? downcast<CSSValueList>(value).item(1) : nullptr);
+
     GridAutoFlow autoFlow;
     switch (first.valueID()) {
     case CSSValueRow:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to