Bug 898329 patch 5: Create and use ElementRestyler::mResolvedChild. r=heycam
authorL. David Baron <dbaron@dbaron.org>
Tue, 30 Jul 2013 17:36:11 -0700
changeset 152950 54617e0ac4537af0438cee5f90b308f3bc49769a
parent 152949 b1f2ea65f84646f92ec7da356defd9a26052acc2
child 152951 ac0d803f21120beea7d6d29fc3536d16fa963a3e
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs898329
milestone25.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 898329 patch 5: Create and use ElementRestyler::mResolvedChild. r=heycam
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1924,16 +1924,17 @@ ElementRestyler::ElementRestyler(nsPresC
   , mContent(mFrame->GetContent() ? mFrame->GetContent() : mParentContent)
   , mChangeList(aChangeList)
   , mHintsHandled(NS_SubtractHint(aHintsHandledByAncestors,
                   NS_HintsNotHandledForDescendantsIn(aHintsHandledByAncestors)))
   , mParentFrameHintsNotHandledForDescendants(nsChangeHint(0))
   , mHintsNotHandledForDescendants(nsChangeHint(0))
   , mRestyleTracker(aRestyleTracker)
   , mTreeMatchContext(aTreeMatchContext)
+  , mResolvedChild(nullptr)
   , mDesiredA11yNotifications(eSendAllNotifications)
   , mKidsDesiredA11yNotifications(mDesiredA11yNotifications)
   , mOurA11yNotification(eDontNotify)
   , mVisibleKidsOfHiddenElement(aVisibleKidsOfHiddenElement)
 {
 }
 
 ElementRestyler::ElementRestyler(const ElementRestyler& aParentRestyler,
@@ -1948,16 +1949,17 @@ ElementRestyler::ElementRestyler(const E
   , mChangeList(aParentRestyler.mChangeList)
   , mHintsHandled(NS_SubtractHint(aParentRestyler.mHintsHandled,
                   NS_HintsNotHandledForDescendantsIn(aParentRestyler.mHintsHandled)))
   , mParentFrameHintsNotHandledForDescendants(
       aParentRestyler.mHintsNotHandledForDescendants)
   , mHintsNotHandledForDescendants(nsChangeHint(0))
   , mRestyleTracker(aParentRestyler.mRestyleTracker)
   , mTreeMatchContext(aParentRestyler.mTreeMatchContext)
+  , mResolvedChild(nullptr)
   , mDesiredA11yNotifications(aParentRestyler.mKidsDesiredA11yNotifications)
   , mKidsDesiredA11yNotifications(mDesiredA11yNotifications)
   , mOurA11yNotification(eDontNotify)
   , mVisibleKidsOfHiddenElement(aParentRestyler.mVisibleKidsOfHiddenElement)
 {
   if (aConstructorFlags & FOR_OUT_OF_FLOW_CHILD) {
     mHintsHandled = NS_SubtractHint(mHintsHandled, nsChangeHint_AllReflowHints);
   }
@@ -1976,16 +1978,17 @@ ElementRestyler::ElementRestyler(ParentC
   , mHintsHandled(NS_SubtractHint(aParentRestyler.mHintsHandled,
                   NS_HintsNotHandledForDescendantsIn(aParentRestyler.mHintsHandled)))
   , mParentFrameHintsNotHandledForDescendants(
       // assume the worst
       nsChangeHint_Hints_NotHandledForDescendants)
   , mHintsNotHandledForDescendants(nsChangeHint(0))
   , mRestyleTracker(aParentRestyler.mRestyleTracker)
   , mTreeMatchContext(aParentRestyler.mTreeMatchContext)
+  , mResolvedChild(nullptr)
   , mDesiredA11yNotifications(aParentRestyler.mDesiredA11yNotifications)
   , mKidsDesiredA11yNotifications(mDesiredA11yNotifications)
   , mOurA11yNotification(eDontNotify)
   , mVisibleKidsOfHiddenElement(aParentRestyler.mVisibleKidsOfHiddenElement)
 {
 }
 
 void
@@ -2072,17 +2075,16 @@ ElementRestyler::Restyle(nsRestyleHint a
 
     nsRestyleHint childRestyleHint = aRestyleHint;
 
     if (childRestyleHint == eRestyle_Self) {
       childRestyleHint = nsRestyleHint(0);
     }
 
     nsStyleContext* parentContext;
-    nsIFrame* resolvedChild = nullptr;
     // Get the frame providing the parent style context.  If it is a
     // child, then resolve the provider first.
     nsIFrame* providerFrame = mFrame->GetParentStyleContextFrame();
     bool isChild = providerFrame && providerFrame->GetParent() == mFrame;
     if (!isChild) {
       if (providerFrame)
         parentContext = providerFrame->StyleContext();
       else
@@ -2106,19 +2108,19 @@ ElementRestyler::Restyle(nsRestyleHint a
       ElementRestyler providerRestyler(PARENT_CONTEXT_FROM_CHILD_FRAME,
                                        *this, providerFrame);
       providerRestyler.Restyle(aRestyleHint);
       assumeDifferenceHint = providerRestyler.HintsHandledForFrame();
 
       // The provider's new context becomes the parent context of
       // mFrame's context.
       parentContext = providerFrame->StyleContext();
-      // Set |resolvedChild| so we don't bother resolving the
+      // Set |mResolvedChild| so we don't bother resolving the
       // provider again.
-      resolvedChild = providerFrame;
+      mResolvedChild = providerFrame;
     }
 
     if (providerFrame != mFrame->GetParent()) {
       // We don't actually know what the parent style context's
       // non-inherited hints were, so assume the worst.
       mParentFrameHintsNotHandledForDescendants =
         nsChangeHint_Hints_NotHandledForDescendants;
     }
@@ -2551,17 +2553,17 @@ ElementRestyler::Restyle(nsRestyleHint a
                                    parent && parent->IsElement() ? parent->AsElement() : nullptr);
 
             // only do frames that are in flow
             if (nsGkAtoms::placeholderFrame == child->GetType()) { // placeholder
               // get out of flow frame and recur there
               nsIFrame* outOfFlowFrame =
                 nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
               NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame");
-              NS_ASSERTION(outOfFlowFrame != resolvedChild,
+              NS_ASSERTION(outOfFlowFrame != mResolvedChild,
                            "out-of-flow frame not a true descendant");
 
               // Note that the out-of-flow may not be a geometric descendant of
               // the frame where we started the reresolve.  Therefore, even if
               // mHintsHandled already includes nsChangeHint_AllReflowHints we don't
               // want to pass that on to the out-of-flow reresolve, since that
               // can lead to the out-of-flow not getting reflowed when it should
               // be (eg a reresolve starting at <body> that involves reflowing
@@ -2579,17 +2581,17 @@ ElementRestyler::Restyle(nsRestyleHint a
               } while ((outOfFlowFrame = outOfFlowFrame->GetNextContinuation()));
 
               // reresolve placeholder's context under the same parent
               // as the out-of-flow frame
               ElementRestyler phRestyler(*this, child, 0);
               phRestyler.Restyle(childRestyleHint);
             }
             else {  // regular child frame
-              if (child != resolvedChild) {
+              if (child != mResolvedChild) {
                 ElementRestyler childRestyler(*this, child, 0);
                 childRestyler.Restyle(childRestyleHint);
               }
             }
           }
         }
       }
       // XXX need to do overflow frames???
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -350,16 +350,17 @@ private:
   // need to generate a new change list entry for the frame when its
   // style comparision returns a hint other than one of these hints.
   nsChangeHint mHintsHandled;
   // See nsStyleContext::CalcStyleDifference
   nsChangeHint mParentFrameHintsNotHandledForDescendants;
   nsChangeHint mHintsNotHandledForDescendants;
   RestyleTracker& mRestyleTracker;
   TreeMatchContext& mTreeMatchContext;
+  nsIFrame* mResolvedChild; // child that provides our parent style context
 
   const DesiredA11yNotifications mDesiredA11yNotifications;
   DesiredA11yNotifications mKidsDesiredA11yNotifications;
   A11yNotificationType mOurA11yNotification;
   nsTArray<nsIContent*>& mVisibleKidsOfHiddenElement;
   bool mWasFrameVisible;
 };