Re: [csswg-drafts] [css-sizing] Should last remembered size be removed if the element is removed from the document? (#7532)

The CSS Working Group just discussed `Last Rememberd Size unclear when auto`, and agreed to the following:

* `RESOLVED: At ResizeObserver time, forget an element's last remembered size if it is currently out of the document`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Subtopic: Last Rememberd Size unclear when auto<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/7516<br>
&lt;fantasai> oriol: spec says that when we store last remembered size, this survives box destruction, e.g. if you add 'display: none', the element will keep storing this last remembered size<br>
&lt;fantasai> oriol: my question here is if the element is removed from the tree<br>
&lt;fantasai> oriol: and then later re-inserted<br>
&lt;fantasai> oriol: will it still have its last remembered size from the previous position in the tree?<br>
&lt;fantasai> oriol: should we remove the last remembered size?<br>
&lt;fantasai> TabAtkins: I suggest whatever is easiest to implement<br>
&lt;emilio> https://github.com/w3c/csswg-drafts/issues/7532<br>
&lt;emilio> github: https://github.com/w3c/csswg-drafts/issues/7532<br>
&lt;fantasai> ...<br>
&lt;fantasai> TabAtkins: Rossen made the point that moving the element is done by removing the item ...<br>
&lt;fantasai> TabAtkins: but if you're e.g. re-ordering a list, you might want to keep that info<br>
&lt;iank_> yeah there are lots of cases for moving things around, and it should keep the same last size.<br>
&lt;emilio> q+<br>
&lt;fantasai> TabAtkins: The common case for removing from document and re-inserting is moving it around<br>
&lt;fantasai> TabAtkins: and the common case of that is re-ordering within a list of similar items<br>
&lt;fantasai> TabAtkins: so my suggestion is to keep the last remembered size until normal things remove it<br>
&lt;Rossen_> ack emilio<br>
&lt;fantasai> emilio: You can move things around, given how specced right now<br>
&lt;ydaniv> Is removing from layout tree much different from being removed completely from the DOM?<br>
&lt;fantasai> emilio: that means that if you move it, by the time you ??, it will already have a box<br>
&lt;fantasai> emilio: when we fire ResizeObserver calllback, if you move an element, it will have a new box and a new position in the tree<br>
&lt;fantasai> emilio: do we want to clear it if it's not in the document or doesn't have a box, i.e. when you fire the ResizeObserver event<br>
&lt;fantasai> emilio: [missed]<br>
&lt;fantasai> emilio: Deciding at the time of ResizeObserver doesn't prevent the moving case from working<br>
&lt;fantasai> TabAtkins: if you remove it from the tree, hold onto it a bit, ResizeObserver fires, and then you don't have a remembered size at that point<br>
&lt;fantasai> TabAtkins: when the ResizeObserver timing happens (well-defined), if the element is outside the document, we clear the last remember size<br>
&lt;fantasai> TabAtkins: because we forget the size in some cases at ResizeObserver timing<br>
&lt;fantasai> Rossen_: what do we do for animations?<br>
&lt;fantasai> TabAtkins: they're tied to the box<br>
&lt;fantasai> TabAtkins: but these are tied specifically to the element itself<br>
&lt;fantasai> TabAtkins: is there an implementation concern?<br>
&lt;fantasai> emilio: no<br>
&lt;fantasai> TabAtkins: I could lean either way<br>
&lt;fantasai> Rossen_: Oriol, do you have an opinion<br>
&lt;fantasai> oriol: No strong opinion, just wondering about it<br>
&lt;fantasai> oriol: I suppose we can leave it to not do anything special<br>
&lt;fantasai> oriol: Styles might change if you move it, or the old size might be strange in the new position<br>
&lt;fantasai> oriol: but can also be fine<br>
&lt;fantasai> oriol: so no strong opinion<br>
&lt;ydaniv> q+<br>
&lt;fantasai> iank_: The reason not to tie it to the box is that we have a lot of features that will switch out of the box<br>
&lt;fantasai> iank_: e.g. ?? will be very common fro an element to have potentially different boxes associated<br>
&lt;TabAtkins> s/??/like when using CQ, it/<br>
&lt;fantasai> ydaniv: c-i-s is only interesteding if you have content-visibility and still out of view, right?<br>
&lt;fantasai> ydaniv: so by the time that the element is in view, it doesn't really play any part, right?<br>
&lt;fantasai> oriol: it can play a part if you first lay out the element normally and it can store its size, and then you add content-visilbity: hidden, the it can be in the screen and keep its contents, and it will use its last remembered size<br>
&lt;Rossen_> ack ydaniv<br>
&lt;fantasai> oriol: we resovled this last week<br>
&lt;fantasai> TabAtkins: that's the exact weirdo case this is designed for<br>
&lt;fantasai> Rossen_: Ok, regardless if it's weird or not, we need to make it more predictable<br>
&lt;fantasai> Rossen_: if we specify that it fires, the previous size<br>
&lt;fantasai> Rossen_: would there be any objections?<br>
&lt;fantasai> TabAtkins: I think I lean very slightly towards it forgetting its size<br>
&lt;fantasai> TabAtkins: if you're stashing away, not just doing a move<br>
&lt;flackr> q_<br>
&lt;flackr> q+<br>
&lt;fantasai> TabAtkins: it's much less clear that the new context you're putting it into would be similar<br>
&lt;flackr> q-<br>
&lt;fantasai> TabAtkins: so I lean towards forgetting if it's out of document<br>
&lt;fantasai> Rossen_: when you last checked this, did you check what implementations did?<br>
&lt;fantasai> oriol: ???<br>
&lt;fantasai> oriol: and in Gecko haven't landed implementation<br>
&lt;vmpstr> s/???/Chromium never seems to remove last remembered size/<br>
&lt;fantasai> flackr: For ?? scroller recycling element, I think we'd see this happen, and you'd want to forget the size, because you're changing the content before re-inserting<br>
&lt;flackr> s/??/virtual<br>
&lt;fantasai> Rossen_: so then the proposed resolution is that the element will forget its last size<br>
&lt;fantasai> TabAtkins: at normal ResizeObserver timing<br>
&lt;fantasai> vmpstr: then if removed and then re-aded, then it's ??????<br>
&lt;fantasai> TabAtkins: At ResizeObserver time, you also check if it is in the document<br>
&lt;fantasai> TabAtkins: if not, forget the size<br>
&lt;vmpstr> s/??????/keeps its size if it happened before the resize observer timing/<br>
&lt;TabAtkins> RESOLVED: At ResizeObserver time, forget an element's last remembered size if it is currently out of the document<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7532#issuecomment-1202640447 using your GitHub account


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

Received on Tuesday, 2 August 2022 14:02:52 UTC