Skip to content

Conversation

tuankiet65
Copy link
Member

@tuankiet65 tuankiet65 commented Sep 20, 2025

39cf916

[css-anchor-position-1] Acceptable anchor algorithm should consider inline containing block
rdar://160917762
https://bugs.webkit.org/show_bug.cgi?id=299157

Reviewed by Elika Etemad.

THe acceptable anchor code uses RenderObject::containingBlock() to get
the containing block, but the name is a bit deceptive: it returns the
container that is a _block element_. For determining acceptable anchor,
the containing block could be an inline element. Switch to using
RenderObject::container(), which does return an inline element
as containing block.

Test: LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-004.html

* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-inline-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-004-expected.txt:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::penultimateContainingBlockChainElement):
(WebCore::Style::firstChildPrecedesSecondChild):

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

953acf1

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ❌ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ❌ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ❌ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@tuankiet65 tuankiet65 self-assigned this Sep 20, 2025
@tuankiet65 tuankiet65 added the CSS Cascading Style Sheets implementation label Sep 20, 2025
@tuankiet65
Copy link
Member Author

anchor-name-inline-001.html is failing, I was made aware that the test was wrong, so waiting for clarification on that.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 20, 2025
@fantasai
Copy link
Contributor

WPT Pull Request: web-platform-tests/wpt#55023

@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Sep 26, 2025
@tuankiet65 tuankiet65 force-pushed the eng/css-anchor-position-1-Acceptable-anchor-algorithm-should-consider-inline-containing-block branch from fd7806c to 953acf1 Compare September 26, 2025 19:01
@tuankiet65 tuankiet65 added the merge-queue Applied to send a pull request to merge-queue label Sep 27, 2025
…nline containing block

rdar://160917762
https://bugs.webkit.org/show_bug.cgi?id=299157

Reviewed by Elika Etemad.

THe acceptable anchor code uses RenderObject::containingBlock() to get
the containing block, but the name is a bit deceptive: it returns the
container that is a _block element_. For determining acceptable anchor,
the containing block could be an inline element. Switch to using
RenderObject::container(), which does return an inline element
as containing block.

Test: LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-004.html

* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-name-inline-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-004-expected.txt:
* Source/WebCore/style/AnchorPositionEvaluator.cpp:
(WebCore::Style::penultimateContainingBlockChainElement):
(WebCore::Style::firstChildPrecedesSecondChild):

Canonical link: https://commits.webkit.org/300614@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/css-anchor-position-1-Acceptable-anchor-algorithm-should-consider-inline-containing-block branch from 953acf1 to 39cf916 Compare September 27, 2025 00:38
@webkit-commit-queue
Copy link
Collaborator

Committed 300614@main (39cf916): https://commits.webkit.org/300614@main

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

@webkit-commit-queue webkit-commit-queue merged commit 39cf916 into WebKit:main Sep 27, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Sep 27, 2025
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

Development

Successfully merging this pull request may close these issues.

5 participants