From d263e17945d35728ec114dc6f3d2355d3188214a Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Mon, 17 Aug 2015 13:59:44 +0900 Subject: [PATCH] Bug 1188251 part 7 - Move WillRefresh to CommonAnimationManager; r=dholbert nsTransitionManager::WillRefresh and nsAnimationManager::WillRefresh are now identical and all methods they call exist on CommonAnimationManager so we can unify them there. --- layout/style/AnimationCommon.cpp | 18 ++++++++++++++++++ layout/style/AnimationCommon.h | 3 +++ layout/style/nsAnimationManager.cpp | 18 ------------------ layout/style/nsAnimationManager.h | 3 --- layout/style/nsTransitionManager.cpp | 18 ------------------ layout/style/nsTransitionManager.h | 3 --- 6 files changed, 21 insertions(+), 42 deletions(-) diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index 156b21735f6c..ca54daed73d9 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -466,6 +466,24 @@ CommonAnimationManager::LayerAnimationRecordFor(nsCSSProperty aProperty) return nullptr; } +/* virtual */ void +CommonAnimationManager::WillRefresh(TimeStamp aTime) +{ + MOZ_ASSERT(mPresContext, + "refresh driver should not notify additional observers " + "after pres context has been destroyed"); + if (!mPresContext->GetPresShell()) { + // Someone might be keeping mPresContext alive past the point + // where it has been torn down; don't bother doing anything in + // this case. But do get rid of all our animations so we stop + // triggering refreshes. + RemoveAllElementCollections(); + return; + } + + FlushAnimations(Can_Throttle); +} + #ifdef DEBUG /* static */ void CommonAnimationManager::Initialize() diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 064056338d7d..fb4e136df4ad 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -62,6 +62,9 @@ public: virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE override; + // nsARefreshObserver + void WillRefresh(TimeStamp aTime) override; + #ifdef DEBUG static void Initialize(); #endif diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 5df587d7b6d5..08dfac44e2b4 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -939,21 +939,3 @@ nsAnimationManager::UpdateCascadeResults( aElementAnimations->mStyleRuleRefreshTime = TimeStamp(); } } - -/* virtual */ void -nsAnimationManager::WillRefresh(mozilla::TimeStamp aTime) -{ - MOZ_ASSERT(mPresContext, - "refresh driver should not notify additional observers " - "after pres context has been destroyed"); - if (!mPresContext->GetPresShell()) { - // Someone might be keeping mPresContext alive past the point - // where it has been torn down; don't bother doing anything in - // this case. But do get rid of all our transitions so we stop - // triggering refreshes. - RemoveAllElementCollections(); - return; - } - - FlushAnimations(Can_Throttle); -} diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index 307f6c99e33c..2c6a1a9c4292 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -255,9 +255,6 @@ public: virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE override; - // nsARefreshObserver - virtual void WillRefresh(mozilla::TimeStamp aTime) override; - /** * Return the style rule that RulesMatching should add for * aStyleContext. This might be different from what RulesMatching diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 17c13070ef04..6a5786f61a12 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -887,21 +887,3 @@ nsTransitionManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); } - -/* virtual */ void -nsTransitionManager::WillRefresh(mozilla::TimeStamp aTime) -{ - MOZ_ASSERT(mPresContext, - "refresh driver should not notify additional observers " - "after pres context has been destroyed"); - if (!mPresContext->GetPresShell()) { - // Someone might be keeping mPresContext alive past the point - // where it has been torn down; don't bother doing anything in - // this case. But do get rid of all our transitions so we stop - // triggering refreshes. - RemoveAllElementCollections(); - return; - } - - FlushAnimations(Can_Throttle); -} diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 6e63ee2fab88..5c3b9910b9a4 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -274,9 +274,6 @@ public: virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_MUST_OVERRIDE override; - // nsARefreshObserver - virtual void WillRefresh(mozilla::TimeStamp aTime) override; - void QueueEvent(mozilla::TransitionEventInfo&& aEventInfo) { mEventDispatcher.QueueEvent(