[csswg-drafts] [css-anchor-position] "last remember position-try" timing details (#10216)

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

== [css-anchor-position] "last remember position-try" timing details ==
In private conversation, Rune pointed out that the spec currently can expose layout-engine details of exactly how it recalculates things, due to the fact that the last successful position-try is "remembered" as soon as you run layout, but it's not "forgotten" until RO time. So with CQs, etc. that can all cycle layout multiple times, potentially we could expose intermediate engine states (due to recording a memory during them) that would otherwise have been invisible. The *point* of remembering is to keep layout stable when the element moves into an "everything overflows" state, to provide a better user experience; having invisible intermediate states trigger memory doesn't make any sense (in addition to exposing engine state that we don't want to expose).

Talking thru the options, it seems like the best thing to do is remember at the same time as we forget - at RO time.

------

Related to this, then, there's still the question of what exactly is being "remembered", in case the position-try options are mutated during layout (due to a CQ, for example) and we haven't had the chance to forget yet. We don't want to forget *eagerly*, as this again could expose internal engine state (an early CQ pass, for example, that'll get overridden when we get "good" data). So if we have a memory, is it an index into the position-try-options list, or a pointer to a `@position-try` block (+tactics, if relevant)?

I think the only thing that makes sense is the latter - actually remember the set of styles being applied. An index into a list that might have mutated underneath you is nonsensical, as there's no guarantee that what's at that index has anything to do with what was there at the time it was remembered, and might be invalid anyway due to the list getting shorter.

I'm gonna go ahead and make these tweaks, just recording the reasoning publicly so I don't need to put as much detail into my commit message. ^_^

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


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

Received on Tuesday, 16 April 2024 15:58:40 UTC