[webkit-changes] [WebKit/WebKit] ec9286: Add masonry as valid value to grid-template-rows/g...

Sammy Gill noreply at github.com
Sat Oct 22 18:10:23 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec9286482794e9be0e62138642fefc3b67d378be
      https://github.com/WebKit/WebKit/commit/ec9286482794e9be0e62138642fefc3b67d378be
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2022-10-22 (Sat, 22 Oct 2022)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-grid-template-columns-computed-withcontent-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-parsing-expected.txt
    M Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
    M Source/WebCore/animation/CSSPropertyAnimation.cpp
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/StyleGridData.cpp
    M Source/WebCore/rendering/style/StyleGridData.h
    M Source/WebCore/style/StyleBuilderConverter.h

  Log Message:
  -----------
  Add masonry as valid value to grid-template-rows/grid-template-columns.
https://bugs.webkit.org/show_bug.cgi?id=246541
rdar://101188057

Reviewed by Antti Koivisto.

This patch adds a CSS Masonry Layout flag and adds the 'masonry'
value as a valid value for the grid-template-rows and
grid-template-columns properties. A new CSSMasonryValue has been added
to represent this new value.

When we parse the grid-template-rows/columns property, we check to
see if the token is of CSSValueMasonry and consume it as an ident if it
is since the value of the syntax is straightforward.

When we build the track list, we check the ID of the primitive value
to see if it also matches CSSMasonryValue. In this scenario a new
masonry entry is added to the track list so that the serialization can
later set m_masonryRows or m_masonryColumns in StyleGridData correctly.

* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-grid-template-columns-computed-withcontent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-parsing-expected.txt:
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:
* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::canInterpolate):
(WebCore::blendFunc):
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::valueForGridTrackListi):
If the track list is empty and the value for the track is not subgrid,
then we check to see if it is set to masonry.

* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::consumeGridTemplatesRowsOrColumns):
Since 'masonry' is the only value that will trigger masonry layout and
there is no other form for the syntax, we can just consume the token
as an ident. However, later on when we actually build the track list,
we will need to check whether the value is a CSSPrimitive and compare
the ID of it.

* Source/WebCore/rendering/style/RenderStyle.h:
(WebCore::RenderStyle::gridMasonryRows const):
(WebCore::RenderStyle::gridMasonryColumns const):
* Source/WebCore/rendering/style/StyleGridData.cpp:
(WebCore::StyleGridData::StyleGridData):
(WebCore::StyleGridData::setRows):
(WebCore::StyleGridData::setColumns):
(WebCore::StyleGridData::computeCachedTrackData):
(WebCore::operator<<):
* Source/WebCore/rendering/style/StyleGridData.h:
(WebCore::GridTrackEntryMasonry::operator== const):
(WebCore::StyleGridData::masonryRows const):
(WebCore::StyleGridData::masonryColumns const):
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::createGridTrackList):

Canonical link: https://commits.webkit.org/255888@main




More information about the webkit-changes mailing list