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.
This commit is contained in:
Brian Birtles 2015-08-17 13:59:44 +09:00
parent d65e0109bc
commit d263e17945
6 changed files with 21 additions and 42 deletions

View File

@ -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()

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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(