interop icon indicating copy to clipboard operation
interop copied to clipboard

Unreviewed changes to anchor positioning

Open foolip opened this issue 8 months ago • 4 comments

Test List

From https://github.com/web-platform-tests/wpt/pull/51509:

https://wpt.fyi/results/css/css-anchor-position/anchor-center-htb-htb.html https://wpt.fyi/results/css/css-anchor-position/anchor-center-htb-vrl.html https://wpt.fyi/results/css/css-anchor-position/anchor-center-vrl-htb.html https://wpt.fyi/results/css/css-anchor-position/anchor-center-vrl-vrl.html https://wpt.fyi/results/css/css-anchor-position/position-area-anchor-outside.html https://wpt.fyi/results/css/css-anchor-position/position-area-anchor-partially-outside.html https://wpt.fyi/results/css/css-anchor-position/position-area-basic.html

cc @fantasai

Rationale

This affected the test results and we should review if there are any surprises. From the PR checks:

  • Chrome, 6 tests affected: https://wpt.fyi/results/css/css-anchor-position?diff&filter=ADC&run_id=5417950087741440&run_id=4853157459132416
  • Firefox, 4 tests affected: https://wpt.fyi/results/css/css-anchor-position?diff&filter=ADC&run_id=5927742891884544&run_id=5078710804021248
  • Safari, 6 tests affected: https://wpt.fyi/results/css/css-anchor-position?diff&filter=ADC&run_id=5172133657575424&run_id=5090170984726528

foolip avatar Mar 21 '25 14:03 foolip

@bfgeek can you review the changes? @lilles says that you implemented this and wrote the tests.

foolip avatar Mar 21 '25 14:03 foolip

Hmm... the changes to anchor-center-* seem incorrect?

  1. anchor-center coerce any auto inset properties to zero. https://drafts.csswg.org/css-anchor-position-1/#valdef-justify-self-anchor-center

  2. Then the overflow treatment should be that it is shifted to remain within its original containing-block (not its inset modified containing-block) https://drafts.csswg.org/css-anchor-position-1/#valdef-justify-self-anchor-center:~:text=in%20order%20to%20remain%20within%20the%20original%20containing%20block

E.g. the IMCB is [0, 20], the CB is [0, 0]. The size is calculated based off the IMCB to be 80. The anchor-center is at 65. Its original position is [25, -5] (overflow the original CB of 5 to the right), then adjusted to be within the original CB of [0, 0], to a final position of [20, 0].

@tabatkins Is my understanding correct?

bfgeek avatar Mar 21 '25 16:03 bfgeek

My interpretation was that the box is only allowed to overflow the IMCB if it doesn't fit within the IMCB. In this case, the box fits within the IMCB, so it should remain within it. https://www.w3.org/TR/css-align-3/#auto-safety-position

The anchor-center value is a bit weird in that its requested alignment is not necessarily within the IMCB even in the case of a box that's smaller than the IMCB. But if the author gave inset values that constrain its position, I think we should be honoring them.

fantasai avatar Mar 25 '25 04:03 fantasai

We probably need to open a CSSWG issue on this.

fantasai avatar Mar 25 '25 04:03 fantasai

@bfgeek Can we close this issue given the CSSWG resolution?

nt1m avatar Apr 12 '25 07:04 nt1m

@bfgeek Can we close this issue given the CSSWG resolution?

The tests are likely going to need further refinement/changes, as the CSSWG resolution adds more safety on top of whats there. But ok for the moment.

bfgeek avatar May 23 '25 18:05 bfgeek

Feel free to land tweaks as you feel appropriate as long as they match the spec. We can file another interop issue if there is a disagreement. I'll close this one for now.

nt1m avatar May 23 '25 20:05 nt1m