Bug 1415780 - Call UpdateTiming() prior to remove the animtion from the timeline in Animation::CancelNoUpdate. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sat, 27 Jan 2018 21:17:27 +0900
changeset 748028 693768f9320ec12ef85b7116e0a55663f9aeb7d7
parent 748027 477bcbf624be4b04f47ec7837331740a95ce4041
child 748029 81158e2e38c65f1becdbb8b68fc2504be2cbdde0
push id97048
push userhikezoe@mozilla.com
push dateSat, 27 Jan 2018 12:23:10 +0000
reviewersbirtles
bugs1415780
milestone60.0a1
Bug 1415780 - Call UpdateTiming() prior to remove the animtion from the timeline in Animation::CancelNoUpdate. r?birtles Now AnimationEventDispatcher ensures that the refresh driver's next tick happens for cancel event, so we don't need to re-observe the timeline (it happens in UpdateTiming) once after removing the animation from the timeline. MozReview-Commit-ID: 7ivclmYIkPa
dom/animation/Animation.cpp
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -799,31 +799,22 @@ Animation::CancelNoUpdate()
 
   StickyTimeDuration activeTime = mEffect
                                   ? mEffect->GetComputedTiming().mActiveTime
                                   : StickyTimeDuration();
 
   mHoldTime.SetNull();
   mStartTime.SetNull();
 
+  UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
+
   if (mTimeline) {
     mTimeline->RemoveAnimation(this);
   }
   MaybeQueueCancelEvent(activeTime);
-
-  // When an animation is cancelled it no longer needs further ticks from the
-  // timeline. However, if we queued a cancel event and this was the last
-  // animation attached to the timeline, the timeline will stop observing the
-  // refresh driver and there may be no subsequent refresh driver tick for
-  // dispatching the queued event.
-  //
-  // By calling UpdateTiming *after* removing ourselves from our timeline, we
-  // ensure the timeline will register with the refresh driver for at least one
-  // more tick.
-  UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
 }
 
 bool
 Animation::ShouldBeSynchronizedWithMainThread(
   nsCSSPropertyID aProperty,
   const nsIFrame* aFrame,
   AnimationPerformanceWarning::Type& aPerformanceWarning) const
 {