Bug 1474247 - Call ReschedulePendingtasks when we set a new target to KeyframeEffect. r=birtles
MozReview-Commit-ID: 1n5I6RPKAM5
This commit is contained in:
@@ -958,6 +958,7 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
nsAutoAnimationMutationBatch mb(mTarget->mElement->OwnerDoc());
|
||||
if (mAnimation) {
|
||||
nsNodeUtils::AnimationAdded(mAnimation);
|
||||
mAnimation->ReschedulePendingTasks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,5 +103,20 @@ test(t => {
|
||||
'The animation should be still tracked by tracker');
|
||||
}, 'Setting another target keeps the pending animation in the tracker');
|
||||
|
||||
test(t => {
|
||||
const effect = new KeyframeEffect(null, null);
|
||||
const anim = new Animation(effect);
|
||||
anim.play();
|
||||
assert_false(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The orphaned animation should NOT be tracked by tracker');
|
||||
|
||||
const target = addDiv(t);
|
||||
anim.effect.target = target;
|
||||
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should be now tracked by tracker');
|
||||
}, 'Setting target element to the orphaned animation starts being tracked ' +
|
||||
'by the tracker');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user