Bug 1067769 - Part 11: Implement animation mutation observer while setting the target. r=birtles
MozReview-Commit-ID: EjgbslUwPKw
--- 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) {