Bug 1232577 part 19 - Move ClearIsRunningOnCompositor to EffectCompositor; r=heycam

This commit is contained in:
Brian Birtles 2016-01-13 07:54:56 +09:00
Родитель 7236a7fdbd
Коммит d549991eb2
6 изменённых файлов: 23 добавлений и 32 удалений

Просмотреть файл

@ -377,6 +377,20 @@ EffectCompositor::GetAnimationsForCompositor(const nsIFrame* aFrame,
return result;
}
/* static */ void
EffectCompositor::ClearIsRunningOnCompositor(const nsIFrame *aFrame,
nsCSSProperty aProperty)
{
EffectSet* effects = EffectSet::GetEffectSet(aFrame);
if (!effects) {
return;
}
for (KeyframeEffectReadOnly* effect : *effects) {
effect->SetIsRunningOnCompositor(aProperty, false);
}
}
/* static */ void
EffectCompositor::MaybeUpdateCascadeResults(Element* aElement,
nsCSSPseudoElements::Type

Просмотреть файл

@ -130,6 +130,8 @@ public:
GetAnimationsForCompositor(const nsIFrame* aFrame,
nsCSSProperty aProperty);
static void ClearIsRunningOnCompositor(const nsIFrame* aFrame,
nsCSSProperty aProperty);
// Update animation cascade results for the specified (pseudo-)element
// but only if we have marked the cascade as needing an update due a

Просмотреть файл

@ -265,10 +265,7 @@ FrameLayerBuilder::DisplayItemData::ClearAnimationCompositorState()
for (nsIFrame* frame : mFrameList) {
nsCSSProperty prop = mDisplayItemKey == nsDisplayItem::TYPE_TRANSFORM ?
eCSSProperty_transform : eCSSProperty_opacity;
frame->PresContext()->AnimationManager()->
ClearIsRunningOnCompositor(frame, prop);
frame->PresContext()->TransitionManager()->
ClearIsRunningOnCompositor(frame, prop);
EffectCompositor::ClearIsRunningOnCompositor(frame, prop);
}
}

Просмотреть файл

@ -47,8 +47,6 @@
#include "nsSVGElement.h"
#include "nsSVGClipPathFrame.h"
#include "GeckoProfiler.h"
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
#include "nsViewManager.h"
#include "ImageLayers.h"
#include "ImageContainer.h"
@ -526,11 +524,7 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
RestyleManager::GetAnimationGenerationForFrame(aFrame);
aLayer->SetAnimationGeneration(animationGeneration);
nsPresContext* presContext = aFrame->PresContext();
presContext->TransitionManager()->ClearIsRunningOnCompositor(aFrame,
aProperty);
presContext->AnimationManager()->ClearIsRunningOnCompositor(aFrame,
aProperty);
EffectCompositor::ClearIsRunningOnCompositor(aFrame, aProperty);
nsTArray<RefPtr<dom::Animation>> compositorAnimations =
EffectCompositor::GetAnimationsForCompositor(aFrame, aProperty);
if (compositorAnimations.IsEmpty()) {
@ -541,14 +535,14 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
// Do this check only during layer construction; during updating the
// caller is required to check it appropriately.
if (aItem && !aItem->CanUseAsyncAnimations(aBuilder)) {
// AnimationManager or TransitionManager need to know that we refused to
// run this animation asynchronously so that they will not throttle the
// main thread animation.
// EffectCompositor needs to know that we refused to run this animation
// asynchronously so that it will not throttle the main thread
// animation.
aFrame->Properties().Set(nsIFrame::RefusedAsyncAnimationProperty(),
reinterpret_cast<void*>(intptr_t(true)));
// We need to schedule another refresh driver run so that AnimationManager
// or TransitionManager get a chance to unthrottle the animation.
// We need to schedule another refresh driver run so that EffectCompositor
// gets a chance to unthrottle the animation.
aFrame->SchedulePaint();
return;
}

Просмотреть файл

@ -269,20 +269,6 @@ CommonAnimationManager::ExtractComputedValueForTransition(
return result;
}
void
CommonAnimationManager::ClearIsRunningOnCompositor(const nsIFrame* aFrame,
nsCSSProperty aProperty)
{
EffectSet* effects = EffectSet::GetEffectSet(aFrame);
if (!effects) {
return;
}
for (KeyframeEffectReadOnly* effect : *effects) {
effect->SetIsRunningOnCompositor(aProperty, false);
}
}
/*static*/ nsString
AnimationCollection::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
{

Просмотреть файл

@ -112,8 +112,6 @@ public:
AnimationCollection*
GetAnimationCollection(const nsIFrame* aFrame);
void ClearIsRunningOnCompositor(const nsIFrame *aFrame,
nsCSSProperty aProperty);
protected:
LinkedList<AnimationCollection> mElementCollections;
nsPresContext *mPresContext; // weak (non-null from ctor to Disconnect)