position-area block-axis center not scroll-compensated in position-try fit check (copy-paste in GetScrollCompensatedSidesFor)
Categories
(Core :: Layout: Positioned, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: Sylvestre)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
GetScrollCompensatedSidesFor (layout/generic/AbsoluteContainingBlock.cpp) has a copy-paste error: the block-axis Center branch tests aPositionArea.first instead of aPositionArea.second (the two branches above it correctly test .second).
So when a position-area uses center on the block axis with a non-center inline keyword (e.g. left center), eTopBottom is never added to mScrollCompensatedSides. That field feeds FitsInContainingBlock (the position-try fit check): after the anchor scrolls, the element is measured against the full containing-block height instead of the center band, so an oversized anchored element is wrongly judged to fit and the position-try fallback that should apply is skipped.
Fix: test aPositionArea.second in the Center branch. Added a WPT regression test (css/css-anchor-position/anchor-position-area-center-scroll-fallback.html); verified on local builds that it fails before the fix and passes after, and matches Chrome's behavior.
Found by Coverity (CID 1678404).
| Assignee | ||
Comment 1•4 days ago
|
||
| Assignee | ||
Comment 2•4 days ago
|
||
| Assignee | ||
Updated•4 days ago
|
| Assignee | ||
Comment 3•4 days ago
|
||
| Assignee | ||
Comment 4•4 days ago
|
||
The vertical-axis Center branch tested aPositionArea.first (copy-pasted
from the horizontal block) instead of aPositionArea.second, so a vertical
center was never detected for anchor-positioned elements.
+add a test
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/60935 for changes under testing/web-platform/tests
Comment 7•2 days ago
|
||
| bugherder | ||
Upstream PR merged by moz-wptsync-bot
Description
•