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
Add masonry as valid value to grid-template-rows/grid-template-columns. #5517
Conversation
EWS run on previous version of this PR (hash 75eeb8b) |
@@ -168,6 +177,9 @@ class StyleGridData : public RefCounted<StyleGridData> { | |||
bool m_subgridRows; | |||
bool m_subgridColumns; | |||
|
|||
bool m_masonryRows; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth combining this into m_subgridRows with a tri-state enum (normal, subgrid, masonry), so that the invalid state of both masonry+subgrid can't be represented.
75eeb8b
to
0b1dee3
Compare
EWS run on previous version of this PR (hash 0b1dee3) |
const bool& masonryRows() const { return m_masonryRows; } | ||
const bool& masonryColumns() const { return m_masonryColumns; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these variables need to be added to operator==?
Why do these function (and some earlier ones) return references instead of just bools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes they probably should be. Added!
These did not need to so I went ahead and changed the methods, but I'm not familiar with the ones above.
0b1dee3
to
5216a53
Compare
EWS run on current version of this PR (hash 5216a53) |
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
5216a53
to
ec92864
Compare
Committed 255888@main (ec92864): https://commits.webkit.org/255888@main Reviewed commits have been landed. Closing PR #5517 and removing active labels. |
ec92864
5216a53