Closed Bug 1235002 Opened 9 years ago Closed 8 years ago

Skip requesting a restyle when mProperties is empty in NotifyAnimationTimingUpdated

Categories

(Core :: DOM: Animation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox46 --- affected
firefox49 --- fixed

People

(Reporter: birtles, Assigned: hiro)

References

Details

Attachments

(2 files)

As of bug 1232563, we no longer skip posting restyles for empty effects in KeyframeEffectReadOnly::NotifyAnimationTimingUpdated.

This is because when we create animations in nsAnimationManager and nsTransitionManager, we'll create the effect, attach it to an animation, play it, then add properties to it. We'll get a call to NotifyAnimationTimingUpdated when we play the animation but we update the properties just by settings the members of the effect directly and not via any method that will know to request a restyle as a result.

We should drop the non-const Properties() method and add a SetProperties in its place. Then in SetProperties we can trigger a layer update.

After doing that, we can re-instate the check for an empty property set before requesting a restyle in NotifyAnimationTimingUpdated.
Blocks: 1242872
I think this bug will be fixed by bug 1260976 and bug 1260655. Right?
Yes, but we still need to:

> re-instate the check for an empty property set before requesting a restyle in NotifyAnimationTimingUpdated.
Depends on: 1260655, 1260976
Summary: Encapsulate property setting on KeyframeEffect and trigger a layer update when they are set → Skip requesting a restyle when mProperties is empty in NotifyAnimationTimingUpdated
I am going to take this, but I have two concerns about test.

1. We don't have any ability to check whether requesting a restyle is processed or skipped for now.
   We can, of course, check restyles but it's already skipped at IsInEfect() check in CanThrottle() because mProgress is null.
2. I am not sure that mProgressOnLastCompose should be nullified when mProperties is empty.

I can write a test case for the second concern here.  The first one will not be resolved soon, it will be a long standing issue.
Assignee: nobody → hiikezoe
(In reply to Hiroyuki Ikezoe (:hiro) from comment #3)
> 2. I am not sure that mProgressOnLastCompose should be nullified when
> mProperties is empty.

It turns out we need to nullify the mProgressOnLastCompose in the case.  I am writing a reftest.
Attached patch A WIP reftestSplinter Review
This is a reftest which fails if we forget nullifying mProgressOnLastCompose in case of mProperties.IsEmpty() in NotifyAnimationTimingUpdated() on *non-E10S*.
(In reply to Hiroyuki Ikezoe (:hiro) from comment #6)
> The reason why attachment 8745189 [details] [diff] [review] does not work on
> E10S is that flushApzRepaints() causes style flush.
> 
> https://hg.mozilla.org/mozilla-central/annotate/
> fc15477ce628599519cb0055f52cc195d640dc94/layout/tools/reftest/reftest-
> content.js#l588

Filed bug 1267908.
Blocks: 1166500
The test case here does not check whether requesting restyles for empty
properties is skipped or not.  It just checks that whether restyles happen or
not because there is no way to check each request for restyles yet.

Review commit: https://reviewboard.mozilla.org/r/49925/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/49925/
Nullifying mProgressOnLastCompose has been handled in bug 1267937.
Depends on: 1267937
Comment on attachment 8747555 [details]
MozReview Request: Bug 1235002 - Skip requesting a restyle when mProperties is empty. r?birtles

I'm guessing you meant to ask for review here but didn't because of the typo.
Attachment #8747555 - Flags: review?(bbirtles)
Thank you, dbaron.  I did not notice the typo at all.
Comment on attachment 8747555 [details]
MozReview Request: Bug 1235002 - Skip requesting a restyle when mProperties is empty. r?birtles

https://reviewboard.mozilla.org/r/49925/#review47955

Thanks!

::: dom/animation/test/chrome/test_restyles.html:453
(Diff revision 1)
> +
> +    yield animation.ready;
> +    var markers = yield observeStyling(5);
> +
> +    is(markers.length, 0,
> +       'Animations which has no keyframes should never cause restyles');

Nit: Animation with no keyframes should not cause restyles

::: dom/animation/test/chrome/test_restyles.html:462
(Diff revision 1)
> +
> +    // There are 5 eRestyle_CSSAnimations and 1 eRestyle_CSSTransitions.
> +    // 1 eRestyle_CSSTransitions comes from
> +    // EffectCompositor::UpdateCascadeResults.
> +    ok(markers.length == 6,
> +       'Setting non-empty frame should cause restyles normally.');

Nit: Setting valid keyframes should cause regular animation restyles to occur.

::: dom/animation/test/chrome/test_restyles.html:468
(Diff revision 1)
> +       'Setting empty frame should cause a restyle to remove the previous ' +
> +       'animated style');

Nit: Setting an empty set of keyframes should trigger a single restyle to remove the previous animated style.
Attachment #8747555 - Flags: review?(bbirtles) → review+
Status: NEW → ASSIGNED
Comment on attachment 8747555 [details]
MozReview Request: Bug 1235002 - Skip requesting a restyle when mProperties is empty. r?birtles

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/49925/diff/1-2/
Attachment #8747555 - Attachment description: MozReview Request: Bug 1235002 - Skip requesting a restyle when mProperties is empty. r?birltes → MozReview Request: Bug 1235002 - Skip requesting a restyle when mProperties is empty. r?birtles
https://hg.mozilla.org/mozilla-central/rev/3740695ca009
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: