Re: [csswg-drafts] [css-sizing] What happens with the last remembered size if there is no principal box? (#7527)

The CSS Working Group just discussed `last remembered size if no principal box`, and agreed to the following:

* `RESOLVED: If an element doesn't have a principal box, we do not record a last remembered size`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: last remembered size if no principal box<br>
&lt;fantasai> s/Topic/Subtopic/<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/7527<br>
&lt;fantasai> oriol: In a note, when the element gets display:none, then the last remembered size is supposed to be preserved<br>
&lt;fantasai> oriol: if the elmeent doesn't have 0x0, and the box is distroyed when you apply 'display:none', then the last remembere size will be zero<br>
&lt;fantasai> oriol: if c-i-s is auto, then need to remember this last size<br>
&lt;fantasai> oriol: so we override the last size with 0x0<br>
&lt;fantasai> oriol: and then I guess we should ad the condition that the element at that point is not generating a principal box, shouldn't record the size<br>
&lt;fantasai> TabAtkins: correct, if it doesn't have a principal box shouldn't record the size<br>
&lt;fantasai> TabAtkins: agree we should fix that<br>
&lt;fantasai> oriol: if there's no box, shouldn't we be able to remove this last remembered size?<br>
&lt;fantasai> oriol: we resolved that if it's removed from the tree, we clear the size<br>
&lt;fantasai> oriol: I guess if it doesn't have a box, the size doesn't change, but my understanding is even if the size doesn't change, if you remove c-i-s: auto you remove last remembere size<br>
&lt;fantasai> TabAtkins: lacking a principal box shouldn't remove the remembered size<br>
&lt;fantasai> TabAtkins: as long as you still have c-i-s: auto<br>
&lt;emilio> q+<br>
&lt;fantasai> oriol: Consider a case where we have a box, but let's say that we have c-i-s: auto and we remmeber the size<br>
&lt;fantasai> oriol: and then we remove c-i-s: auto<br>
&lt;fantasai> oriol: but box size doesn't change<br>
&lt;fantasai> oriol: should we remove the last remembered size?<br>
&lt;fantasai> TabAtkins: yes<br>
&lt;fantasai> TabAtkins: this is not tied to ResizeObserver, it's tied to ResizeObserver timing<br>
&lt;fantasai> oriol: if you lose c-i-s: auto, but this doesn't trigger a size change, then we still remove the last remembered size<br>
&lt;fantasai> fantasai: okay<br>
&lt;fantasai> oriol: in this case, we wouldn't get an observation because the size didn't chnage<br>
&lt;fantasai> oriol: but if we can remove the size when c-i-s: auto is lost, what if we first add display:none<br>
&lt;fantasai> oriol: and then remove c-i-s: auto<br>
&lt;fantasai> oriol: by consistency, we need to remove the last remembmered size as well<br>
&lt;fantasai> oriol: but most browsers don't recompute style during 'display: none'<br>
&lt;fantasai> TabAtkins: so that's an implementation difficulty with matching the spec<br>
&lt;emilio> q- (was going to mention this)<br>
&lt;emilio> q-<br>
&lt;vmpstr> fantasai: if it's display: none you can flip things on and off<br>
&lt;fantasai> s/if/suppose if/<br>
&lt;fantasai> fantasai: and when you remove 'display: none', you check if cis:auto is there and either clear the last remembered size or not/<br>
&lt;fantasai> emilio: but you need to do that not at ResizeObserver time, but as soon as you get a box that is not cis:auto<br>
&lt;fantasai> emilio: so you go display:none, at ResizeObserver time we dont' know what to do because don't have a box<br>
&lt;fantasai> emilio: if when you come back, you need to check cis:auto<br>
&lt;fantasai> TabAtkins: that seems fine to me<br>
&lt;fantasai> emilio: It's weird to update this in different places<br>
&lt;fantasai> TabAtkins: I also think it's weird to do that, but it's apparently problematic to do it while display is none<br>
&lt;fantasai> TabAtkins: So we check for cis:auto when the element begins generating a principal box again<br>
&lt;fantasai> TabAtkins: if it doesn't ahve cis:auto at that point, forget its last remembered size<br>
&lt;fantasai> emilio: yeah, ok<br>
&lt;fantasai> TabAtkins: if you're doing anything weird switching cis while you're display:none it's your fault<br>
&lt;fantasai> emilio: consider CQ, might flip things dpeneding on container<br>
&lt;fantasai> emilio: if you're already compute CQ, you may need to create a box for  asize that isn't your final one<br>
&lt;fantasai> emilio: you may clear the remembere dsize,<br>
&lt;fantasai> emilio: ...<br>
&lt;fantasai> TabAtkins: why would you clear it at that point<br>
&lt;fantasai> emilio: imagine without CQ matching, you don't have cis:auto<br>
&lt;fantasai> emilio: and once you know that you have a container of a given size, the box gets cis:auto<br>
&lt;fantasai> TabAtkins: easiest solution is to put cis:auto less conditionally<br>
&lt;fantasai> emilio: yes, I agree, but its a sketchy case<br>
&lt;fantasai> emilio: because it depends on how precisely you implement queries<br>
&lt;fantasai> TabAtkins: I think it's okay<br>
&lt;fantasai> TabAtkins: it seems ok for it to be less certain<br>
&lt;fantasai> TabAtkins: there's an easy solution: don't make it conditional in your styles<br>
&lt;fantasai> TabAtkins: so proposed resolution is that we add new condition to forget last remembered size<br>
&lt;fantasai> TabAtkins: which is if an element goes from not generating a principal box to generating one, we check cis and if it's not auto we forget the size<br>
&lt;fantasai> oriol: and ???<br>
&lt;fantasai> Rossen_: any objections to first one?<br>
&lt;emilio> s/???/for storing the size the element should have a box<br>
&lt;TabAtkins> s/???/and only storing the size if it has a principal box/<br>
&lt;fantasai> REOSLVED: If, when an element goes from not generating a principal box to generating one, it does not have cis:auto, forget any last remembered size<br>
&lt;fantasai> s/REOSLV/RESOLV/<br>
&lt;fantasai> TabAtkins: if an element doesn't have a principal box, we do not record a principal size<br>
&lt;fantasai> RESOLVED: If an element doesn't have a principal box, we do not record a last remembered size<br>
&lt;fantasai> Rossen_: anything else on this issue?<br>
&lt;fantasai> oriol: nope<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7527#issuecomment-1202748701 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:54:57 UTC