w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.42k stars 649 forks source link

[css-anchor-position] flip should also flip safe-area-inset values #10422

Open fantasai opened 2 months ago

fantasai commented 2 months ago

https://drafts.csswg.org/css-anchor-position-1/#swap-due-to-a-try-tactic

Flipping should probably flip the safe-area-insets (if that's possible).

andruud commented 2 months ago

Doesn't quite fit within the exiting nature of "flips" in Blink, but it should be possible. We can spec that, for a style resolution under a given flip, the substitution value of env() is modified according to the flip.

So for example: for left: env(safe-area-inset-left) and flip-inline, safe-area-inset-left is transformed to safe-area-inset-right during substitution. So post-substitution we get e.g. left: 42px; /* from safe-area-inset-right */. Then, separately, that value is swapped with right using the existing mechanism.