[css-sizing-4] Clarify spec about when elements are allowed to not have a last remembered size · Issue #6220 · w3c/csswg-drafts (original) (raw)

Currently css-sizing-4 section 5.2.1 "Last Remembered Size" says:

An element might not have a last remembered size, if it has never been rendered without size containment. (In this case, it will instead use the fallback value provided along with auto.)

This statement logically implies that its contrapositive must hold, i.e. it seems to be saying: "If an element has ever been rendered without size containment, then it must have a last remembered size".

I'm not sure that we want to require this, though. Consider e.g. these scenarios:

(1) an element is rendered, and then becomes display:none (losing its css boxes). And then it gains contain:size, and then loses display:none (e.g. going back to display:block). Do we want to require (or imply) that its last-rendered-size should survive this process?

(2) an element is rendered (gaining a Last Remembered Size), and then gains contain:size, and then has its display value changed in a slightly-less-destructive way (e.g. from display:inline to display:grid). Do we want to require/imply that its last-rendered-size should survive this process?

(3) an element is rendered, and then gains contain:size, and then is reparented to somewhere completely different in the DOM tree. Do we want to require (or imply) that this element's last remembered size must survive this process?

In all three of these cases, the element has previously been rendered without size containment, so the spec's caveat about "an element might not have a last rendered size..." seems not to apply, i.e. it seems like the spec assumes that the element would have a last rendered size. But I'm not sure if that's intentional or not.

(Put another way: is the intent here that the last-rendered-size is something attached to the node, or something attached to the CSS box?)