RESOLVED FIXED 283295
[css-anchor-position-1] Trigger evaluation of default anchor when it's used for anchor-center
https://bugs.webkit.org/show_bug.cgi?id=283295
Summary [css-anchor-position-1] Trigger evaluation of default anchor when it's used f...
Pawel Lampe
Reported 2024-11-18 04:01:33 PST
While working on anchor-center I've discovered that in some cases the resolution of anchoring is not done and therefore the anchored elements are not being linked to anchors. In other words, in some cases it's impossible to fetch default anchor element (https://drafts.csswg.org/css-anchor-position-1/#default-anchor-element) of given element. Example 1: In case of https://github.com/web-platform-tests/wpt/blob/master/css/css-anchor-position/anchor-center-offset-change.html the position-anchor is set to --anchor (that is a valid anchor) and the left is set to anchor(--unknown right, 0px) - in this case the anchor resolution should succeed and the internal anchoring-related data structures should store the relation between anchor and the anchor target. Example 2: In case of https://github.com/web-platform-tests/wpt/blob/master/css/css-anchor-position/anchor-center-scroll.html the position-anchor is set to --anchor (that is a valid anchor) and yet no inset properties are using anchor() function. In this case the anchor resolution should still succeed and the internal anchoring-related data structures should store the relation between anchor and the anchor target.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-11-18 08:35:10 PST
Kiet Ho
Comment 2 2025-01-13 02:15:18 PST
I haven't dived into this, so some speculation: We gather: * all anchor references - anchor name used in anchor() or anchor-size(), or elements with anchor-center * all anchors - elements with anchor-name specified. Then we attempt to resolve the anchor references, using the gathered list of anchors. I think the code right now only looks for anchor references in anchor() and anchor-size(). If an element uses anchor-center and not anchor()/anchor-size(), then the reference isn't caught, even though anchor-center refers to the default anchor.
Pawel Lampe
Comment 3 2025-01-23 00:05:36 PST
That's correct. IMO we should store all the anchor-references used (along with position-anchor) or at least the default one.
Kiet Ho
Comment 4 2025-01-27 10:42:11 PST
Antti Koivisto
Comment 5 2025-02-18 02:55:46 PST
EWS
Comment 6 2025-02-18 09:43:27 PST
Committed 290534@main (aa6b7858fefa): <https://commits.webkit.org/290534@main> Reviewed commits have been landed. Closing PR #40758 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.