Bug 1067769 - Part 11: Implement animation mutation observer while setting the target. r=birtles draft
authorBoris Chiou <boris.chiou@gmail.com>
Thu, 28 Apr 2016 23:22:43 +0800
changeset 357397 a93b08d48769c1e73fccb420553b41d06fbc8e16
parent 357396 ffc006c67d5b0dd712c4d7d3f938c37b8167ad58
child 357398 7ef6e5d70104942b21671e2143c107e678f400a7
push id16759
push userbchiou@mozilla.com
push dateThu, 28 Apr 2016 15:27:13 +0000
reviewersbirtles
bugs1067769
milestone49.0a1
Bug 1067769 - Part 11: Implement animation mutation observer while setting the target. r=birtles MozReview-Commit-ID: EjgbslUwPKw
dom/animation/KeyframeEffect.cpp
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -1413,25 +1413,35 @@ KeyframeEffect::SetTarget(const Nullable
   }
 
   if (mTarget) {
     UnregisterTarget();
     ResetIsRunningOnCompositor();
     ResetWinsInCascade();
 
     RequestRestyle(EffectCompositor::RestyleType::Layer);
+
+    nsAutoAnimationMutationBatch mb(mTarget->mElement->OwnerDoc());
+    if (mAnimation) {
+      nsNodeUtils::AnimationRemoved(mAnimation);
+    }
   }
 
   mTarget = newTarget;
 
   if (mTarget) {
     UpdateTargetRegistration();
     MaybeUpdateProperties();
 
     RequestRestyle(EffectCompositor::RestyleType::Layer);
+
+    nsAutoAnimationMutationBatch mb(mTarget->mElement->OwnerDoc());
+    if (mAnimation) {
+      nsNodeUtils::AnimationAdded(mAnimation);
+    }
   }
 }
 
 KeyframeEffect::~KeyframeEffect()
 {
   // mTiming is cycle collected, so we have to do null check first even though
   // mTiming shouldn't be null during the lifetime of KeyframeEffect.
   if (mTiming) {