Title: [289722] trunk
Revision
289722
Author
[email protected]
Date
2022-02-13 17:52:40 -0800 (Sun, 13 Feb 2022)

Log Message

Add support for parsing 'subgrid' in grid-template-columns/row
https://bugs.webkit.org/show_bug.cgi?id=236054

Patch by Matt Woodrow <[email protected]> on 2022-02-13
Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Imported lastest subgrid tests.

* web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt:
* web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid.html:
* web-platform-tests/css/css-grid/subgrid/grid-template-invalid-expected.txt: Added.
* web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html:
* web-platform-tests/css/css-grid/subgrid/grid-template-valid-expected.txt: Added.
* web-platform-tests/css/css-grid/subgrid/grid-template-valid.html:

Source/WebCore:

Adds support for parsing the 'subgrid' keyword followed by a list of line names for
grid-template-columns/rows.
Adds a new CSSSubgridValue wrapper around CSSValueList to represent this.
Also adds support for converting this into style data in StyleBuilderConverter, and serializing
the specified value for computed value (used when the element specified subgrid but doesn't
have an appropriate grid parent).

Tests: imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html
       imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid.html

* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::OrderedNamedLinesCollector::namedGridLineCount const):
(WebCore::addValuesForNamedGridLinesAtIndex):
(WebCore::populateSubgridLineNameList):
(WebCore::valueForGridTrackList):
* css/CSSSubgridValue.cpp: Added.
(WebCore::CSSSubgridValue::customCSSText const):
(WebCore::CSSSubgridValue::CSSSubgridValue):
* css/CSSSubgridValue.h: Added.
* css/CSSValue.cpp:
(WebCore::CSSValue::equals const):
(WebCore::CSSValue::cssText const):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isSubgridValue const):
* css/CSSValueKeywords.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* css/parser/CSSParserContext.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeGridLineNames):
(WebCore::consumeSubgridNameRepeatFunction):
(WebCore::consumeGridTrackList):
(WebCore::consumeGridTemplatesRowsOrColumns):
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns):
(WebCore::CSSPropertyParser::consumeGridTemplateShorthand):
(WebCore::CSSPropertyParser::consumeGridShorthand):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::gridSubgridRows const):
(WebCore::RenderStyle::gridSubgridColumns const):
(WebCore::RenderStyle::setGridSubgridRows):
(WebCore::RenderStyle::setGridSubgridColumns):
* rendering/style/StyleGridData.cpp:
(WebCore::StyleGridData::StyleGridData):
* rendering/style/StyleGridData.h:
(WebCore::StyleGridData::operator== const):
* style/StyleBuilderConverter.h:
(WebCore::Style::createGridLineNamesList):
(WebCore::Style::BuilderConverter::createGridTrackList):
* style/StyleBuilderCustom.h:

Source/WTF:

Adds a new experimental preference for subgrid support, disabled by default.

* Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

Updated TestExpectations to list all the subgrid tests individually, now that we pass a few.

* TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt: Removed.
* platform/wpe/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt: Removed.

Modified Paths

Added Paths

Removed Paths

  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-grid/subgrid/
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-grid/subgrid/

Diff

Modified: trunk/LayoutTests/ChangeLog (289721 => 289722)


--- trunk/LayoutTests/ChangeLog	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/ChangeLog	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1,3 +1,16 @@
+2022-02-13  Matt Woodrow  <[email protected]>
+
+        Add support for parsing 'subgrid' in grid-template-columns/row
+        https://bugs.webkit.org/show_bug.cgi?id=236054
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Updated TestExpectations to list all the subgrid tests individually, now that we pass a few.
+
+        * TestExpectations:
+        * platform/gtk/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt: Removed.
+        * platform/wpe/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt: Removed.
+
 2022-02-13  Brady Eidson  <[email protected]>
 
         Implement ServiceWorkerRegistration.showNotification()

Modified: trunk/LayoutTests/TestExpectations (289721 => 289722)


--- trunk/LayoutTests/TestExpectations	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/TestExpectations	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1401,6 +1401,54 @@
 imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-subgrid-001.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-subgrid-002.html [ ImageOnlyFailure ]
 
+imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/baseline-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-004.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-005.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-006.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-007.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-008.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-009.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-larger-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-larger-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-normal-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-smaller-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/item-percentage-height-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-004.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-005.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-006.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-007.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/line-names-008.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/orthogonal-writing-mode-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/orthogonal-writing-mode-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/orthogonal-writing-mode-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/orthogonal-writing-mode-004.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/parent-repeat-auto-fit-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/parent-repeat-auto-fit-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-004.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-005.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-006.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-007.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/repeat-auto-fill-008.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-item-block-size-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-mbp-overflow-001.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-mbp-overflow-002.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-mbp-overflow-003.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-mbp-overflow-004.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-subgridded-axis-auto-repeater-crash-001.html [ Crash ]
+imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-subgridded-axis-auto-repeater-crash-002.html [ Crash ]
+
 webkit.org/b/149890 fast/css-grid-layout/grid-shorthands-style-format.html [ Failure ]
 webkit.org/b/191508 fast/css-grid-layout/crash-large-positions.html [ Skip ]
 
@@ -4239,7 +4287,6 @@
 
 # CSS Masonry Layout not supported.
 imported/w3c/web-platform-tests/css/css-grid/masonry.tentative [ Skip ]
-webkit.org/b/202115 imported/w3c/web-platform-tests/css/css-grid/subgrid [ Skip ]
 webkit.org/b/204580 imported/w3c/web-platform-tests/css/css-grid/animation/grid-template-columns-001.html [ ImageOnlyFailure ]
 webkit.org/b/204580 imported/w3c/web-platform-tests/css/css-grid/animation/grid-template-rows-001.html [ ImageOnlyFailure ]
 webkit.org/b/209460 imported/w3c/web-platform-tests/css/css-grid/abspos/descendant-static-position-001.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289721 => 289722)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1,3 +1,19 @@
+2022-02-13  Matt Woodrow  <[email protected]>
+
+        Add support for parsing 'subgrid' in grid-template-columns/row
+        https://bugs.webkit.org/show_bug.cgi?id=236054
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Imported lastest subgrid tests.
+
+        * web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt:
+        * web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid.html:
+        * web-platform-tests/css/css-grid/subgrid/grid-template-invalid-expected.txt: Added.
+        * web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html:
+        * web-platform-tests/css/css-grid/subgrid/grid-template-valid-expected.txt: Added.
+        * web-platform-tests/css/css-grid/subgrid/grid-template-valid.html:
+
 2022-02-13  Brady Eidson  <[email protected]>
 
         Implement ServiceWorkerRegistration.showNotification()

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt (289721 => 289722)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid-expected.txt	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1,31 +1,34 @@
 
-FAIL Property grid-template-columns value 'subgrid [a]' computes to 'subgrid [a]' assert_true: 'subgrid [a]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b]' computes to 'subgrid [a] [b]' assert_true: 'subgrid [a] [b]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] [b] [c]' computes to 'subgrid [a] [b] [b] [c]' assert_true: 'subgrid [a] [b] [b] [c]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b c d] [e f] [e f] [g]' computes to 'subgrid [a] [b c d] [e f] [e f] [g]' assert_true: 'subgrid [a] [b c d] [e f] [e f] [g]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a b c] [d] [e f]' computes to 'subgrid [a b c] [d] [e f]' assert_true: 'subgrid [a b c] [d] [e f]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c])' computes to 'subgrid repeat(auto-fill, [c])' assert_true: 'subgrid repeat(auto-fill, [c])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c]) [g] [h i]' computes to 'subgrid repeat(auto-fill, [c]) [g] [h i]' assert_true: 'subgrid repeat(auto-fill, [c]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c]) [g] [h i]' computes to 'subgrid [a] repeat(auto-fill, [c]) [g] [h i]' assert_true: 'subgrid [a] repeat(auto-fill, [c]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c]) [g]' computes to 'subgrid [a b] repeat(auto-fill, [c]) [g]' assert_true: 'subgrid [a b] repeat(auto-fill, [c]) [g]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c]) [g h]' computes to 'subgrid [a] [b] repeat(auto-fill, [c]) [g h]' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c]) [g h]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c])' computes to 'subgrid [a] [b] repeat(auto-fill, [c])' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c d])' computes to 'subgrid repeat(auto-fill, [c d])' assert_true: 'subgrid repeat(auto-fill, [c d])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c d]) [g] [h i]' computes to 'subgrid repeat(auto-fill, [c d]) [g] [h i]' assert_true: 'subgrid repeat(auto-fill, [c d]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c d]) [g] [h i]' computes to 'subgrid [a] repeat(auto-fill, [c d]) [g] [h i]' assert_true: 'subgrid [a] repeat(auto-fill, [c d]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c d]) [g]' computes to 'subgrid [a b] repeat(auto-fill, [c d]) [g]' assert_true: 'subgrid [a b] repeat(auto-fill, [c d]) [g]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c d]) [g h]' computes to 'subgrid [a] [b] repeat(auto-fill, [c d]) [g h]' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c d]) [g h]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c d])' computes to 'subgrid [a] [b] repeat(auto-fill, [c d])' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c d])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d])' computes to 'subgrid repeat(auto-fill, [c] [d])' assert_true: 'subgrid repeat(auto-fill, [c] [d])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d]) [g] [h i]' computes to 'subgrid repeat(auto-fill, [c] [d]) [g] [h i]' assert_true: 'subgrid repeat(auto-fill, [c] [d]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c] [d]) [g] [h i]' computes to 'subgrid [a] repeat(auto-fill, [c] [d]) [g] [h i]' assert_true: 'subgrid [a] repeat(auto-fill, [c] [d]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c] [d]) [g]' computes to 'subgrid [a b] repeat(auto-fill, [c] [d]) [g]' assert_true: 'subgrid [a b] repeat(auto-fill, [c] [d]) [g]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d]) [g h]' computes to 'subgrid [a] [b] repeat(auto-fill, [c] [d]) [g h]' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c] [d]) [g h]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d])' computes to 'subgrid [a] [b] repeat(auto-fill, [c] [d])' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c] [d])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d e])' computes to 'subgrid repeat(auto-fill, [c] [d e])' assert_true: 'subgrid repeat(auto-fill, [c] [d e])' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d e]) [g] [h i]' computes to 'subgrid repeat(auto-fill, [c] [d e]) [g] [h i]' assert_true: 'subgrid repeat(auto-fill, [c] [d e]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c] [d e]) [g] [h i]' computes to 'subgrid [a] repeat(auto-fill, [c] [d e]) [g] [h i]' assert_true: 'subgrid [a] repeat(auto-fill, [c] [d e]) [g] [h i]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c] [d e]) [g]' computes to 'subgrid [a b] repeat(auto-fill, [c] [d e]) [g]' assert_true: 'subgrid [a b] repeat(auto-fill, [c] [d e]) [g]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d e]) [g h]' computes to 'subgrid [a] [b] repeat(auto-fill, [c] [d e]) [g h]' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c] [d e]) [g h]' is a supported value for grid-template-columns. expected true got false
-FAIL Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d e])' computes to 'subgrid [a] [b] repeat(auto-fill, [c] [d e])' assert_true: 'subgrid [a] [b] repeat(auto-fill, [c] [d e])' is a supported value for grid-template-columns. expected true got false
+PASS Property grid-template-columns value 'subgrid []'
+PASS Property grid-template-columns value 'subgrid [a]'
+PASS Property grid-template-columns value 'subgrid [a] [b]'
+PASS Property grid-template-columns value 'subgrid [] [b]'
+PASS Property grid-template-columns value 'subgrid [a] [b] [b] [c]'
+PASS Property grid-template-columns value 'subgrid [a] [b c d] [e f] [e f] [g]'
+PASS Property grid-template-columns value 'subgrid [a b c] [d] [e f]'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c]) [g]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c]) [g h]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c d])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c d]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c d]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c d]) [g]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c d]) [g h]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c d])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c] [d]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c] [d]) [g]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d]) [g h]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d e])'
+PASS Property grid-template-columns value 'subgrid repeat(auto-fill, [c] [d e]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a] repeat(auto-fill, [c] [d e]) [g] [h i]'
+PASS Property grid-template-columns value 'subgrid [a b] repeat(auto-fill, [c] [d e]) [g]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d e]) [g h]'
+PASS Property grid-template-columns value 'subgrid [a] [b] repeat(auto-fill, [c] [d e])'
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid.html (289721 => 289722)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid.html	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-computed-nogrid.html	2022-02-14 01:52:40 UTC (rev 289722)
@@ -16,12 +16,15 @@
 <script src=""
 <div id="target"></div>
 <script>
+test_computed_value("grid-template-columns", "subgrid []");
 test_computed_value("grid-template-columns", "subgrid [a]");
 test_computed_value("grid-template-columns", "subgrid [a] [b]");
+test_computed_value("grid-template-columns", "subgrid [] [b]");
 test_computed_value("grid-template-columns", "subgrid [a] [b] [b] [c]");
 test_computed_value("grid-template-columns", "subgrid [a] [b c d] [e f] [e f] [g]");
 test_computed_value("grid-template-columns", "subgrid [a b c] [d] [e f]");
 test_computed_value("grid-template-columns", "subgrid repeat(auto-fill, [c])");
+test_computed_value("grid-template-columns", "subgrid repeat(auto-fill, [])");
 test_computed_value("grid-template-columns", "subgrid repeat(auto-fill, [c]) [g] [h i]");
 test_computed_value("grid-template-columns", "subgrid [a] repeat(auto-fill, [c]) [g] [h i]");
 test_computed_value("grid-template-columns", "subgrid [a b] repeat(auto-fill, [c]) [g]");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid-expected.txt (0 => 289722)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid-expected.txt	2022-02-14 01:52:40 UTC (rev 289722)
@@ -0,0 +1,22 @@
+
+PASS e.style['grid-template-rows'] = "subgrid subgrid" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid none" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid 1px" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] 1px" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(auto-fill, 1px)" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(auto-fill, line)" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(2, 1px)" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(2, line)" should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(2," should not set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(auto-fill, [a]) repeat(auto-fill, [b])" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid subgrid" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid none" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid 1px" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] 1px" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(auto-fill, 1px)" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(auto-fill, line)" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(2, 1px)" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(2, line)" should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(2," should not set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(auto-fill, [a]) repeat(auto-fill, [b])" should not set the property value
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html (289721 => 289722)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html	2022-02-14 01:52:40 UTC (rev 289722)
@@ -22,6 +22,7 @@
 test_invalid_value("grid-template-rows", 'subgrid repeat(2, 1px)');
 test_invalid_value("grid-template-rows", 'subgrid repeat(2, line)');
 test_invalid_value("grid-template-rows", 'subgrid repeat(2,');
+test_invalid_value("grid-template-rows", 'subgrid repeat(auto-fill, [a]) repeat(auto-fill, [b])');
 
 test_invalid_value("grid-template-columns", 'subgrid subgrid');
 test_invalid_value("grid-template-columns", 'subgrid none');
@@ -32,6 +33,7 @@
 test_invalid_value("grid-template-columns", 'subgrid repeat(2, 1px)');
 test_invalid_value("grid-template-columns", 'subgrid repeat(2, line)');
 test_invalid_value("grid-template-columns", 'subgrid repeat(2,');
+test_invalid_value("grid-template-columns", 'subgrid repeat(auto-fill, [a]) repeat(auto-fill, [b])');
 
 
 </script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid-expected.txt (0 => 289722)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid-expected.txt	2022-02-14 01:52:40 UTC (rev 289722)
@@ -0,0 +1,40 @@
+
+PASS e.style['grid-template-rows'] = "subgrid" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] [b]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] [b] [c]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid []" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] [b] [] [c]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [] [] [] [c]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [] [] [] []" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(auto-fill, [a])" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(auto-fill, [])" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] repeat(auto-fill, [b])" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] repeat(auto-fill, [b]) [c]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [] repeat(auto-fill, []) []" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(2, [a])" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid repeat(2, [a] [b])" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] repeat(2, [b])" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] repeat(2, [b]) [c]" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [] repeat(2, []) []" should set the property value
+PASS e.style['grid-template-rows'] = "subgrid [a] repeat(2, [b]) repeat(auto-fill, [c]) [d]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] [b]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] [b] [c]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid []" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] [b] [] [c]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [] [] [] [c]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [] [] [] []" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(auto-fill, [a])" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(auto-fill, [])" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] repeat(auto-fill, [b])" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] repeat(auto-fill, [b]) [c]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [] repeat(auto-fill, []) []" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(2, [a])" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid repeat(2, [a] [b])" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] repeat(2, [b])" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] repeat(2, [b]) [c]" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [] repeat(2, []) []" should set the property value
+PASS e.style['grid-template-columns'] = "subgrid [a] repeat(2, [b]) repeat(auto-fill, [c]) [d]" should set the property value
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid.html (289721 => 289722)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid.html	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid.html	2022-02-14 01:52:40 UTC (rev 289722)
@@ -22,6 +22,7 @@
 test_valid_value("grid-template-rows", 'subgrid [] [] [] [c]');
 test_valid_value("grid-template-rows", 'subgrid [] [] [] []');
 test_valid_value("grid-template-rows", 'subgrid repeat(auto-fill, [a])');
+test_valid_value("grid-template-rows", 'subgrid repeat(auto-fill, [])');
 test_valid_value("grid-template-rows", 'subgrid [a] repeat(auto-fill, [b])');
 test_valid_value("grid-template-rows", 'subgrid [a] repeat(auto-fill, [b]) [c]');
 test_valid_value("grid-template-rows", 'subgrid [] repeat(auto-fill, []) []');
@@ -41,6 +42,7 @@
 test_valid_value("grid-template-columns", 'subgrid [] [] [] [c]');
 test_valid_value("grid-template-columns", 'subgrid [] [] [] []');
 test_valid_value("grid-template-columns", 'subgrid repeat(auto-fill, [a])');
+test_valid_value("grid-template-columns", 'subgrid repeat(auto-fill, [])');
 test_valid_value("grid-template-columns", 'subgrid [a] repeat(auto-fill, [b])');
 test_valid_value("grid-template-columns", 'subgrid [a] repeat(auto-fill, [b]) [c]');
 test_valid_value("grid-template-columns", 'subgrid [] repeat(auto-fill, []) []');

Modified: trunk/Source/WTF/ChangeLog (289721 => 289722)


--- trunk/Source/WTF/ChangeLog	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WTF/ChangeLog	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1,3 +1,14 @@
+2022-02-13  Matt Woodrow  <[email protected]>
+
+        Add support for parsing 'subgrid' in grid-template-columns/row
+        https://bugs.webkit.org/show_bug.cgi?id=236054
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Adds a new experimental preference for subgrid support, disabled by default.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
 2022-02-13  Brady Eidson  <[email protected]>
 
         Implement ServiceWorkerRegistration.showNotification()

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (289721 => 289722)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1349,6 +1349,18 @@
       "PLATFORM(COCOA)" : true
       default: false
 
+SubgridEnabled:
+  type: bool
+  humanReadableName: "CSS subgrid support"
+  humanReadableDescription: "Enable CSS subgrid support"
+  defaultValue:
+    WebKitLegacy:
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 SyntheticEditingCommandsEnabled:
   type: bool
   humanReadableName: "Synthetic Editing Commands"

Modified: trunk/Source/WebCore/ChangeLog (289721 => 289722)


--- trunk/Source/WebCore/ChangeLog	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/ChangeLog	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1,3 +1,66 @@
+2022-02-13  Matt Woodrow  <[email protected]>
+
+        Add support for parsing 'subgrid' in grid-template-columns/row
+        https://bugs.webkit.org/show_bug.cgi?id=236054
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Adds support for parsing the 'subgrid' keyword followed by a list of line names for
+        grid-template-columns/rows.
+        Adds a new CSSSubgridValue wrapper around CSSValueList to represent this.
+        Also adds support for converting this into style data in StyleBuilderConverter, and serializing
+        the specified value for computed value (used when the element specified subgrid but doesn't
+        have an appropriate grid parent).
+
+        Tests: imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-invalid.html
+               imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-template-valid.html
+
+        * Headers.cmake:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::OrderedNamedLinesCollector::namedGridLineCount const):
+        (WebCore::addValuesForNamedGridLinesAtIndex):
+        (WebCore::populateSubgridLineNameList):
+        (WebCore::valueForGridTrackList):
+        * css/CSSSubgridValue.cpp: Added.
+        (WebCore::CSSSubgridValue::customCSSText const):
+        (WebCore::CSSSubgridValue::CSSSubgridValue):
+        * css/CSSSubgridValue.h: Added.
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::equals const):
+        (WebCore::CSSValue::cssText const):
+        (WebCore::CSSValue::destroy):
+        * css/CSSValue.h:
+        (WebCore::CSSValue::isSubgridValue const):
+        * css/CSSValueKeywords.in:
+        * css/parser/CSSParserContext.cpp:
+        (WebCore::operator==):
+        (WebCore::add):
+        * css/parser/CSSParserContext.h:
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeGridLineNames):
+        (WebCore::consumeSubgridNameRepeatFunction):
+        (WebCore::consumeGridTrackList):
+        (WebCore::consumeGridTemplatesRowsOrColumns):
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        (WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns):
+        (WebCore::CSSPropertyParser::consumeGridTemplateShorthand):
+        (WebCore::CSSPropertyParser::consumeGridShorthand):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::gridSubgridRows const):
+        (WebCore::RenderStyle::gridSubgridColumns const):
+        (WebCore::RenderStyle::setGridSubgridRows):
+        (WebCore::RenderStyle::setGridSubgridColumns):
+        * rendering/style/StyleGridData.cpp:
+        (WebCore::StyleGridData::StyleGridData):
+        * rendering/style/StyleGridData.h:
+        (WebCore::StyleGridData::operator== const):
+        * style/StyleBuilderConverter.h:
+        (WebCore::Style::createGridLineNamesList):
+        (WebCore::Style::BuilderConverter::createGridTrackList):
+        * style/StyleBuilderCustom.h:
+
 2022-02-13  Brady Eidson  <[email protected]>
 
         Implement ServiceWorkerRegistration.showNotification()

Modified: trunk/Source/WebCore/Headers.cmake (289721 => 289722)


--- trunk/Source/WebCore/Headers.cmake	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/Headers.cmake	2022-02-14 01:52:40 UTC (rev 289722)
@@ -546,6 +546,7 @@
     css/CSSStyleDeclaration.h
     css/CSSStyleRule.h
     css/CSSStyleSheet.h
+    css/CSSSubgridValue.h
     css/CSSToLengthConversionData.h
     css/CSSUnits.h
     css/CSSUnknownRule.h

Modified: trunk/Source/WebCore/Sources.txt (289721 => 289722)


--- trunk/Source/WebCore/Sources.txt	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/Sources.txt	2022-02-14 01:52:40 UTC (rev 289722)
@@ -768,6 +768,7 @@
 css/CSSStyleDeclaration.cpp
 css/CSSStyleRule.cpp
 css/CSSStyleSheet.cpp
+css/CSSSubgridValue.cpp
 css/CSSSupportsRule.cpp
 css/CSSTimingFunctionValue.cpp
 css/CSSToLengthConversionData.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (289721 => 289722)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-02-14 01:52:40 UTC (rev 289722)
@@ -4695,6 +4695,7 @@
 		D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */ = {isa = PBXBuildFile; fileRef = D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		D000ED2811C1B9CD00C47726 /* SubframeLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = D000ED2611C1B9CD00C47726 /* SubframeLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		D01A27AE10C9BFD800026A42 /* SpaceSplitString.h in Headers */ = {isa = PBXBuildFile; fileRef = D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		D026DB0A27AB719E0081B143 /* CSSSubgridValue.h in Headers */ = {isa = PBXBuildFile; fileRef = D026DB0827AB719D0081B143 /* CSSSubgridValue.h */; };
 		D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */; };
 		D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D06C0D8D0CFD11460065F43F /* RemoveFormatCommand.h */; };
 		D07DEABA0A36554A00CA30F8 /* InsertListCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D07DEAB80A36554A00CA30F8 /* InsertListCommand.h */; };
@@ -16453,6 +16454,8 @@
 		D000ED2611C1B9CD00C47726 /* SubframeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubframeLoader.h; sourceTree = "<group>"; };
 		D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpaceSplitString.cpp; sourceTree = "<group>"; };
 		D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceSplitString.h; sourceTree = "<group>"; };
+		D026DB0827AB719D0081B143 /* CSSSubgridValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSubgridValue.h; sourceTree = "<group>"; };
+		D026DB0B27AB71AF0081B143 /* CSSSubgridValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSSubgridValue.cpp; sourceTree = "<group>"; };
 		D036DD8D208FFC0C00F9F4B2 /* WebGLCompressedTextureASTC.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGLCompressedTextureASTC.idl; sourceTree = "<group>"; };
 		D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FormatBlockCommand.cpp; sourceTree = "<group>"; };
 		D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormatBlockCommand.h; sourceTree = "<group>"; };
@@ -31753,6 +31756,8 @@
 				A8EA80000A19516E00A8EF5F /* CSSStyleSheet.cpp */,
 				A8EA7FFF0A19516E00A8EF5F /* CSSStyleSheet.h */,
 				858C39100AA8FF0000B187A4 /* CSSStyleSheet.idl */,
+				D026DB0B27AB71AF0081B143 /* CSSSubgridValue.cpp */,
+				D026DB0827AB719D0081B143 /* CSSSubgridValue.h */,
 				FD677734195CAB200072E0D3 /* CSSSupportsRule.cpp */,
 				FC63BDB1167AABAC00F9380F /* CSSSupportsRule.h */,
 				FC63BDB2167AABAC00F9380F /* CSSSupportsRule.idl */,
@@ -34125,6 +34130,7 @@
 				A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */,
 				A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */,
 				4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */,
+				D026DB0A27AB719E0081B143 /* CSSSubgridValue.h in Headers */,
 				94DE5C921D83011D00164F2A /* CSSSupportsParser.h in Headers */,
 				FC54D05716A7673100575E4D /* CSSSupportsRule.h in Headers */,
 				BC80C9880CD294EE00A0B7B3 /* CSSTimingFunctionValue.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (289721 => 289722)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-02-14 01:52:40 UTC (rev 289722)
@@ -857,6 +857,8 @@
     bool isEmpty() const { return m_orderedNamedGridLines.isEmpty() && m_orderedNamedAutoRepeatGridLines.isEmpty(); }
     virtual void collectLineNamesForIndex(CSSGridLineNamesValue&, unsigned index) const;
 
+    virtual int namedGridLineCount() const { return m_orderedNamedGridLines.size(); }
+
 protected:
 
     enum NamedLinesType { NamedLines, AutoRepeatNamedLines };
@@ -874,6 +876,8 @@
     }
 
     void collectLineNamesForIndex(CSSGridLineNamesValue&, unsigned index) const override;
+
+    int namedGridLineCount() const override { return m_orderedNamedAutoRepeatGridLines.size(); }
 };
 
 class OrderedNamedLinesCollectorInGridLayout : public OrderedNamedLinesCollector {
@@ -951,7 +955,7 @@
     appendLines(lineNamesValue, autoRepeatIndexInFirstRepetition, AutoRepeatNamedLines);
 }
 
-static void addValuesForNamedGridLinesAtIndex(OrderedNamedLinesCollector& collector, unsigned i, CSSValueList& list)
+static void addValuesForNamedGridLinesAtIndex(OrderedNamedLinesCollector& collector, unsigned i, CSSValueList& list, bool renderEmpty = false)
 {
     if (collector.isEmpty())
         return;
@@ -958,7 +962,7 @@
 
     auto lineNames = CSSGridLineNamesValue::create();
     collector.collectLineNamesForIndex(lineNames.get(), i);
-    if (lineNames->length())
+    if (lineNames->length() || renderEmpty)
         list.append(WTFMove(lineNames));
 }
 
@@ -993,10 +997,22 @@
     populateGridTrackList<T>(list, collector, tracks, getTrackSize, 0, tracks.size(), offset);
 }
 
+static void populateSubgridLineNameList(CSSValueList& list, OrderedNamedLinesCollector& collector, int start, int end)
+{
+    for (int i = start; i < end; i++)
+        addValuesForNamedGridLinesAtIndex(collector, i, list, true);
+}
+
+static void populateSubgridLineNameList(CSSValueList& list, OrderedNamedLinesCollector& collector)
+{
+    populateSubgridLineNameList(list, collector, 0, collector.namedGridLineCount());
+}
+
 static Ref<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle& style)
 {
     bool isRowAxis = direction == ForColumns;
     bool isRenderGrid = is<RenderGrid>(renderer);
+    bool isSubgrid = isRowAxis ? style.gridSubgridColumns() : style.gridSubgridRows();
     auto& trackSizes = isRowAxis ? style.gridColumns() : style.gridRows();
     auto& autoRepeatTrackSizes = isRowAxis ? style.gridAutoRepeatColumns() : style.gridAutoRepeatRows();
 
@@ -1010,14 +1026,17 @@
         trackListIsEmpty = positions.size() == 1;
     }
 
-    if (trackListIsEmpty)
+    if (trackListIsEmpty && !isSubgrid)
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
 
     auto list = CSSValueList::createSpaceSeparated();
+    if (isSubgrid)
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSubgrid));
 
     // If the element is a grid container, the resolved value is the used value,
     // specifying track sizes in pixels and expanding the repeat() notation.
     if (isRenderGrid) {
+        // FIXME: We need to handle computed subgrid here.
         auto* grid = downcast<RenderGrid>(renderer);
         OrderedNamedLinesCollectorInGridLayout collector(style, isRowAxis, grid->autoRepeatCountForDirection(direction), autoRepeatTrackSizes.size());
         // Named grid line indices are relative to the explicit grid, but we are including all tracks.
@@ -1035,6 +1054,29 @@
         return specifiedValueForGridTrackSize(v, style);
     };
 
+    OrderedNamedLinesCollectorInsideRepeat repeatCollector(style, isRowAxis);
+    if (isSubgrid) {
+        if (!repeatCollector.namedGridLineCount()) {
+            populateSubgridLineNameList(list.get(), collector);
+            return list;
+        }
+
+        // Add the line names that precede the auto repeat().
+        int autoRepeatInsertionPoint = isRowAxis ? style.gridAutoRepeatColumnsInsertionPoint() : style.gridAutoRepeatRowsInsertionPoint();
+        autoRepeatInsertionPoint = std::clamp<int>(autoRepeatInsertionPoint, 0, collector.namedGridLineCount());
+        populateSubgridLineNameList(list.get(), collector, 0, autoRepeatInsertionPoint);
+
+        // Add a CSSGridAutoRepeatValue with the contents of the auto repeat().
+        ASSERT((isRowAxis ? style.gridAutoRepeatColumnsType() : style.gridAutoRepeatRowsType()) == AutoRepeatType::Fill);
+        auto repeatedValues = CSSGridAutoRepeatValue::create(CSSValueAutoFill);
+        populateSubgridLineNameList(repeatedValues.get(), repeatCollector);
+        list->append(repeatedValues.get());
+
+        // Add the line names that follow the auto repeat().
+        populateSubgridLineNameList(list.get(), collector, autoRepeatInsertionPoint, collector.namedGridLineCount());
+        return list;
+    }
+
     if (autoRepeatTrackSizes.isEmpty()) {
         // If there's no auto repeat(), just add all the line names and track sizes.
         populateGridTrackList(list.get(), collector, trackSizes, getTrackSize);
@@ -1042,13 +1084,14 @@
     }
 
     // Add the line names and track sizes that precede the auto repeat().
-    int autoRepeatInsertionPoint = std::clamp<int>(isRowAxis ? style.gridAutoRepeatColumnsInsertionPoint() : style.gridAutoRepeatRowsInsertionPoint(), 0, trackSizes.size());
+    int autoRepeatInsertionPoint = isRowAxis ? style.gridAutoRepeatColumnsInsertionPoint() : style.gridAutoRepeatRowsInsertionPoint();
+    autoRepeatInsertionPoint = std::clamp<int>(autoRepeatInsertionPoint, 0, trackSizes.size());
     populateGridTrackList(list.get(), collector, trackSizes, getTrackSize, 0, autoRepeatInsertionPoint);
 
     // Add a CSSGridAutoRepeatValue with the contents of the auto repeat().
     AutoRepeatType autoRepeatType = isRowAxis ? style.gridAutoRepeatColumnsType() : style.gridAutoRepeatRowsType();
     auto repeatedValues = CSSGridAutoRepeatValue::create(autoRepeatType == AutoRepeatType::Fill ? CSSValueAutoFill : CSSValueAutoFit);
-    OrderedNamedLinesCollectorInsideRepeat repeatCollector(style, isRowAxis);
+
     populateGridTrackList(repeatedValues.get(), repeatCollector, autoRepeatTrackSizes, getTrackSize);
     list->append(repeatedValues.get());
 

Added: trunk/Source/WebCore/css/CSSSubgridValue.cpp (0 => 289722)


--- trunk/Source/WebCore/css/CSSSubgridValue.cpp	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSSubgridValue.cpp	2022-02-14 01:52:40 UTC (rev 289722)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSSubgridValue.h"
+
+namespace WebCore {
+
+String CSSSubgridValue::customCSSText() const
+{
+    if (!length())
+        return "subgrid";
+    return "subgrid " + CSSValueList::customCSSText();
+}
+
+CSSSubgridValue::CSSSubgridValue()
+    : CSSValueList(SubgridClass, SpaceSeparator)
+{
+}
+
+}

Added: trunk/Source/WebCore/css/CSSSubgridValue.h (0 => 289722)


--- trunk/Source/WebCore/css/CSSSubgridValue.h	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSSubgridValue.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CSSValueList.h"
+
+namespace WebCore {
+
+class CSSSubgridValue final : public CSSValueList {
+public:
+    static Ref<CSSSubgridValue> create()
+    {
+        return adoptRef(*new CSSSubgridValue);
+    }
+
+    String customCSSText() const;
+
+private:
+    CSSSubgridValue();
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSSubgridValue, isSubgridValue());

Modified: trunk/Source/WebCore/css/CSSValue.cpp (289721 => 289722)


--- trunk/Source/WebCore/css/CSSValue.cpp	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/CSSValue.cpp	2022-02-14 01:52:40 UTC (rev 289722)
@@ -69,6 +69,7 @@
 #include "CSSGridIntegerRepeatValue.h"
 #include "CSSGridLineNamesValue.h"
 #include "CSSGridTemplateAreasValue.h"
+#include "CSSSubgridValue.h"
 
 #include "DeprecatedCSSOMPrimitiveValue.h"
 #include "DeprecatedCSSOMValueList.h"
@@ -184,6 +185,8 @@
             return compareCSSValues<CSSGridIntegerRepeatValue>(*this, other);
         case GridLineNamesClass:
             return compareCSSValues<CSSGridLineNamesValue>(*this, other);
+        case SubgridClass:
+            return compareCSSValues<CSSSubgridValue>(*this, other);
         case GridTemplateAreasClass:
             return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
         case PrimitiveClass:
@@ -287,6 +290,8 @@
         return downcast<CSSGridIntegerRepeatValue>(*this).customCSSText();
     case GridLineNamesClass:
         return downcast<CSSGridLineNamesValue>(*this).customCSSText();
+    case SubgridClass:
+        return downcast<CSSSubgridValue>(*this).customCSSText();
     case GridTemplateAreasClass:
         return downcast<CSSGridTemplateAreasValue>(*this).customCSSText();
     case PrimitiveClass:
@@ -410,6 +415,9 @@
     case GridLineNamesClass:
         delete downcast<CSSGridLineNamesValue>(this);
         return;
+    case SubgridClass:
+        delete downcast<CSSSubgridValue>(this);
+        return;
     case GridTemplateAreasClass:
         delete downcast<CSSGridTemplateAreasValue>(this);
         return;

Modified: trunk/Source/WebCore/css/CSSValue.h (289721 => 289722)


--- trunk/Source/WebCore/css/CSSValue.h	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/CSSValue.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -134,6 +134,7 @@
     bool isGridIntegerRepeatValue() const { return m_classType == GridIntegerRepeatClass; }
     bool isGridTemplateAreasValue() const { return m_classType == GridTemplateAreasClass; }
     bool isGridLineNamesValue() const { return m_classType == GridLineNamesClass; }
+    bool isSubgridValue() const { return m_classType == SubgridClass; }
     bool isUnicodeRangeValue() const { return m_classType == UnicodeRangeClass; }
 
     bool isVariableReferenceValue() const { return m_classType == VariableReferenceClass; }
@@ -224,6 +225,7 @@
         GridLineNamesClass,
         GridAutoRepeatClass,
         GridIntegerRepeatClass,
+        SubgridClass,
         // Do not append non-list class types here.
     };
 

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (289721 => 289722)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1420,6 +1420,7 @@
 
 // grid-template-{columns|rows}
 minmax
+subgrid
 
 // grid-auto-flow
 auto-flow

Modified: trunk/Source/WebCore/css/parser/CSSParserContext.cpp (289721 => 289722)


--- trunk/Source/WebCore/css/parser/CSSParserContext.cpp	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.cpp	2022-02-14 01:52:40 UTC (rev 289722)
@@ -112,6 +112,7 @@
     , gradientPremultipliedAlphaInterpolationEnabled { document.settings().cssGradientPremultipliedAlphaInterpolationEnabled() }
     , gradientInterpolationColorSpacesEnabled { document.settings().cssGradientInterpolationColorSpacesEnabled() }
     , inputSecurityEnabled { document.settings().cssInputSecurityEnabled() }
+    , subgridEnabled { document.settings().subgridEnabled() }
 #if ENABLE(ATTACHMENT_ELEMENT)
     , attachmentEnabled { RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() }
 #endif
@@ -165,6 +166,7 @@
 #if ENABLE(ATTACHMENT_ELEMENT)
         && a.attachmentEnabled == b.attachmentEnabled
 #endif
+        && a.subgridEnabled == b.subgridEnabled
     ;
 }
 
@@ -209,7 +211,8 @@
 #endif
         | context.accentColorEnabled                        << 29
         | context.inputSecurityEnabled                      << 30
-        | context.mode                                      << 31; // This is multiple bits, so keep it last.
+        | context.subgridEnabled                            << 31
+        | (unsigned long long)context.mode                  << 32; // This is multiple bits, so keep it last.
     add(hasher, context.baseURL, context.charset, bits);
 }
 

Modified: trunk/Source/WebCore/css/parser/CSSParserContext.h (289721 => 289722)


--- trunk/Source/WebCore/css/parser/CSSParserContext.h	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -89,6 +89,7 @@
     bool gradientPremultipliedAlphaInterpolationEnabled { false };
     bool gradientInterpolationColorSpacesEnabled { false };
     bool inputSecurityEnabled { false };
+    bool subgridEnabled { false };
 
     // RuntimeEnabledFeatures.
 #if ENABLE(ATTACHMENT_ELEMENT)

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (289721 => 289722)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-02-14 01:52:40 UTC (rev 289722)
@@ -59,6 +59,7 @@
 #include "CSSRayValue.h"
 #include "CSSReflectValue.h"
 #include "CSSShadowValue.h"
+#include "CSSSubgridValue.h"
 #include "CSSTimingFunctionValue.h"
 #include "CSSUnicodeRangeValue.h"
 #include "CSSVariableParser.h"
@@ -3605,7 +3606,7 @@
 }
 
 // Appends to the passed in CSSGridLineNamesValue if any, otherwise creates a new one. Returns nullptr if an empty list is consumed.
-static RefPtr<CSSGridLineNamesValue> consumeGridLineNames(CSSParserTokenRange& range, CSSGridLineNamesValue* lineNames = nullptr)
+static RefPtr<CSSGridLineNamesValue> consumeGridLineNames(CSSParserTokenRange& range, CSSGridLineNamesValue* lineNames = nullptr, bool allowEmpty = false)
 {
     CSSParserTokenRange rangeCopy = range;
     if (rangeCopy.consumeIncludingWhitespace().type() != LeftBracketToken)
@@ -3619,7 +3620,7 @@
     if (rangeCopy.consumeIncludingWhitespace().type() != RightBracketToken)
         return nullptr;
     range = rangeCopy;
-    return result->length() ? result : nullptr;
+    return (result->length() || allowEmpty) ? result : nullptr;
 }
 
 static bool consumeGridTrackRepeatFunction(CSSParserTokenRange& range, CSSParserMode cssParserMode, CSSValueList& list, bool& isAutoRepeat, bool& allTracksAreFixedSized)
@@ -3675,10 +3676,58 @@
     return true;
 }
 
+static bool consumeSubgridNameRepeatFunction(CSSParserTokenRange& range, CSSValueList& list, bool& isAutoRepeat)
+{
+    CSSParserTokenRange args = consumeFunction(range);
+    size_t repetitions = 1;
+    isAutoRepeat = identMatches<CSSValueAutoFill>(args.peek().id());
+    RefPtr<CSSValueList> repeatedValues;
+    if (isAutoRepeat)
+        repeatedValues = CSSGridAutoRepeatValue::create(args.consumeIncludingWhitespace().id());
+    else {
+        auto repetition = consumePositiveIntegerRaw(args);
+        if (!repetition)
+            return false;
+        repetitions = clampTo<size_t>(static_cast<size_t>(*repetition), 0, GridPosition::max());
+        repeatedValues = CSSGridIntegerRepeatValue::create(repetitions);
+    }
+    if (!consumeCommaIncludingWhitespace(args))
+        return false;
+
+    do {
+        auto lineNames = consumeGridLineNames(args, nullptr, true);
+        if (!lineNames)
+            return false;
+        repeatedValues->append(lineNames.releaseNonNull());
+    } while (!args.atEnd());
+
+    list.append(repeatedValues.releaseNonNull());
+    return true;
+}
+
 enum TrackListType { GridTemplate, GridTemplateNoRepeat, GridAuto };
 
-static RefPtr<CSSValue> consumeGridTrackList(CSSParserTokenRange& range, CSSParserMode cssParserMode, TrackListType trackListType)
+static RefPtr<CSSValue> consumeGridTrackList(CSSParserTokenRange& range, const CSSParserContext& context, TrackListType trackListType)
 {
+    bool seenAutoRepeat = false;
+    if (trackListType == GridTemplate && context.subgridEnabled && range.peek().id() == CSSValueSubgrid) {
+        consumeIdent(range);
+        auto values = CSSSubgridValue::create();
+        while (!range.atEnd() && range.peek().type() != DelimiterToken) {
+            if (range.peek().functionId() == CSSValueRepeat) {
+                bool isAutoRepeat;
+                if (!consumeSubgridNameRepeatFunction(range, values, isAutoRepeat))
+                    return nullptr;
+                if (isAutoRepeat && seenAutoRepeat)
+                    return nullptr;
+                seenAutoRepeat = seenAutoRepeat || isAutoRepeat;
+            } else if (auto value = consumeGridLineNames(range, nullptr, true))
+                values->append(value.releaseNonNull());
+            else
+                return nullptr;
+        }
+        return values;
+    }
     bool allowGridLineNames = trackListType != GridAuto;
     RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
     if (!allowGridLineNames && range.peek().type() == LeftBracketToken)
@@ -3688,7 +3737,6 @@
         values->append(lineNames.releaseNonNull());
     
     bool allowRepeat = trackListType == GridTemplate;
-    bool seenAutoRepeat = false;
     bool allTracksAreFixedSized = true;
     do {
         bool isAutoRepeat;
@@ -3695,12 +3743,12 @@
         if (range.peek().functionId() == CSSValueRepeat) {
             if (!allowRepeat)
                 return nullptr;
-            if (!consumeGridTrackRepeatFunction(range, cssParserMode, *values, isAutoRepeat, allTracksAreFixedSized))
+            if (!consumeGridTrackRepeatFunction(range, context.mode, *values, isAutoRepeat, allTracksAreFixedSized))
                 return nullptr;
             if (isAutoRepeat && seenAutoRepeat)
                 return nullptr;
             seenAutoRepeat = seenAutoRepeat || isAutoRepeat;
-        } else if (RefPtr<CSSValue> value = consumeGridTrackSize(range, cssParserMode)) {
+        } else if (RefPtr<CSSValue> value = consumeGridTrackSize(range, context.mode)) {
             if (allTracksAreFixedSized)
                 allTracksAreFixedSized = isGridTrackFixedSized(*value);
             values->append(value.releaseNonNull());
@@ -3718,11 +3766,11 @@
     return values;
 }
 
-static RefPtr<CSSValue> consumeGridTemplatesRowsOrColumns(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+static RefPtr<CSSValue> consumeGridTemplatesRowsOrColumns(CSSParserTokenRange& range, const CSSParserContext& context)
 {
     if (range.peek().id() == CSSValueNone)
         return consumeIdent(range);
-    return consumeGridTrackList(range, cssParserMode, GridTemplate);
+    return consumeGridTrackList(range, context, GridTemplate);
 }
 
 static RefPtr<CSSValue> consumeGridTemplateAreas(CSSParserTokenRange& range)
@@ -4629,10 +4677,10 @@
         return consumeGridLine(m_range);
     case CSSPropertyGridAutoColumns:
     case CSSPropertyGridAutoRows:
-        return consumeGridTrackList(m_range, m_context.mode, GridAuto);
+        return consumeGridTrackList(m_range, m_context, GridAuto);
     case CSSPropertyGridTemplateColumns:
     case CSSPropertyGridTemplateRows:
-        return consumeGridTemplatesRowsOrColumns(m_range, m_context.mode);
+        return consumeGridTemplatesRowsOrColumns(m_range, m_context);
     case CSSPropertyGridTemplateAreas:
         return consumeGridTemplateAreas(m_range);
     case CSSPropertyGridAutoFlow:
@@ -5879,7 +5927,7 @@
     if (!m_range.atEnd()) {
         if (!consumeSlashIncludingWhitespace(m_range))
             return false;
-        columnsValue = consumeGridTrackList(m_range, m_context.mode, GridTemplateNoRepeat);
+        columnsValue = consumeGridTrackList(m_range, m_context, GridTemplateNoRepeat);
         if (!columnsValue || !m_range.atEnd())
             return false;
     } else {
@@ -5906,12 +5954,12 @@
 
     // 2- <grid-template-rows> / <grid-template-columns>
     if (!rowsValue)
-        rowsValue = consumeGridTrackList(m_range, m_context.mode, GridTemplate);
+        rowsValue = consumeGridTrackList(m_range, m_context, GridTemplate);
 
     if (rowsValue) {
         if (!consumeSlashIncludingWhitespace(m_range))
             return false;
-        RefPtr<CSSValue> columnsValue = consumeGridTemplatesRowsOrColumns(m_range, m_context.mode);
+        RefPtr<CSSValue> columnsValue = consumeGridTemplatesRowsOrColumns(m_range, m_context);
         if (!columnsValue || !m_range.atEnd())
             return false;
 
@@ -5985,7 +6033,7 @@
         if (consumeSlashIncludingWhitespace(m_range))
             autoRowsValue = CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
         else {
-            autoRowsValue = consumeGridTrackList(m_range, m_context.mode, GridAuto);
+            autoRowsValue = consumeGridTrackList(m_range, m_context, GridAuto);
             if (!autoRowsValue)
                 return false;
             if (!consumeSlashIncludingWhitespace(m_range))
@@ -5993,7 +6041,7 @@
         }
         if (m_range.atEnd())
             return false;
-        templateColumns = consumeGridTemplatesRowsOrColumns(m_range, m_context.mode);
+        templateColumns = consumeGridTemplatesRowsOrColumns(m_range, m_context);
         if (!templateColumns)
             return false;
         templateRows = CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
@@ -6011,7 +6059,7 @@
         if (m_range.atEnd())
             autoColumnsValue = CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
         else {
-            autoColumnsValue = consumeGridTrackList(m_range, m_context.mode, GridAuto);
+            autoColumnsValue = consumeGridTrackList(m_range, m_context, GridAuto);
             if (!autoColumnsValue)
                 return false;
         }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (289721 => 289722)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -581,6 +581,8 @@
     size_t namedGridAreaRowCount() const { return m_rareNonInheritedData->grid->namedGridAreaRowCount; }
     size_t namedGridAreaColumnCount() const { return m_rareNonInheritedData->grid->namedGridAreaColumnCount; }
     GridAutoFlow gridAutoFlow() const { return static_cast<GridAutoFlow>(m_rareNonInheritedData->grid->gridAutoFlow); }
+    bool gridSubgridRows() const { return m_rareNonInheritedData->grid->subgridRows; }
+    bool gridSubgridColumns() const { return m_rareNonInheritedData->grid->subgridColumns; }
     bool isGridAutoFlowDirectionRow() const { return (m_rareNonInheritedData->grid->gridAutoFlow & InternalAutoFlowDirectionRow); }
     bool isGridAutoFlowDirectionColumn() const { return (m_rareNonInheritedData->grid->gridAutoFlow & InternalAutoFlowDirectionColumn); }
     bool isGridAutoFlowAlgorithmSparse() const { return (m_rareNonInheritedData->grid->gridAutoFlow & InternalAutoFlowAlgorithmSparse); }
@@ -1203,6 +1205,8 @@
     void setNamedGridAreaRowCount(size_t rowCount) { SET_NESTED_VAR(m_rareNonInheritedData, grid, namedGridAreaRowCount, rowCount); }
     void setNamedGridAreaColumnCount(size_t columnCount) { SET_NESTED_VAR(m_rareNonInheritedData, grid, namedGridAreaColumnCount, columnCount); }
     void setGridAutoFlow(GridAutoFlow flow) { SET_NESTED_VAR(m_rareNonInheritedData, grid, gridAutoFlow, flow); }
+    void setGridSubgridRows(bool subgrid) { SET_NESTED_VAR(m_rareNonInheritedData, grid, subgridRows, subgrid); }
+    void setGridSubgridColumns(bool subgrid) { SET_NESTED_VAR(m_rareNonInheritedData, grid, subgridColumns, subgrid); }
     void setGridItemColumnStart(const GridPosition& columnStartPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, gridColumnStart, columnStartPosition); }
     void setGridItemColumnEnd(const GridPosition& columnEndPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, gridColumnEnd, columnEndPosition); }
     void setGridItemRowStart(const GridPosition& rowStartPosition) { SET_NESTED_VAR(m_rareNonInheritedData, gridItem, gridRowStart, rowStartPosition); }

Modified: trunk/Source/WebCore/rendering/style/StyleGridData.cpp (289721 => 289722)


--- trunk/Source/WebCore/rendering/style/StyleGridData.cpp	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/rendering/style/StyleGridData.cpp	2022-02-14 01:52:40 UTC (rev 289722)
@@ -55,6 +55,8 @@
     , autoRepeatRowsInsertionPoint(RenderStyle::initialGridAutoRepeatInsertionPoint())
     , autoRepeatColumnsType(RenderStyle::initialGridAutoRepeatType())
     , autoRepeatRowsType(RenderStyle::initialGridAutoRepeatType())
+    , subgridRows(false)
+    , subgridColumns(false)
 {
 }
 
@@ -84,6 +86,8 @@
     , autoRepeatRowsInsertionPoint(o.autoRepeatRowsInsertionPoint)
     , autoRepeatColumnsType(o.autoRepeatColumnsType)
     , autoRepeatRowsType(o.autoRepeatRowsType)
+    , subgridRows(o.subgridRows)
+    , subgridColumns(o.subgridColumns)
 {
 }
 

Modified: trunk/Source/WebCore/rendering/style/StyleGridData.h (289721 => 289722)


--- trunk/Source/WebCore/rendering/style/StyleGridData.h	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/rendering/style/StyleGridData.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -57,7 +57,8 @@
             && orderedNamedGridRowLines == o.orderedNamedGridRowLines && orderedNamedGridColumnLines == o.orderedNamedGridColumnLines
             && gridAutoRepeatColumns == o.gridAutoRepeatColumns && gridAutoRepeatRows == o.gridAutoRepeatRows
             && autoRepeatColumnsInsertionPoint == o.autoRepeatColumnsInsertionPoint && autoRepeatRowsInsertionPoint == o.autoRepeatRowsInsertionPoint
-            && autoRepeatColumnsType == o.autoRepeatColumnsType && autoRepeatRowsType == o.autoRepeatRowsType;
+            && autoRepeatColumnsType == o.autoRepeatColumnsType && autoRepeatRowsType == o.autoRepeatRowsType && subgridRows == o.subgridRows
+            && subgridColumns == o.subgridColumns;
     }
 
     bool operator!=(const StyleGridData& o) const
@@ -102,6 +103,9 @@
     AutoRepeatType autoRepeatColumnsType;
     AutoRepeatType autoRepeatRowsType;
 
+    bool subgridRows;
+    bool subgridColumns;
+
 private:
     StyleGridData();
     StyleGridData(const StyleGridData&);

Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (289721 => 289722)


--- trunk/Source/WebCore/style/StyleBuilderConverter.h	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -44,6 +44,7 @@
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSRayValue.h"
 #include "CSSReflectValue.h"
+#include "CSSSubgridValue.h"
 #include "CalcExpressionLength.h"
 #include "CalcExpressionOperation.h"
 #include "FontPalette.h"
@@ -981,12 +982,13 @@
 static void createGridLineNamesList(const CSSValue& value, unsigned currentNamedGridLine, NamedGridLinesMap& namedGridLines, OrderedNamedGridLinesMap& orderedNamedGridLines)
 {
     ASSERT(value.isGridLineNamesValue());
+    auto orderedResult = orderedNamedGridLines.add(currentNamedGridLine, Vector<String>());
 
     for (auto& namedGridLineValue : downcast<CSSGridLineNamesValue>(value)) {
         String namedGridLine = downcast<CSSPrimitiveValue>(namedGridLineValue.get()).stringValue();
         auto result = namedGridLines.add(namedGridLine, Vector<unsigned>());
         result.iterator->value.append(currentNamedGridLine);
-        auto orderedResult = orderedNamedGridLines.add(currentNamedGridLine, Vector<String>());
+
         orderedResult.iterator->value.append(namedGridLine);
     }
 }
@@ -1004,6 +1006,7 @@
     OrderedNamedGridLinesMap m_autoRepeatOrderedNamedGridLines;
     unsigned m_autoRepeatInsertionPoint { RenderStyle::initialGridAutoRepeatInsertionPoint() };
     AutoRepeatType m_autoRepeatType { RenderStyle::initialGridAutoRepeatType() };
+    bool isSubgrid { false };
 };
 
 inline bool BuilderConverter::createGridTrackList(const CSSValue& value, TracksData& tracksData, BuilderState& builderState)
@@ -1017,18 +1020,26 @@
 
     unsigned currentNamedGridLine = 0;
     auto handleLineNameOrTrackSize = [&](const CSSValue& currentValue) {
-        if (is<CSSGridLineNamesValue>(currentValue))
+        if (is<CSSGridLineNamesValue>(currentValue)) {
             createGridLineNamesList(currentValue, currentNamedGridLine, tracksData.m_namedGridLines, tracksData.m_orderedNamedGridLines);
-        else {
+            // Subgrids only have line names defined, not track sizes, so we want our count
+            // to be the number of lines named rather than number of sized tracks.
+            if (tracksData.isSubgrid)
+                currentNamedGridLine++;
+        } else {
             ++currentNamedGridLine;
             tracksData.m_trackSizes.append(createGridTrackSize(currentValue, builderState));
         }
     };
 
+    if (is<CSSSubgridValue>(value))
+        tracksData.isSubgrid = true;
+
+    unsigned autoRepeatIndex = 0;
     for (auto& currentValue : downcast<CSSValueList>(value)) {
         if (is<CSSGridAutoRepeatValue>(currentValue)) {
-            ASSERT(tracksData.m_autoRepeatTrackSizes.isEmpty());
-            unsigned autoRepeatIndex = 0;
+            ASSERT(!autoRepeatIndex);
+            autoRepeatIndex = 0;
             CSSValueID autoRepeatID = downcast<CSSGridAutoRepeatValue>(currentValue.get()).autoRepeatID();
             ASSERT(autoRepeatID == CSSValueAutoFill || autoRepeatID == CSSValueAutoFit);
             tracksData.m_autoRepeatType = autoRepeatID == CSSValueAutoFill ? AutoRepeatType::Fill : AutoRepeatType::Fit;
@@ -1035,12 +1046,16 @@
             for (auto& autoRepeatValue : downcast<CSSValueList>(currentValue.get())) {
                 if (is<CSSGridLineNamesValue>(autoRepeatValue)) {
                     createGridLineNamesList(autoRepeatValue.get(), autoRepeatIndex, tracksData.m_autoRepeatNamedGridLines, tracksData.m_autoRepeatOrderedNamedGridLines);
+                    if (tracksData.isSubgrid)
+                        ++autoRepeatIndex;
                     continue;
                 }
                 ++autoRepeatIndex;
                 tracksData.m_autoRepeatTrackSizes.append(createGridTrackSize(autoRepeatValue.get(), builderState));
             }
-            tracksData.m_autoRepeatInsertionPoint = currentNamedGridLine++;
+            tracksData.m_autoRepeatInsertionPoint = currentNamedGridLine;
+            if (!tracksData.isSubgrid)
+                currentNamedGridLine++;
             continue;
         }
 
@@ -1058,7 +1073,7 @@
 
     // The parser should have rejected any <track-list> without any <track-size> as
     // this is not conformant to the syntax.
-    ASSERT(!tracksData.m_trackSizes.isEmpty() || !tracksData.m_autoRepeatTrackSizes.isEmpty());
+    ASSERT(!tracksData.m_trackSizes.isEmpty() || !tracksData.m_autoRepeatTrackSizes.isEmpty() || tracksData.isSubgrid);
     return true;
 }
 

Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (289721 => 289722)


--- trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-02-14 01:09:13 UTC (rev 289721)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-02-14 01:52:40 UTC (rev 289722)
@@ -1905,7 +1905,8 @@
     style.setGridAutoRepeat##TrackType##sInsertionPoint(tracksData ? tracksData->m_autoRepeatInsertionPoint : parentStyle->gridAutoRepeat##TrackType##sInsertionPoint()); \
     style.setAutoRepeatNamedGrid##TrackType##Lines(tracksData ? tracksData->m_autoRepeatNamedGridLines : parentStyle->autoRepeatNamedGrid##TrackType##Lines()); \
     style.setAutoRepeatOrderedNamedGrid##TrackType##Lines(tracksData ? tracksData->m_autoRepeatOrderedNamedGridLines : parentStyle->autoRepeatOrderedNamedGrid##TrackType##Lines()); \
-    style.setGridAutoRepeat##TrackType##sType(tracksData ? tracksData->m_autoRepeatType : parentStyle->gridAutoRepeat##TrackType##sType());
+    style.setGridAutoRepeat##TrackType##sType(tracksData ? tracksData->m_autoRepeatType : parentStyle->gridAutoRepeat##TrackType##sType()); \
+    style.setGridSubgrid##TrackType##s(tracksData ? tracksData->isSubgrid : parentStyle->gridSubgrid##TrackType##s());
 
 #define SET_INHERIT_TRACKS_DATA(style, parentStyle, TrackType) \
     BuilderConverter::TracksData* tracksData = nullptr; \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to