Bug 1115812 patch 6 - Move ProcessRestyles from RestyleTracker to RestyleManager. r=heycam
authorL. David Baron <dbaron@dbaron.org>
Tue, 13 Jan 2015 21:03:12 -0800
changeset 250804 ce19dc161a0b5a65eaa0c2c9a0659f3079900146
parent 250803 722bcd3bcbbc3b3ede754045441ac4d3d4f64789
child 250805 716fab262b56c21a04cfb915189a2fff23e81f8c
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1115812
milestone38.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 1115812 patch 6 - Move ProcessRestyles from RestyleTracker to RestyleManager. r=heycam This is needed for the following patch, so that it can access a member variable of RestyleManager.
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/RestyleTracker.h
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1629,17 +1629,17 @@ RestyleManager::ProcessPendingRestyles()
 
   // Until we get rid of these phases in bug 960465, we need to skip
   // animation restyles during the non-animation phase, and post
   // animation restyles so that we restyle those elements again in the
   // animation phase.
   mSkipAnimationRules = true;
   mPostAnimationRestyles = true;
 
-  mPendingRestyles.ProcessRestyles();
+  ProcessRestyles(mPendingRestyles);
 
   mPostAnimationRestyles = false;
   mSkipAnimationRules = false;
 
 #ifdef DEBUG
   uint32_t oldPendingRestyleCount = mPendingRestyles.Count();
 #endif
 
@@ -1648,17 +1648,17 @@ RestyleManager::ProcessPendingRestyles()
   // first set of restyles (e.g., CSS transitions with negative
   // transition-delay), and because we need to immediately
   // restyle-with-animation any just-restyled elements that are
   // mid-transition (since processing the non-animation restyle ignores
   // the running transition so it can check for a new change on the same
   // property, and then posts an immediate animation style change).
   MOZ_ASSERT(!mIsProcessingAnimationStyleChange, "nesting forbidden");
   mIsProcessingAnimationStyleChange = true;
-  mPendingAnimationRestyles.ProcessRestyles();
+  ProcessRestyles(mPendingAnimationRestyles);
   MOZ_ASSERT(mIsProcessingAnimationStyleChange, "nesting forbidden");
   mIsProcessingAnimationStyleChange = false;
 
 #ifdef DEBUG
   mIsProcessingRestyles = false;
 #endif
   NS_POSTCONDITION(mPendingRestyles.Count() == oldPendingRestyleCount,
                    "We should not have posted new non-animation restyles while "
@@ -1718,17 +1718,17 @@ RestyleManager::UpdateOnlyAnimationStyle
 
   // FIXME:  We should have the transition manager and animation manager
   // add only the elements for which animations are currently throttled
   // (i.e., animating on the compositor with main-thread style updates
   // suppressed).
   transitionManager->AddStyleUpdatesTo(tracker);
   animationManager->AddStyleUpdatesTo(tracker);
 
-  tracker.ProcessRestyles();
+  ProcessRestyles(tracker);
 
   transitionManager->SetInAnimationOnlyStyleUpdate(false);
 }
 
 void
 RestyleManager::PostRestyleEventCommon(Element* aElement,
                                        nsRestyleHint aRestyleHint,
                                        nsChangeHint aMinChangeHint,
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -458,16 +458,24 @@ private:
   // Recursively add all the given frame and all children to the tracker.
   void AddSubtreeToOverflowTracker(nsIFrame* aFrame);
 
   // Returns true if this function managed to successfully move a frame, and
   // false if it could not process the position change, and a reflow should
   // be performed instead.
   bool RecomputePosition(nsIFrame* aFrame);
 
+  void ProcessRestyles(RestyleTracker& aRestyleTracker) {
+    // Fast-path the common case (esp. for the animation restyle
+    // tracker) of not having anything to do.
+    if (aRestyleTracker.Count()) {
+      aRestyleTracker.DoProcessRestyles();
+    }
+  }
+
 private:
   nsPresContext* mPresContext; // weak, disconnected in Disconnect
 
   // True if we need to reconstruct the rule tree the next time we
   // process restyles.
   bool mDoRebuildAllStyleData : 1;
   // True if we're currently in the process of reconstructing the rule tree.
   bool mInRebuildAllStyleData : 1;
--- a/layout/base/RestyleTracker.h
+++ b/layout/base/RestyleTracker.h
@@ -265,23 +265,17 @@ public:
    * if the element already had eRestyle_LaterSiblings set on it.
    */
   bool AddPendingRestyle(Element* aElement, nsRestyleHint aRestyleHint,
                          nsChangeHint aMinChangeHint);
 
   /**
    * Process the restyles we've been tracking.
    */
-  void ProcessRestyles() {
-    // Fast-path the common case (esp. for the animation restyle
-    // tracker) of not having anything to do.
-    if (mPendingRestyles.Count()) {
-      DoProcessRestyles();
-    }
-  }
+  void DoProcessRestyles();
 
   // Return our ELEMENT_HAS_PENDING_(ANIMATION_)RESTYLE bit
   uint32_t RestyleBit() const {
     return mRestyleBits & ELEMENT_PENDING_RESTYLE_FLAGS;
   }
 
   // Return our ELEMENT_IS_POTENTIAL_(ANIMATION_)RESTYLE_ROOT bit
   Element::FlagsType RootBit() const {
@@ -357,21 +351,16 @@ private:
    * Handle a single mPendingRestyles entry.  aRestyleHint must not
    * include eRestyle_LaterSiblings; that needs to be dealt with
    * before calling this function.
    */
   inline void ProcessOneRestyle(Element* aElement,
                                 nsRestyleHint aRestyleHint,
                                 nsChangeHint aChangeHint);
 
-  /**
-   * The guts of our restyle processing.
-   */
-  void DoProcessRestyles();
-
   typedef nsClassHashtable<nsISupportsHashKey, RestyleData> PendingRestyleTable;
   typedef nsAutoTArray< nsRefPtr<Element>, 32> RestyleRootArray;
   // Our restyle bits.  These will be a subset of ELEMENT_ALL_RESTYLE_FLAGS, and
   // will include one flag from ELEMENT_PENDING_RESTYLE_FLAGS and one flag
   // that's not in ELEMENT_PENDING_RESTYLE_FLAGS.
   Element::FlagsType mRestyleBits;
   RestyleManager* mRestyleManager; // Owns us
   // A hashtable that maps elements to pointers to RestyleData structs.  The