NEW 292754
[css-anchor-position-1] Wrong assumption that if an anchor doesn't exist, it will not exist again in the future
https://bugs.webkit.org/show_bug.cgi?id=292754
Summary [css-anchor-position-1] Wrong assumption that if an anchor doesn't exist, it ...
Kiet Ho
Reported 2025-05-08 18:40:08 PDT
Created attachment 475172 [details] Test case Consider this pseudo-HTML (see attached HTML for a fully working test case) <div anchor-name: --a /> // A <div position-anchor: --a position-area: top left> // B <div anchor-name: --c ></div> // C </div> <div position-anchor: --c position-area: top right /> // D A is an anchor. B is anchor-positioned, and its child, C, is an anchor. D is anchor-positioned. Style/layout interleaving timeline: * First style resolution: A is discovered as an anchor. B is discovered as anchor-positioned to A. D is discovered as anchor-positioned to C. Crucially, there's an optimization where if an anchor-positioned element hasn't been resolved yet, we skip descending into its children until the next style resolution, when the anchor-positioned element has been resolved. So here, we don't discover C as an anchor (because its parent, B, is anchor-positioned and not resolved yet) * First layout: A is laid out. Post processing task links B to A, but doesn't link D to anything (because D depends on C, but the code hasn't seen C yet) * Second style resolution: B, D are marked as resolved. Since B is resolved, the code descends into B and discovers C as an anchor. BUT, since D are already marked as resolved, we don't go back and fix that C actually exists. * Second layout: B is laid out Result: the code treats C as if it doesn't exist.
Attachments
Test case (1.93 KB, text/html)
2025-05-08 18:40 PDT, Kiet Ho
no flags
Radar WebKit Bug Importer
Comment 1 2025-05-08 18:40:17 PDT
Note You need to log in before you can comment on or make changes to this bug.