Re: [csswg-drafts] [css-contain-2] content-visibility should pause css animations in subtree (#5611)

> The goal of this proposal is to not tick animations when they are under a content-visibility hidden subtree in order to avoid doing work in such subtrees. AFAIK the only observable effect of this is that animations would not start/end in a hidden subtree unless the update is somehow forced.

Yes. Also, iteration events would not fire.

> Is it feasible for us to add leeway for the implementations by saying something like "the user-agent _may_ not process animations updates while the contents are under a hidden subtree". I think that would leave room for us to do the updates when updates are forced but also allow the optimization? I know this is a weaker language but it seems hard to specify exact behavior under all situations.

I wonder if we need the more vague language. Could we just say the UA doesn't update animations unless forced?

CSS transitions has the following text:

> Various things can cause the computed values of properties on an element to change. These include insertion and removal of elements from the document tree (which both changes whether those elements have computed values and can change the styles of other elements through selector matching), changes to the document tree that cause changes to which selectors match elements, changes to style sheets or style attributes, and other things. This specification does not define when computed values are updated, beyond saying that implementations must not use, present, or display something resulting from the CSS cascading, value computation, and inheritance process [CSS3CASCADE] without updating the computed value (which means merely that implementations cannot avoid meeting requirements of this specification by claiming not to have updated the computed value as part of handling a style change). However, when an implementation updates the computed value of a property on an element to reflect one of these changes, or computes the computed value of a property on an element newly added to the document, it must update the computed value for all properties and elements to reflect all of these changes at the same time (or at least it must be undetectable that it was done at a different time). This processing of a set of simultaneous style changes is called a style change event. (Implementations typically have a style change event to correspond with their desired screen refresh rate, and when up-to-date computed style or layout information is needed for a script API that depends on it.) 

In keeping with that, we don't need to define _when_ style must be updated. So could we say that animations in `content-visibility: hidden` subtrees are not updated unless required (e.g. by triggering some API whose result is based on up-to-date style information for some element in a `content-visibility: hidden` subtree)?

> One other issue I ran into is that it's not trivial for us to do these updates when we getAnimations with subtree: true. This is because the subtree may or may not have content-visibility elements in it. Without first finding that out, we can't force the update on those elements easily. This is a bit of an implementation difficulty in Blink, but I think depending on the spec language we decide to use here, it may be necessary.

I'm not sure how this would be implemented in Gecko (@emilio would likely know) so I can't comment on if this is an engine-specific concern or something all engines are likely to encounter.

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


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

Received on Monday, 23 November 2020 02:55:38 UTC