diff --git a/dom/animation/AnimationPlayer.cpp b/dom/animation/AnimationPlayer.cpp index 0d7686486dab..c2246a3a55ee 100644 --- a/dom/animation/AnimationPlayer.cpp +++ b/dom/animation/AnimationPlayer.cpp @@ -349,7 +349,9 @@ AnimationPlayer::Cancel() bool AnimationPlayer::IsRunning() const { - if (IsPaused() || !GetSource() || GetSource()->IsFinishedTransition()) { + if (IsPausedOrPausing() || + !GetSource() || + GetSource()->IsFinishedTransition()) { return false; } diff --git a/dom/animation/AnimationPlayer.h b/dom/animation/AnimationPlayer.h index 3b07ea9078c4..255f406ed136 100644 --- a/dom/animation/AnimationPlayer.h +++ b/dom/animation/AnimationPlayer.h @@ -191,17 +191,24 @@ public: void Cancel(); - const nsString& Name() const { + const nsString& Name() const + { return mSource ? mSource->Name() : EmptyString(); } - bool IsPaused() const { return PlayState() == AnimationPlayState::Paused; } + bool IsPausedOrPausing() const + { + return PlayState() == AnimationPlayState::Paused || + mPendingState == PendingState::PausePending; + } bool IsRunning() const; - bool HasCurrentSource() const { + bool HasCurrentSource() const + { return GetSource() && GetSource()->IsCurrent(); } - bool HasInEffectSource() const { + bool HasInEffectSource() const + { return GetSource() && GetSource()->IsInEffect(); } diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index fc14eece201b..58f4ba881886 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -348,11 +348,12 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext, // (We should check newPlayer->IsStylePaused() but that requires // downcasting to CSSAnimationPlayer and we happen to know that // newPlayer will only ever be paused by calling PauseFromStyle - // making IsPaused synonymous in this case.) - if (!oldPlayer->IsStylePaused() && newPlayer->IsPaused()) { + // making IsPausedOrPausing synonymous in this case.) + if (!oldPlayer->IsStylePaused() && newPlayer->IsPausedOrPausing()) { oldPlayer->PauseFromStyle(); animationChanged = true; - } else if (oldPlayer->IsStylePaused() && !newPlayer->IsPaused()) { + } else if (oldPlayer->IsStylePaused() && + !newPlayer->IsPausedOrPausing()) { oldPlayer->PlayFromStyle(); animationChanged = true; }