Skip to content

Conversation

@fantasai
Copy link
Contributor

@fantasai fantasai commented Nov 3, 2025

a742f82

REGRESSION(300921@main): Exclude fixed-positioned boxes from position-area scrollable CB
https://bugs.webkit.org/show_bug.cgi?id=301880
rdar://163955483

Reviewed by Alan Baradlay.

The recent fix for bug 299950 forgot to exclude fixed-positioned boxes
from the root scrollable containing block pathway, resulting in incorrect
layout for fixed-positioned boxes that use position-area. However, we
still need to avoid using overflow safety to overlap the anchor when it
would otherwise be reachable. This patch excludes fixed-positioned boxes
from using the scrollable containing block from sizing and positioning,
but allows them to overflow into that area when necessary.

Tests: imported/w3c/web-platform-tests/css/css-anchor-position/position-area-fixed.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003-ref.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004-ref.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004.html
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-fixed-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-fixed.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-ref.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-002.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003-ref.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004-ref.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-002.html.

Update and add tests.

* Source/WebCore/rendering/PositionedLayoutConstraints.cpp:
(WebCore::PositionedLayoutConstraints::PositionedLayoutConstraints):
(WebCore::PositionedLayoutConstraints::expandToScrollableArea const):
(WebCore::PositionedLayoutConstraints::captureScrollableArea): Deleted.

Adjust captureScrollableArea API to be re-usable for different LayoutRanges.
Exempt fixed-positioned boxes from the m_containingRange adjustment.

(WebCore::PositionedLayoutConstraints::resolveAlignmentShift const):

Adjust overflow alignment area for fixed-positioned boxes.

(WebCore::PositionedLayoutConstraints::containerAllowsInfiniteOverflow const):

Add missing check for scrollable RenderView (which returns false on
hasPotentiallyScrollableOverflow() even when the document is scrollable).

* Source/WebCore/rendering/PositionedLayoutConstraints.h:
(WebCore::PositionedLayoutConstraints::expandToScrollableArea):

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

ab8f894

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
✅ 🛠 🧪 unsafe-merge ✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@fantasai fantasai self-assigned this Nov 3, 2025
@fantasai fantasai marked this pull request as draft November 3, 2025 05:25
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 3, 2025
@fantasai fantasai removed the merging-blocked Applied to prevent a change from being merged label Nov 3, 2025
@fantasai fantasai changed the title Fix stupid scrollable area errors Exclude fixed-positioned boxes from position-area scrollable containing block Nov 3, 2025
@fantasai fantasai force-pushed the scrollable-cb-errors branch from 39a7d34 to 91cc75c Compare November 3, 2025 20:12
@fantasai fantasai added the Layout and Rendering For bugs with layout and rendering of Web pages. label Nov 3, 2025
@fantasai fantasai marked this pull request as ready for review November 3, 2025 20:12
@fantasai fantasai requested a review from alanbaradlay November 3, 2025 20:12
Copy link
Contributor

@alanbaradlay alanbaradlay left a comment

Choose a reason for hiding this comment

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

Could you add the regression information to the title, please.

@fantasai fantasai added the merging-blocked Applied to prevent a change from being merged label Nov 3, 2025
@fantasai fantasai marked this pull request as draft November 3, 2025 20:51
@fantasai fantasai removed the merging-blocked Applied to prevent a change from being merged label Nov 3, 2025
@fantasai fantasai changed the title Exclude fixed-positioned boxes from position-area scrollable containing block REGRESSION(300921@main): Exclude fixed-positioned boxes from position-area scrollable CB Nov 3, 2025
@fantasai fantasai force-pushed the scrollable-cb-errors branch from 91cc75c to ab8f894 Compare November 3, 2025 23:36
@fantasai fantasai requested a review from alanbaradlay November 3, 2025 23:39
@fantasai fantasai marked this pull request as ready for review November 3, 2025 23:43
@fantasai fantasai added the CSS Cascading Style Sheets implementation label Nov 3, 2025
@fantasai fantasai added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Nov 3, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 4, 2025
@fantasai fantasai added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Nov 4, 2025
@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 Nov 4, 2025
@nt1m nt1m added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Nov 4, 2025
…-area scrollable CB

https://bugs.webkit.org/show_bug.cgi?id=301880
rdar://163955483

Reviewed by Alan Baradlay.

The recent fix for bug 299950 forgot to exclude fixed-positioned boxes
from the root scrollable containing block pathway, resulting in incorrect
layout for fixed-positioned boxes that use position-area. However, we
still need to avoid using overflow safety to overlap the anchor when it
would otherwise be reachable. This patch excludes fixed-positioned boxes
from using the scrollable containing block from sizing and positioning,
but allows them to overflow into that area when necessary.

Tests: imported/w3c/web-platform-tests/css/css-anchor-position/position-area-fixed.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003-ref.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004-ref.html
       imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004.html
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-fixed-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-fixed.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-ref.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-002.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003-ref.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-003.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004-ref.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-001-expected.html.
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-004.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-overflow-icb-002.html.

Update and add tests.

* Source/WebCore/rendering/PositionedLayoutConstraints.cpp:
(WebCore::PositionedLayoutConstraints::PositionedLayoutConstraints):
(WebCore::PositionedLayoutConstraints::expandToScrollableArea const):
(WebCore::PositionedLayoutConstraints::captureScrollableArea): Deleted.

Adjust captureScrollableArea API to be re-usable for different LayoutRanges.
Exempt fixed-positioned boxes from the m_containingRange adjustment.

(WebCore::PositionedLayoutConstraints::resolveAlignmentShift const):

Adjust overflow alignment area for fixed-positioned boxes.

(WebCore::PositionedLayoutConstraints::containerAllowsInfiniteOverflow const):

Add missing check for scrollable RenderView (which returns false on
hasPotentiallyScrollableOverflow() even when the document is scrollable).

* Source/WebCore/rendering/PositionedLayoutConstraints.h:
(WebCore::PositionedLayoutConstraints::expandToScrollableArea):

Canonical link: https://commits.webkit.org/302537@main
@webkit-commit-queue
Copy link
Collaborator

Committed 302537@main (a742f82): https://commits.webkit.org/302537@main

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

@webkit-commit-queue webkit-commit-queue merged commit a742f82 into WebKit:main Nov 4, 2025
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 4, 2025
@fantasai fantasai deleted the scrollable-cb-errors branch November 4, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS Cascading Style Sheets implementation Layout and Rendering For bugs with layout and rendering of Web pages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants