source: webkit/trunk/Source/WebCore/css/CSSSubgridValue.h

Last change on this file was 289722, checked in by [email protected], 3 years ago

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 size: 1.9 KB
Line 
1/*
2 * Copyright (C) 2022 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#pragma once
32
33#include "CSSValueList.h"
34
35namespace WebCore {
36
37class CSSSubgridValue final : public CSSValueList {
38public:
39 static Ref<CSSSubgridValue> create()
40 {
41 return adoptRef(*new CSSSubgridValue);
42 }
43
44 String customCSSText() const;
45
46private:
47 CSSSubgridValue();
48};
49
50} // namespace WebCore
51
52SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSSubgridValue, isSubgridValue());
Note: See TracBrowser for help on using the repository browser.