Bug 1063384 - Make RestyleTracker::DoProcessRestyle's restylesToProcess not have an mDescendants array in each element. r=dbaron
authorCameron McCormack <cam@mcc.id.au>
Fri, 19 Sep 2014 11:12:30 +1000
changeset 206122 4738068430a9d734e2c70ccf7b0a052e09623568
parent 206121 79b97ca88f5fbba7ab51697d382c833f93f954f8
child 206123 f481cfe4478372513eb50f681e90fc5fa834f5ee
push id27513
push usercbook@mozilla.com
push dateFri, 19 Sep 2014 12:15:35 +0000
treeherdermozilla-central@dadafedc0760 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1063384
milestone35.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 1063384 - Make RestyleTracker::DoProcessRestyle's restylesToProcess not have an mDescendants array in each element. r=dbaron
layout/base/RestyleTracker.cpp
layout/base/RestyleTracker.h
--- a/layout/base/RestyleTracker.cpp
+++ b/layout/base/RestyleTracker.cpp
@@ -44,19 +44,23 @@ CollectLaterSiblings(nsISupports* aEleme
       element->HasFlag(collector->tracker->RestyleBit()) &&
       (aData->mRestyleHint & eRestyle_LaterSiblings)) {
     collector->elements->AppendElement(element);
   }
 
   return PL_DHASH_NEXT;
 }
 
+struct RestyleEnumerateData : RestyleTracker::Hints {
+  nsRefPtr<dom::Element> mElement;
+};
+
 struct RestyleCollector {
   RestyleTracker* tracker;
-  RestyleTracker::RestyleEnumerateData** restyleArrayPtr;
+  RestyleEnumerateData** restyleArrayPtr;
 };
 
 static PLDHashOperator
 CollectRestyles(nsISupports* aElement,
                 nsAutoPtr<RestyleTracker::RestyleData>& aData,
                 void* aRestyleCollector)
 {
   dom::Element* element =
@@ -86,20 +90,18 @@ CollectRestyles(nsISupports* aElement,
                (aData->mChangeHint & nsChangeHint_ReconstructFrame),
                "Why did this not get handled while processing mRestyleRoots?");
 
   // Unset the restyle bits now, so if they get readded later as we
   // process we won't clobber that adding of the bit.
   element->UnsetFlags(collector->tracker->RestyleBit() |
                       collector->tracker->RootBit());
 
-  RestyleTracker::RestyleEnumerateData** restyleArrayPtr =
-    collector->restyleArrayPtr;
-  RestyleTracker::RestyleEnumerateData* currentRestyle =
-    *restyleArrayPtr;
+  RestyleEnumerateData** restyleArrayPtr = collector->restyleArrayPtr;
+  RestyleEnumerateData* currentRestyle = *restyleArrayPtr;
   currentRestyle->mElement = element;
   currentRestyle->mRestyleHint = aData->mRestyleHint;
   currentRestyle->mChangeHint = aData->mChangeHint;
 
   // Increment to the next slot in the array
   *restyleArrayPtr = currentRestyle + 1;
 
   return PL_DHASH_NEXT;
@@ -226,18 +228,16 @@ RestyleTracker::DoProcessRestyles()
       mPendingRestyles.Clear();
 
       for (RestyleEnumerateData* currentRestyle = restylesToProcess;
            currentRestyle != lastRestyle;
            ++currentRestyle) {
         ProcessOneRestyle(currentRestyle->mElement,
                           currentRestyle->mRestyleHint,
                           currentRestyle->mChangeHint);
-
-        MOZ_ASSERT(currentRestyle->mDescendants.IsEmpty());
       }
     }
   }
 
   mRestyleManager->EndProcessingRestyles();
 }
 
 bool
--- a/layout/base/RestyleTracker.h
+++ b/layout/base/RestyleTracker.h
@@ -282,30 +282,32 @@ public:
     return mRestyleBits & ELEMENT_PENDING_RESTYLE_FLAGS;
   }
 
   // Return our ELEMENT_IS_POTENTIAL_(ANIMATION_)RESTYLE_ROOT bit
   Element::FlagsType RootBit() const {
     return mRestyleBits & ~ELEMENT_PENDING_RESTYLE_FLAGS;
   }
 
-  struct RestyleData {
+  struct Hints {
+    nsRestyleHint mRestyleHint;       // What we want to restyle
+    nsChangeHint mChangeHint;         // The minimal change hint for "self"
+  };
+
+  struct RestyleData : Hints {
     RestyleData() {
       mRestyleHint = nsRestyleHint(0);
       mChangeHint = NS_STYLE_HINT_NONE;
     }
 
     RestyleData(nsRestyleHint aRestyleHint, nsChangeHint aChangeHint) {
       mRestyleHint = aRestyleHint;
       mChangeHint = aChangeHint;
     }
 
-    nsRestyleHint mRestyleHint;       // What we want to restyle
-    nsChangeHint mChangeHint;         // The minimal change hint for "self"
-
     // Descendant elements we must check that we ended up restyling, ordered
     // with the same invariant as mRestyleRoots.  The elements here are those
     // that we called AddPendingRestyle for and found the element this is
     // the RestyleData for as its nearest restyle root.
     nsTArray<nsRefPtr<Element>> mDescendants;
   };
 
   /**
@@ -335,20 +337,16 @@ public:
   void AddRestyleRootsIfAwaitingRestyle(
                                   const nsTArray<nsRefPtr<Element>>& aElements);
 
   /**
    * The document we're associated with.
    */
   inline nsIDocument* Document() const;
 
-  struct RestyleEnumerateData : public RestyleData {
-    nsRefPtr<Element> mElement;
-  };
-
 private:
   bool AddPendingRestyleToTable(Element* aElement, nsRestyleHint aRestyleHint,
                                 nsChangeHint aMinChangeHint);
 
   /**
    * Handle a single mPendingRestyles entry.  aRestyleHint must not
    * include eRestyle_LaterSiblings; that needs to be dealt with
    * before calling this function.