Re: [csswg-drafts] [css-contain-2]: Should the first `contentvisibilityautostatechange` event be fired without knowing if the element is close to the viewport (#9803)

> > According to [2], whether it is [close to the viewport](https://drafts.csswg.org/css-contain/#close-to-the-viewport) could not be determined in at least one frame. Should the first `contentvisibilityautostatechange` event be fired without this value?
> 
> I'm not sure I follow. The proximity to the viewport is determined in one frame. The effect of that on the relevant state may be deferred to the next frame per item 3 and 4 of https://drafts.csswg.org/css-contain/#cv-notes
> 
Yes, true. Take the content-visibility-with-top-layer-008.html in [the Gecko Patch](https://phabricator.services.mozilla.com/D198602) as an example.
If checking `relevant to the user` happens in the same frame, before [close to the viewport](https://drafts.csswg.org/css-contain/#close-to-the-viewport) checking, it will fire an event. Then, in [close to the viewport](https://drafts.csswg.org/css-contain/#close-to-the-viewport) checking, it will fire another event. This could happen, because `inner.getBoundingClientRect().height` triggers layout, and layout could trigger `relevant to the user` checking.

> Perhaps the `contentvisibilityautostatechange` event should fire when the `content-visibility: auto` element starts or stops `skipping its contents` (instead of being `relevant to the user`). This would essentially only change the timing of the event, and it would align to the proposal here to not fire it too eagerly

In Gecko's implementation, the value of `skipping its contents` is not restored, but when needed, checking values of `content-visibility: auto` + `relevant to the user` instead. So this might not work.


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


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

Received on Wednesday, 17 January 2024 17:40:30 UTC