Ignore:
Timestamp:
Feb 13, 2022, 5:52:40 PM (3 years ago)
Author:
[email protected]
Message:

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):

  • 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSValue.cpp

    r286086 r289722  
    7070#include "CSSGridLineNamesValue.h"
    7171#include "CSSGridTemplateAreasValue.h"
     72#include "CSSSubgridValue.h"
    7273
    7374#include "DeprecatedCSSOMPrimitiveValue.h"
     
    185186        case GridLineNamesClass:
    186187            return compareCSSValues<CSSGridLineNamesValue>(*this, other);
     188        case SubgridClass:
     189            return compareCSSValues<CSSSubgridValue>(*this, other);
    187190        case GridTemplateAreasClass:
    188191            return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
     
    288291    case GridLineNamesClass:
    289292        return downcast<CSSGridLineNamesValue>(*this).customCSSText();
     293    case SubgridClass:
     294        return downcast<CSSSubgridValue>(*this).customCSSText();
    290295    case GridTemplateAreasClass:
    291296        return downcast<CSSGridTemplateAreasValue>(*this).customCSSText();
     
    411416        delete downcast<CSSGridLineNamesValue>(this);
    412417        return;
     418    case SubgridClass:
     419        delete downcast<CSSSubgridValue>(this);
     420        return;
    413421    case GridTemplateAreasClass:
    414422        delete downcast<CSSGridTemplateAreasValue>(this);
Note: See TracChangeset for help on using the changeset viewer.