[csswg-drafts] [css-anchor-1] Tree-scoped references don't play nicely with transition styles (#8180)

tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-anchor-1] Tree-scoped references don't play nicely with transition styles ==
A tree-scoped reference (such as the `anchor()` function) captures what tree its stylesheet is in, so it can resolve the reference appropriately. But during a transition/animation, the intermediate styles are defined to live in a transition stylesheet in a separate origin from the rest of the page.

Combine this with the fact that the animated value of an inset property is, approximately, `top: calc(start-value * (1 - N) + end-value * N)` - if both start and end values come from different trees, they're now being mashed into a single value, living in *some* single tree somewhere (probably not either of the source trees!).

`anchor()` is the first tree-scoped reference where this really matters - all the other instances are discretely animated (like 'font-family'), so once you resolve the start and end values to something concrete, they just flip between the two and it's reasonably fine.† But anchors can move during the transition, and you want to track them!

I *think* this should be fixable with some magic, stating that when you construct the transition style it resolves its tree-scoped references first, and this partially-resolved value is what's being transitioned. 

/cc @xiaochengh @bfgeek @dbaron @emilio @smfr ?

-----

† In theory, if we fully ate our own dogfood and represented these with some sort of `transition(discrete 20%, start-value, end-value)` function it would be just as problematic, but we do magic instead so it's fine. I suppose we probably ignore if you change one of the @font-face rules partway thru the transition, maybe? Not a use-case we really worry about.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8180 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 2 December 2022 21:35:22 UTC