Re: [csswg-drafts] [css-contain] content-visibility: auto visibility check timing needs details (#8542)

It is only the initial observation that has to be synchronous. This is to avoid a flash of "skipped" content for onscreen elements with c-v auto. This does indeed mean that sizes can change and other elements may become intersecting... I'm unsure why this is bad other than the inefficiency it can introduce on some specifically crafted pages. The common case here is one repetition of style/layout.

In Blink, we use IntersectionObserver (internal class) which implements all the same behaviours as the spec for IntersectionObserver with two exceptions: the notification delivery happens synchronously, and the time at which we determine intersections is within the lifecycle (right before ResizeObserver steps). When we get the notification callback, we check if the context it affects has been notified before. (context is a class that implements content visibility logic). If it has been notified, we schedule a new animation frame at which to deliver this notification. If it has not been notified, then we determine the c-v state synchronously and, if the skipped state changed, repeat the lifecycle phases





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


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

Received on Wednesday, 8 March 2023 02:22:31 UTC