Open Bug 1421506 Opened 7 years ago Updated 2 years ago

Don't throttle animations if the animating element is referenced by -moz-element even if the animating element is out-of-view

Categories

(Core :: DOM: Animation, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox59 --- affected

People

(Reporter: hiro, Unassigned, Mentored)

References

Details

Attachments

(1 file)

Attached file Example
I heard that there is an interesting usage for -moz-element with animations.

https://github.com/piroor/treestyletab/issues/1384#issuecomment-347729026

Attaching file has three elements referencing animating element via -moz-element.  Also the animating element is scrolled-out, so we don't update animation style unfortunately.
What we need to do here is to check the animating frame is referenced via -moz-element.  We can check it nsINode::HasRenderingObservers() just like we do in FindAnimationsForCompositor() [1].  And if the frame is referenced, we disallow offscreen animation throttling in KeyframeEffectReadOnly::CanThrottle() [2].  A test case would be in dom/animations/mozilla/file_restyles.html.


[1] https://hg.mozilla.org/mozilla-central/file/3acb14b94915/dom/animation/EffectCompositor.cpp#l194
[2] https://hg.mozilla.org/mozilla-central/file/3acb14b94915/dom/animation/KeyframeEffectReadOnly.cpp#l1430
Mentor: hikezoe
CCing Wei-Cheng Pan, he might be interested in this too. :)

It seems like this throttling also occurs when animating masks and clipPaths, even when they are used by on-screen elements. I've built a small demo where you can move the mask in and out of the viewport and observe the difference in behaviour.

https://codepen.io/sdegueldre/pen/poNeNjN

Also note that since masks and clipPaths have a size of 0 by 0, the inspector will always show them at the 0,0 coordinates of the SVG but will take their transform into account for visibility calculations, so a mask or clipPath can be considered offscreen and have their animations throttled even if they are on-screen in the inspector.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: