W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

[csswg-drafts] [css-sizing-4][css-contain-2] Revisiting auto-sizing when size-containment applies (#5668)

From: vmpstr via GitHub <sysbot+gh@w3.org>
Date: Tue, 27 Oct 2020 14:48:54 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-730522054-1603810133-sysbot+gh@w3.org>
vmpstr has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-sizing-4][css-contain-2] Revisiting auto-sizing when size-containment applies ==
The [`content-visibility: auto`](https://www.w3.org/TR/css-contain-2/#content-visibility) value causes the user agent to apply [size-containment](https://www.w3.org/TR/css-contain-2/#containment-size) under certain conditions (generally, when content is outside of the viewport)

There is also another property that was added, [`contain-intrinsic-size`](https://www.w3.org/TR/css-sizing-4/#intrinsic-size-override), which helps with adoption of `content-visibility: auto`. It allows the developer to specify a "placeholder" size when size-containment is present. 

One undesired effect of content-visibility: auto is that the scrollbar thumb tends to jump around when content enters and exits the visibility region. This is due to the fact that we keep adding and removing size containment in order for us to optimize rendering of skipped content. The contain-intrinsic-size property helps, but the size still keeps changing between the "real" intrinsic size and `contain-intrinsic-size` placeholder. The two sizes are frequently different.

My proposal is that we consider adding another value for `contain-intrinsic-size`, which would use known intrinsic size _at the time size containment was last added_, with a fallback value if size containment was present before the initial layout of the contents. It would basically freeze the intrinsic size when containment is added and use that.

The syntax would be something like the following:
`contain-intrinsic-size: auto 0 auto 100px`
which would mean:
* If size containment was present before the initial layout of the contents, then this is the same as `contain-intrinsic-size: 0 100px`
* If size containment was added after the initial layout of contents, then this is the same as the intrinsic size of contents at the time that size containment was last added

For context, this is similar to a previous proposal, which was rejected: https://github.com/w3c/csswg-drafts/issues/1043.
I think this proposal is sufficiently different in that we already have the "use this (intrinsic) size when size containment is present" property. The addition is just to prefer using the real intrinsic size if it is available at the time size containment applies.

One con of the approach is that the timing of when to measure intrinsic size isn't clear. When size containment applies, we should read off the last computed intrinsic size. However, this value could be different depending on when the UA decides to update the intrinsic size. So this may cause some observable implementation differences.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5668 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 27 October 2020 14:48:56 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:21 UTC