-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-sizing] What happens with the last remembered size if there is no principal box? #7527
Comments
Also important for removals:
Browsers don't typically compute the style of elements in |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: last remembered size if no principal box<fantasai> s/Topic/Subtopic/ <fantasai> github: https://github.com//issues/7527 <fantasai> oriol: In a note, when the element gets display:none, then the last remembered size is supposed to be preserved <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 <fantasai> oriol: if c-i-s is auto, then need to remember this last size <fantasai> oriol: so we override the last size with 0x0 <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 <fantasai> TabAtkins: correct, if it doesn't have a principal box shouldn't record the size <fantasai> TabAtkins: agree we should fix that <fantasai> oriol: if there's no box, shouldn't we be able to remove this last remembered size? <fantasai> oriol: we resolved that if it's removed from the tree, we clear the size <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 <fantasai> TabAtkins: lacking a principal box shouldn't remove the remembered size <fantasai> TabAtkins: as long as you still have c-i-s: auto <emilio> q+ <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 <fantasai> oriol: and then we remove c-i-s: auto <fantasai> oriol: but box size doesn't change <fantasai> oriol: should we remove the last remembered size? <fantasai> TabAtkins: yes <fantasai> TabAtkins: this is not tied to ResizeObserver, it's tied to ResizeObserver timing <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 <fantasai> fantasai: okay <fantasai> oriol: in this case, we wouldn't get an observation because the size didn't chnage <fantasai> oriol: but if we can remove the size when c-i-s: auto is lost, what if we first add display:none <fantasai> oriol: and then remove c-i-s: auto <fantasai> oriol: by consistency, we need to remove the last remembmered size as well <fantasai> oriol: but most browsers don't recompute style during 'display: none' <fantasai> TabAtkins: so that's an implementation difficulty with matching the spec <emilio> q- (was going to mention this) <emilio> q- <vmpstr> fantasai: if it's display: none you can flip things on and off <fantasai> s/if/suppose if/ <fantasai> fantasai: and when you remove 'display: none', you check if cis:auto is there and either clear the last remembered size or not/ <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 <fantasai> emilio: so you go display:none, at ResizeObserver time we dont' know what to do because don't have a box <fantasai> emilio: if when you come back, you need to check cis:auto <fantasai> TabAtkins: that seems fine to me <fantasai> emilio: It's weird to update this in different places <fantasai> TabAtkins: I also think it's weird to do that, but it's apparently problematic to do it while display is none <fantasai> TabAtkins: So we check for cis:auto when the element begins generating a principal box again <fantasai> TabAtkins: if it doesn't ahve cis:auto at that point, forget its last remembered size <fantasai> emilio: yeah, ok <fantasai> TabAtkins: if you're doing anything weird switching cis while you're display:none it's your fault <fantasai> emilio: consider CQ, might flip things dpeneding on container <fantasai> emilio: if you're already compute CQ, you may need to create a box for asize that isn't your final one <fantasai> emilio: you may clear the remembere dsize, <fantasai> emilio: ... <fantasai> TabAtkins: why would you clear it at that point <fantasai> emilio: imagine without CQ matching, you don't have cis:auto <fantasai> emilio: and once you know that you have a container of a given size, the box gets cis:auto <fantasai> TabAtkins: easiest solution is to put cis:auto less conditionally <fantasai> emilio: yes, I agree, but its a sketchy case <fantasai> emilio: because it depends on how precisely you implement queries <fantasai> TabAtkins: I think it's okay <fantasai> TabAtkins: it seems ok for it to be less certain <fantasai> TabAtkins: there's an easy solution: don't make it conditional in your styles <fantasai> TabAtkins: so proposed resolution is that we add new condition to forget last remembered size <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 <fantasai> oriol: and ??? <fantasai> Rossen_: any objections to first one? <emilio> s/???/for storing the size the element should have a box <TabAtkins> s/???/and only storing the size if it has a principal box/ <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 <fantasai> s/REOSLV/RESOLV/ <fantasai> TabAtkins: if an element doesn't have a principal box, we do not record a principal size <fantasai> RESOLVED: If an element doesn't have a principal box, we do not record a last remembered size <fantasai> Rossen_: anything else on this issue? <fantasai> oriol: nope |
https://drafts.csswg.org/css-sizing-4/#last-remembered
It's unclear what happens if there is no principal box.
There is a note below which says that the last remembered size survives
display: none
, so I guess it's just not recorded:The text was updated successfully, but these errors were encountered: