зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1232577 part 16 - Move GetAnimationRule to EffectCompositor; r=heycam
This commit is contained in:
Родитель
7a8bb45336
Коммит
309027bbe9
|
@ -242,6 +242,30 @@ EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
|
|||
elementsToRestyle.Remove(key);
|
||||
}
|
||||
|
||||
nsIStyleRule*
|
||||
EffectCompositor::GetAnimationRule(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
CascadeLevel aCascadeLevel)
|
||||
{
|
||||
if (!mPresContext || !mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effectSet) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mPresContext->RestyleManager()->SkipAnimationRules()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeUpdateAnimationRule(aElement, aPseudoType, aCascadeLevel);
|
||||
|
||||
return effectSet->AnimationRule(aCascadeLevel);
|
||||
}
|
||||
|
||||
/* static */ dom::Element*
|
||||
EffectCompositor::GetElementToRestyle(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
class nsCSSPropertySet;
|
||||
class nsIFrame;
|
||||
class nsIStyleRule;
|
||||
class nsPresContext;
|
||||
class nsStyleContext;
|
||||
|
||||
|
@ -109,6 +110,10 @@ public:
|
|||
nsCSSPseudoElements::Type aPseudoType,
|
||||
CascadeLevel aCascadeLevel);
|
||||
|
||||
nsIStyleRule* GetAnimationRule(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
CascadeLevel aCascadeLevel);
|
||||
|
||||
static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
|
||||
nsCSSProperty aProperty);
|
||||
|
||||
|
|
|
@ -172,9 +172,19 @@ CommonAnimationManager::RulesMatching(ElementRuleProcessorData* aData)
|
|||
{
|
||||
MOZ_ASSERT(aData->mPresContext == mPresContext,
|
||||
"pres context mismatch");
|
||||
|
||||
EffectCompositor::CascadeLevel cascadeLevel =
|
||||
IsAnimationManager() ?
|
||||
EffectCompositor::CascadeLevel::Animations :
|
||||
EffectCompositor::CascadeLevel::Transitions;
|
||||
nsCSSPseudoElements::Type pseudoType =
|
||||
nsCSSPseudoElements::ePseudo_NotPseudoElement;
|
||||
|
||||
nsIStyleRule *rule =
|
||||
GetAnimationRule(aData->mElement,
|
||||
nsCSSPseudoElements::ePseudo_NotPseudoElement);
|
||||
mPresContext->EffectCompositor()->GetAnimationRule(aData->mElement,
|
||||
pseudoType,
|
||||
cascadeLevel);
|
||||
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
|
@ -194,7 +204,15 @@ CommonAnimationManager::RulesMatching(PseudoElementRuleProcessorData* aData)
|
|||
// FIXME: Do we really want to be the only thing keeping a
|
||||
// pseudo-element alive? I *think* the non-animation restyle should
|
||||
// handle that, but should add a test.
|
||||
nsIStyleRule *rule = GetAnimationRule(aData->mElement, aData->mPseudoType);
|
||||
|
||||
EffectCompositor::CascadeLevel cascadeLevel =
|
||||
IsAnimationManager() ?
|
||||
EffectCompositor::CascadeLevel::Animations :
|
||||
EffectCompositor::CascadeLevel::Transitions;
|
||||
nsIStyleRule *rule =
|
||||
mPresContext->EffectCompositor()->GetAnimationRule(aData->mElement,
|
||||
aData->mPseudoType,
|
||||
cascadeLevel);
|
||||
if (rule) {
|
||||
aData->mRuleWalker->Forward(rule);
|
||||
aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
|
||||
|
@ -278,50 +296,6 @@ CommonAnimationManager::ExtractComputedValueForTransition(
|
|||
return result;
|
||||
}
|
||||
|
||||
nsIStyleRule*
|
||||
CommonAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType)
|
||||
{
|
||||
MOZ_ASSERT(
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_after,
|
||||
"forbidden pseudo type");
|
||||
|
||||
if (!mPresContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AnimationCollection* collection =
|
||||
GetAnimationCollection(aElement, aPseudoType, false /* aCreateIfNeeded */);
|
||||
if (!collection) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RestyleManager* restyleManager = mPresContext->RestyleManager();
|
||||
if (restyleManager->SkipAnimationRules()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// FIXME: This is not quite right but is only temporary until we move
|
||||
// this method into EffectCompositor.
|
||||
EffectCompositor::CascadeLevel cascadeLevel =
|
||||
IsAnimationManager() ?
|
||||
EffectCompositor::CascadeLevel::Animations :
|
||||
EffectCompositor::CascadeLevel::Transitions;
|
||||
mPresContext->EffectCompositor()->MaybeUpdateAnimationRule(aElement,
|
||||
aPseudoType,
|
||||
cascadeLevel);
|
||||
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effectSet) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return effectSet->AnimationRule(cascadeLevel);
|
||||
}
|
||||
|
||||
void
|
||||
CommonAnimationManager::ClearIsRunningOnCompositor(const nsIFrame* aFrame,
|
||||
nsCSSProperty aProperty)
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIStyleRule;
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -84,9 +83,6 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
nsIStyleRule* GetAnimationRule(dom::Element* aElement,
|
||||
nsCSSPseudoElements::Type aPseudoType);
|
||||
|
||||
static bool ExtractComputedValueForTransition(
|
||||
nsCSSProperty aProperty,
|
||||
nsStyleContext* aStyleContext,
|
||||
|
|
|
@ -552,7 +552,10 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
mPresContext->Document()->SetNeedStyleFlush();
|
||||
}
|
||||
|
||||
return GetAnimationRule(aElement, aStyleContext->GetPseudoType());
|
||||
return mPresContext->EffectCompositor()
|
||||
->GetAnimationRule(aElement,
|
||||
aStyleContext->GetPseudoType(),
|
||||
cascadeLevel);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EnumeratedRange.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
@ -1553,8 +1554,9 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
||||
nsIStyleRule* rule = PresContext()->AnimationManager()->
|
||||
GetAnimationRule(aElement, aPseudoType);
|
||||
nsIStyleRule* rule = PresContext()->EffectCompositor()->
|
||||
GetAnimationRule(aElement, aPseudoType,
|
||||
EffectCompositor::CascadeLevel::Animations);
|
||||
if (rule) {
|
||||
ruleWalker.ForwardOnPossiblyCSSRule(rule);
|
||||
ruleWalker.CurrentNode()->SetIsAnimationRule();
|
||||
|
@ -1566,8 +1568,9 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
|
|||
if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_before ||
|
||||
aPseudoType == nsCSSPseudoElements::ePseudo_after) {
|
||||
nsIStyleRule* rule = PresContext()->TransitionManager()->
|
||||
GetAnimationRule(aElement, aPseudoType);
|
||||
nsIStyleRule* rule = PresContext()->EffectCompositor()->
|
||||
GetAnimationRule(aElement, aPseudoType,
|
||||
EffectCompositor::CascadeLevel::Transitions);
|
||||
if (rule) {
|
||||
ruleWalker.ForwardOnPossiblyCSSRule(rule);
|
||||
ruleWalker.CurrentNode()->SetIsAnimationRule();
|
||||
|
|
Загрузка…
Ссылка в новой задаче