diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index be40d84fe69b..e62456041c15 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -132,6 +132,23 @@ KeyframeEffectReadOnly::SetTiming(const AnimationTiming& aTiming) // update our registration with the target element. } +void +KeyframeEffectReadOnly::NotifyAnimationTimingUpdated() +{ + UpdateTargetRegistration(); + + // If the effect is not relevant it will be removed from the target + // element's effect set. However, effects not in the effect set + // will not be included in the set of candidate effects for running on + // the compositor and hence they won't have their compositor status + // updated. As a result, we need to make sure we clear their compositor + // status here. + bool isRelevant = mAnimation && mAnimation->IsRelevant(); + if (!isRelevant) { + ResetIsRunningOnCompositor(); + } +} + Nullable KeyframeEffectReadOnly::GetLocalTime() const { @@ -533,10 +550,6 @@ KeyframeEffectReadOnly::UpdateTargetRegistration() if (effectSet) { effectSet->RemoveEffect(*this); } - // Any effects not in the effect set will not be included in the set of - // candidate effects for running on the compositor and hence they won't - // have their compositor status updated so we should do that now. - ResetIsRunningOnCompositor(); } } diff --git a/dom/animation/KeyframeEffect.h b/dom/animation/KeyframeEffect.h index 8fe3d4f3401f..35685d0ef2f8 100644 --- a/dom/animation/KeyframeEffect.h +++ b/dom/animation/KeyframeEffect.h @@ -229,7 +229,7 @@ public: const AnimationTiming& Timing() const { return mTiming; } AnimationTiming& Timing() { return mTiming; } void SetTiming(const AnimationTiming& aTiming); - void NotifyAnimationTimingUpdated() { UpdateTargetRegistration(); } + void NotifyAnimationTimingUpdated(); Nullable GetLocalTime() const;