Bug 1361183 - Check Element::MayHaveAnimations() in EffectSet::GetEffectSet(). r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 02 May 2017 07:25:50 +0900
changeset 570991 55cc7bfa477c1db184d6d5e5984d54f4a74c1073
parent 570775 5278e2a35fc8f2be390243db1e62858bf0982055
child 626646 b3a632884c5da3d262dd495ab87737154ef32dc2
push id56658
push userhikezoe@mozilla.com
push dateMon, 01 May 2017 22:26:07 +0000
reviewersbirtles
bugs1361183
milestone55.0a1
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
dom/animation/EffectSet.cpp
--- 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);