Add support for parsing 'subgrid' in grid-template-columns/row
https://bugs.webkit.org/show_bug.cgi?id=236054
Patch by Matt Woodrow <Matt Woodrow> 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):
(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.