Bug 1361183 - Check Element::MayHaveAnimations() in EffectSet::GetEffectSet(). r?birtles
We can early return to call MayHaveAnimations() (and it should be fast) since
we set the flag in EffectSet::GetOrCreateEffectSet(),
MozReview-Commit-ID: 2UfWVVi6nY5
--- a/dom/animation/EffectSet.cpp
+++ b/dom/animation/EffectSet.cpp
@@ -37,34 +37,34 @@ EffectSet::Traverse(nsCycleCollectionTra
"EffectSet::mEffects[]", aCallback.Flags());
}
}
/* static */ EffectSet*
EffectSet::GetEffectSet(const dom::Element* aElement,
CSSPseudoElementType aPseudoType)
{
+ if (!aElement->MayHaveAnimations()) {
+ return nullptr;
+ }
+
nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
return static_cast<EffectSet*>(aElement->GetProperty(propName));
}
/* static */ EffectSet*
EffectSet::GetEffectSet(const nsIFrame* aFrame)
{
Maybe<NonOwningAnimationTarget> target =
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
if (!target) {
return nullptr;
}
- if (!target->mElement->MayHaveAnimations()) {
- return nullptr;
- }
-
return GetEffectSet(target->mElement, target->mPseudoType);
}
/* static */ EffectSet*
EffectSet::GetOrCreateEffectSet(dom::Element* aElement,
CSSPseudoElementType aPseudoType)
{
EffectSet* effectSet = GetEffectSet(aElement, aPseudoType);