RESOLVED FIXED 294256
[css-anchor-position-1] padding percentage incorrect inside position-area
https://bugs.webkit.org/show_bug.cgi?id=294256
Summary [css-anchor-position-1] padding percentage incorrect inside position-area
James Stuckey Weber
Reported 2025-06-10 06:53:52 PDT
Created attachment 475522 [details] Screenshot of padding: 100% using the original containing block, and not the containing block generated by the position-area If I use a percentage value for padding on an element that is positioned with `position-area`, the value is computed based on the original containing block, not on the new containing block created by `position-area`. For example, if the anchor is `200px`, and the `position-area` is `center top`, the new containing block should be 200px wide, so I expect `padding-inline-start: 100%` to add 200px of padding. Instead, it uses the original containing block's width. In this example, the containing block is 400px. https://codepen.io/jamessw/pen/KwpZjyj Using Release 220 (Safari 18.4, WebKit 20622.1.14.5), the padding is 400px. In Chromium browsers, the padding is 200px. This matches my understanding of the spec. `margin` appears to be computed based on the correct containing block.
Attachments
Screenshot of padding: 100% using the original containing block, and not the containing block generated by the position-area (42.48 KB, image/png)
2025-06-10 06:53 PDT, James Stuckey Weber
no flags
Ahmad Saleem
Comment 1 2025-06-10 22:21:57 PDT
It is broken on WebKit ToT (296077@main) as well.
Radar WebKit Bug Importer
Comment 2 2025-06-17 06:54:13 PDT
fantasai
Comment 3 2025-07-10 23:04:17 PDT
fantasai
Comment 4 2025-07-10 23:24:10 PDT
Thanks so much for the bug report and the simplified testcase, James! I think I have a fix in hand, so hopefully will be able to land it on trunk soon. :)
EWS
Comment 5 2025-07-11 12:43:23 PDT
Committed 297275@main (b59ae7a025c9): <https://commits.webkit.org/297275@main> Reviewed commits have been landed. Closing PR #47873 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.