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

[css-anchor-position-1] Add parsing support for anchor-name and position-anchor properties #29423

Conversation

RWDavid
Copy link
Contributor

@RWDavid RWDavid commented Jun 2, 2024

be62da1

[css-anchor-position-1] Add parsing support for `anchor-name` and `position-anchor` properties
https://bugs.webkit.org/show_bug.cgi?id=275023
rdar://129120145

Reviewed by Tim Nguyen.

Add parsing support for `anchor-name` and `position-anchor` properties as specified in:
https://drafts.csswg.org/css-anchor-position-1/#name
https://drafts.csswg.org/css-anchor-position-1/#position-anchor

Both properties are placed under a new preference named `CSSAnchorPositioningEnabled`.

* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-basics-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-anchor-basics-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/property-interpolations-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/ipad/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::valueForAnchorName):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle const):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::anchorNames const):
(WebCore::RenderStyle::initialAnchorNames):
(WebCore::RenderStyle::initialPositionAnchor):
(WebCore::RenderStyle::positionAnchor const):
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setAnchorNames):
(WebCore::RenderStyle::setPositionAnchor):
* Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertAnchorName):

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

18f709f

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2 βœ… πŸ§ͺ wincairo-tests
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-cairo
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch βœ… πŸ›  jsc-armv7
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-armv7-tests

@RWDavid RWDavid requested a review from graouts as a code owner June 2, 2024 03:25
@RWDavid RWDavid self-assigned this Jun 2, 2024
@RWDavid RWDavid added the CSS Cascading Style Sheets implementation label Jun 2, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 2, 2024
@RWDavid RWDavid requested a review from anttijk June 2, 2024 07:03
"position-anchor": {
"codegen-properties": {
"converter": "StringOrAutoAtom",
"parser-exported": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think you need to export, I’m not seeing calls to consumePositionAnchor

"codegen-properties": {
"converter": "AnchorName",
"name-for-methods": "AnchorNames",
"parser-exported": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto about the export

@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Jun 2, 2024
@RWDavid RWDavid force-pushed the eng/parse-anchor-name-and-position-anchor branch from c5a89bc to 18f709f Compare June 2, 2024 17:33
@RWDavid RWDavid added the merge-queue Applied to send a pull request to merge-queue label Jun 2, 2024
@webkit-commit-queue
Copy link
Collaborator

@RWDavid does not have committer permissions according to https://raw.githubusercontent.com/WebKit/WebKit/main/metadata/contributors.json.

If you do have committer permmissions, please ensure that your GitHub username is added to contributors.json.

Rejecting 18f709f from merge queue.

@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed merge-queue Applied to send a pull request to merge-queue labels Jun 2, 2024
@RWDavid RWDavid removed the merging-blocked Applied to prevent a change from being merged label Jun 2, 2024
@sammygill sammygill added the merge-queue Applied to send a pull request to merge-queue label Jun 2, 2024
…sition-anchor` properties

https://bugs.webkit.org/show_bug.cgi?id=275023
rdar://129120145

Reviewed by Tim Nguyen.

Add parsing support for `anchor-name` and `position-anchor` properties as specified in:
https://drafts.csswg.org/css-anchor-position-1/#name
https://drafts.csswg.org/css-anchor-position-1/#position-anchor

Both properties are placed under a new preference named `CSSAnchorPositioningEnabled`.

* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-basics-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-anchor-basics-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/property-interpolations-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/ipad/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::valueForAnchorName):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle const):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::anchorNames const):
(WebCore::RenderStyle::initialAnchorNames):
(WebCore::RenderStyle::initialPositionAnchor):
(WebCore::RenderStyle::positionAnchor const):
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setAnchorNames):
(WebCore::RenderStyle::setPositionAnchor):
* Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):
* Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertAnchorName):

Canonical link: https://commits.webkit.org/279628@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/parse-anchor-name-and-position-anchor branch from 18f709f to be62da1 Compare June 2, 2024 21:27
@webkit-commit-queue
Copy link
Collaborator

Committed 279628@main (be62da1): https://commits.webkit.org/279628@main

Reviewed commits have been landed. Closing PR #29423 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit be62da1 into WebKit:main Jun 2, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 2, 2024
return { };

return WTF::map(*list, [&](auto& item) {
return AtomString { downcast<CSSPrimitiveValue>(item).stringValue() };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should assert that it's a CSSPrimitiveValue before the downcast - asserting that the parser worked (otherwise it could be a CSSValue)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downcast should do its own assert anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Cascading Style Sheets implementation
Projects
None yet
8 participants