w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.44k stars 657 forks source link

[css-sizing] Is the last remembered size recorded if there is size containment in a single axis? #7529

Open Loirooriol opened 2 years ago

Loirooriol commented 2 years ago

From https://drafts.csswg.org/css-sizing-4/#last-remembered

At the time that ResizeObserver events are determined and delivered, if an element has contain-intrinsic-size: auto, is capable of being a ResizeObserver target, but does not have size containment, record the current inner dimensions of its principal box as its last remembered size.

What if the element has contain: inline-size?

css-meeting-bot commented 2 years ago

The CSS Working Group just discussed Is last-remembered size recorded if size containment in single axis?, and agreed to the following:

The full IRC log of that discussion <fantasai> Subtopic: Is last-remembered size recorded if size containment in single axis?
<fantasai> github: https://github.com/w3c/csswg-drafts/issues/7529
<fantasai> oriol: we are only storing last remembered size if there's not size containment
<fantasai> oriol: however, in newer specs of css-contain, we may have size containment in a single axis
<fantasai> oriol: what happens?
<fantasai> oriol: Are we still storing both width and height of last remembered size?
<fantasai> oriol: do we not update last remembered size in the uncontained axis?
<fantasai> oriol: shoudl we check at least one of the axes has size containment and then store both?
<fantasai> oriol: how should this work exactly?
<fantasai> TabAtkins: this is a very good question
<fantasai> Rossen_: do you have a proposal, Oriol?
<fantasai> oriol: maybe would feel more natural to me to do independently rather than together
<fantasai> oriol: right now Chromium stores together
<TabAtkins> q+
<flackr> q+
<fantasai> oriol: I don't have a strong opinion
<Rossen_> ack TabAtkins
<fantasai> TabAtkins: I think I lean toward tracking them together, just because say you have a set width and you have a contained block size
<fantasai> TabAtkins: whatever block size you want to remember, that depends on your width
<fantasai> TabAtkins: if you end up with a different width, your height is not going to be very meaningful
<fantasai> TabAtkins: it's weird to expect a different width also
<fantasai> TabAtkins: but I feel either record both or record neither
<fantasai> TabAtkins: and you need to have containment to get sizing to trigger
<fantasai> flackr: I was going to suggest the opposite
<Rossen_> ack flackr
<fantasai> flackr: reason beign that the only way that you have containment in one axis by it being an explicit style, whereas containment in both axes is because of content-visiblity and being off-screen
<fantasai> flackr: if the developer, while on screen, has containment in one axis
<fantasai> flackr: then it should ??? last remembered size when it goes off screen
<fantasai> Rossen_: that's a compelling argument
<fantasai> TabAtkins: that seems reasonable
<fantasai> Rossen_: sounds like we're approaching a resolution
<fantasai> Rossen_: proposed resolution is that we'll keep them separate, and store them separate
<fantasai> Rossen_: any objections?
<flackr> s/???/store the
<TabAtkins> RESOLVED: "last remembered size" is tracked for the two axises independently (in case of containment in one axis), and can be invoked independently (with c-i-s:auto in one axis)
vmpstr commented 2 years ago

To clarify, I think the minutes and the discussion don't quite match the resolution. I believe that we have decided that contain-intrinsic-size auto records last remembered size (both width and height) even if size containment is set in one of the two dimensions. Is my understanding correct?

The resolution seems to imply that we should not record it for one dimension size containment, since that would be the only reason to record the axes separately, but it doesn't explicitly say whether or not to record the dimension that is contained

Loirooriol commented 2 years ago

My understanding is that we decided to only record the one that has contain-intrinsic-size: auto but not the other.

Loirooriol commented 1 year ago

7807 resolved to update the last remembered size if the element doesn't skip its contents, even if it has size containment. So contain: inline-size is no longer relevant, and it's not possible to only skip contents in one axis.

It's still possible to have contain-intrinsic-size set to auto in only one axis, though.