Bug 1334036 - Part 7: Merge two similiar MaybeUpdateCascadeResults functions. r=birtles
authorBoris Chiou <boris.chiou@gmail.com>
Thu, 11 May 2017 13:26:07 +0800
changeset 407878 663f9e058cd385ba83d176dbe679184dcf10a81d
parent 407877 933bece8ce165549c5bc0c1a5964cffd94404c5b
child 407879 3d4a563e33bed51faaf752e19d2d3df761edc8bd
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1334036
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1334036 - Part 7: Merge two similiar MaybeUpdateCascadeResults functions. r=birtles MozReview-Commit-ID: 2NDdQRF3DQ8
dom/animation/EffectCompositor.cpp
dom/animation/EffectCompositor.h
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -668,32 +668,16 @@ EffectCompositor::MaybeUpdateCascadeResu
   }
 
   UpdateCascadeResults(aBackendType, *effects, aElement, aPseudoType,
                        aStyleContext);
 
   MOZ_ASSERT(!effects->CascadeNeedsUpdate(), "Failed to update cascade state");
 }
 
-/* static */ void
-EffectCompositor::MaybeUpdateCascadeResults(dom::Element* aElement,
-                                            CSSPseudoElementType aPseudoType)
-{
-  EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
-  MOZ_ASSERT(effects);
-  if (!effects->CascadeNeedsUpdate()) {
-    return;
-  }
-
-  UpdateCascadeResults(StyleBackendType::Servo, *effects, aElement, aPseudoType,
-                       nullptr);
-
-  MOZ_ASSERT(!effects->CascadeNeedsUpdate(), "Failed to update cascade state");
-}
-
 /* static */ Maybe<NonOwningAnimationTarget>
 EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
 {
   // Always return the same object to benefit from return-value optimization.
   Maybe<NonOwningAnimationTarget> result;
 
   CSSPseudoElementType pseudoType =
     aFrame->StyleContext()->GetPseudoType();
@@ -1036,18 +1020,20 @@ EffectCompositor::PreTraverseInSubtree(E
         continue;
       }
 
       elementsWithCascadeUpdates.AppendElement(target);
     }
   }
 
   for (const NonOwningAnimationTarget& target: elementsWithCascadeUpdates) {
-      MaybeUpdateCascadeResults(target.mElement,
-                                target.mPseudoType);
+      MaybeUpdateCascadeResults(StyleBackendType::Servo,
+                                target.mElement,
+                                target.mPseudoType,
+                                nullptr);
   }
   elementsWithCascadeUpdates.Clear();
 
   for (size_t i = 0; i < kCascadeLevelCount; ++i) {
     CascadeLevel cascadeLevel = CascadeLevel(i);
     auto& elementSet = mElementsToRestyle[cascadeLevel];
     for (auto iter = elementSet.Iter(); !iter.Done(); iter.Next()) {
       const NonOwningAnimationTarget& target = getNeededRestyleTarget(iter);
@@ -1127,17 +1113,19 @@ EffectCompositor::PreTraverse(dom::Eleme
     mPresContext->RestyleManager()->AsServo()->
       PostRestyleEventForAnimations(aElement,
                                     cascadeLevel == CascadeLevel::Transitions
                                       ? eRestyle_CSSTransitions
                                       : eRestyle_CSSAnimations);
 
     EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
     if (effects) {
-      MaybeUpdateCascadeResults(aElement, aPseudoType);
+      MaybeUpdateCascadeResults(StyleBackendType::Servo,
+                                aElement, aPseudoType,
+                                nullptr);
 
       for (KeyframeEffectReadOnly* effect : *effects) {
         effect->GetAnimation()->WillComposeStyle();
       }
     }
 
     elementSet.Remove(key);
     found = true;
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -203,24 +203,16 @@ public:
   // This method does NOT detect if other styles that apply above the
   // animation level of the cascade have changed.
   static void
   MaybeUpdateCascadeResults(StyleBackendType aBackendType,
                             dom::Element* aElement,
                             CSSPseudoElementType aPseudoType,
                             nsStyleContext* aStyleContext);
 
-  // Variant of MaybeUpdateCascadeResults for the Servo backend.
-  // The Servo backend doesn't use an nsStyleContext to get the rule node
-  // to traverse the style tree to find !important rules and instead
-  // gets the rule node from |aElement|.
-  static void
-  MaybeUpdateCascadeResults(dom::Element* aElement,
-                            CSSPseudoElementType aPseudoType);
-
   // Helper to fetch the corresponding element and pseudo-type from a frame.
   //
   // For frames corresponding to pseudo-elements, the returned element is the
   // element on which we store the animations (i.e. the EffectSet and/or
   // AnimationCollection), *not* the generated content.
   //
   // Returns an empty result when a suitable element cannot be found including
   // when the frame represents a pseudo-element on which we do not support