diff --git a/dom/animation/AnimationPlayer.cpp b/dom/animation/AnimationPlayer.cpp index 98ebf225c70c..625399469a1a 100644 --- a/dom/animation/AnimationPlayer.cpp +++ b/dom/animation/AnimationPlayer.cpp @@ -406,7 +406,7 @@ AnimationPlayer::CanThrottle() const // finishing, we need an unthrottled sample so we can apply the correct // end-of-animation behavior on the main thread (either removing the // animation style or applying the fill mode). - return mIsPreviousStateFinished; + return mFinishedAtLastComposeStyle; } void @@ -462,7 +462,9 @@ AnimationPlayer::ComposeStyle(nsRefPtr& aStyleRule, AutoRestore> restoreHoldTime(mHoldTime); bool updatedHoldTime = false; - if (PlayState() == AnimationPlayState::Pending && + AnimationPlayState playState = PlayState(); + + if (playState == AnimationPlayState::Pending && mHoldTime.IsNull() && !mStartTime.IsNull()) { Nullable timeToUse = mPendingReadyTime; @@ -485,6 +487,8 @@ AnimationPlayer::ComposeStyle(nsRefPtr& aStyleRule, if (updatedHoldTime) { UpdateTiming(); } + + mFinishedAtLastComposeStyle = (playState == AnimationPlayState::Finished); } } diff --git a/dom/animation/AnimationPlayer.h b/dom/animation/AnimationPlayer.h index c5a2b17f8bf5..1ca074383af4 100644 --- a/dom/animation/AnimationPlayer.h +++ b/dom/animation/AnimationPlayer.h @@ -57,6 +57,7 @@ public: , mPendingState(PendingState::NotPending) , mIsRunningOnCompositor(false) , mIsPreviousStateFinished(false) + , mFinishedAtLastComposeStyle(false) , mIsRelevant(false) { } @@ -332,6 +333,7 @@ protected: // Indicates whether we were in the finished state during our // most recent unthrottled sample (our last ComposeStyle call). bool mIsPreviousStateFinished; // Spec calls this "previous finished state" + bool mFinishedAtLastComposeStyle; // Indicates that the animation should be exposed in an element's // getAnimations() list. bool mIsRelevant;