Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add masonry as valid value to grid-template-rows/grid-template-columns. #5517

Commits on Oct 23, 2022

  1. 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
    sammygill committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    ec92864 View commit details
    Browse the repository at this point in the history