Re: [csswg-drafts] [css-sizing-4] Only apply contain-intrinsic-size: auto with content-visibility: auto (#6308)

The overarching question here is whether `contain-intrinsic-size: auto` remembered size should apply when `content-visibility: hidden` applies. 

From the spec text https://drafts.csswg.org/css-sizing-4/#valdef-contain-intrinsic-width-auto-length

> If the element has a [last remembered size](https://drafts.csswg.org/css-sizing-4/#last-remembered), is currently [skipping its contents](https://drafts.csswg.org/css-contain-2/#skips-its-contents), and is not [relevant to the user](https://drafts.csswg.org/css-contain-2/#relevant-to-the-user), its [explicit intrinsic inner size](https://drafts.csswg.org/css-sizing-4/#explicit-intrinsic-inner-size) is the last remembered size.

For `content-visibility: auto` this statement is clear since relevance to the user also determines whether it skips its contents. So, for example, if the element is on screen then it's relevant and we're not skipping contents. If it's off-screen and no other condition holds, it's not relevant and skips its contents.

However, for `content-visibility: hidden` it poses a performance problem: the element is always skipping its contents, so typically relevance to the user is not determined. The text as written changes that (as @Loirooriol pointed out), since we would now also have to keep track of whether `content-visibility: hidden` element is, among other things, on screen. It is also weird that some state may change based on relevance for this element. 

There's one of two possible fixes:
* remove "and is not [relevant to the user](https://drafts.csswg.org/css-contain-2/#relevant-to-the-user)" condition, which would cause `contain-intrinsic-size: auto` last remembered size to apply to `content-visibility: hidden`, if such a size exists
* make the text explicit by mentioning `content-visibility: auto`. This, along with the other two conditions, would cause `contain-intrinsic-size: auto` to only apply to `content-visibility: auto` and not `hidden`.

I don't have a strong opinion here, but I'm leaning slightly towards making `contain-intrinsic-size: auto` apply to `content-visibility: hidden`. For additional context, the [TAG discussion](https://github.com/w3ctag/design-reviews/issues/624) for this issue was satisfied with the limited case of `content-visibility: auto`, and adding `content-visibility: hidden` here as well may raise additional questions

-- 
GitHub Notification of comment by vmpstr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6308#issuecomment-1191880225 using your GitHub account


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

Received on Thursday, 21 July 2022 20:01:06 UTC