From b46fbc6e5198945c6f23dce1922c177e8d06ded0 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Mon, 20 Oct 2014 13:55:46 +0900 Subject: [PATCH] Bug 1078122 part 2 - Encapsulate mIsRunningOnCompositor in AnimationPlayer; r=dholbert --- dom/animation/AnimationPlayer.h | 9 ++++++--- layout/base/nsDisplayList.cpp | 2 +- layout/style/nsAnimationManager.cpp | 2 +- layout/style/nsTransitionManager.cpp | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dom/animation/AnimationPlayer.h b/dom/animation/AnimationPlayer.h index de652b23956..c4f3ac884e8 100644 --- a/dom/animation/AnimationPlayer.h +++ b/dom/animation/AnimationPlayer.h @@ -35,9 +35,9 @@ protected: public: explicit AnimationPlayer(AnimationTimeline* aTimeline) - : mIsRunningOnCompositor(false) - , mTimeline(aTimeline) + : mTimeline(aTimeline) , mIsPaused(false) + , mIsRunningOnCompositor(false) { } @@ -92,6 +92,9 @@ public: return GetSource() && GetSource()->IsInEffect(); } + void SetIsRunningOnCompositor() { mIsRunningOnCompositor = true; } + void ClearIsRunningOnCompositor() { mIsRunningOnCompositor = false; } + // Returns true if this animation does not currently need to update // style on the main thread (e.g. because it is empty, or is // running on the compositor). @@ -99,7 +102,6 @@ public: // The beginning of the delay period. Nullable mStartTime; // Timeline timescale - bool mIsRunningOnCompositor; nsRefPtr mTimeline; nsRefPtr mSource; @@ -111,6 +113,7 @@ protected: Nullable mHoldTime; // Player timescale bool mIsPaused; + bool mIsRunningOnCompositor; }; } // namespace dom diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index c258b35828d..7f3db0a27fe 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -412,7 +412,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty, continue; } AddAnimationForProperty(aFrame, aProperty, player, aLayer, aData, aPending); - player->mIsRunningOnCompositor = true; + player->SetIsRunningOnCompositor(); } } diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 322a5b7105b..352b991abca 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -311,7 +311,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext, } // Reset compositor state so animation will be re-synchronized. - oldPlayer->mIsRunningOnCompositor = false; + oldPlayer->ClearIsRunningOnCompositor(); // Handle changes in play state. // CSSAnimationPlayer takes care of override behavior so that, diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 20eb9aeea54..19da9324a65 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -834,7 +834,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) } else if ((computedTiming.mPhase == ComputedTiming::AnimationPhase_Active) && canThrottleTick && - !player->mIsRunningOnCompositor) { + !player->IsRunningOnCompositor()) { // Start a transition with a delay where we should start the // transition proper. collection->UpdateAnimationGeneration(mPresContext);