Bug 1192302 - Part 1: Make MustCheckUndisplayedContent take its frame as an argument. r=bzbarsky a=sylvestre
authorCameron McCormack <cam@mcc.id.au>
Fri, 04 Sep 2015 10:00:14 +1000
changeset 289227 1228198a8cc1104529c146e66831e97f956b9bec
parent 289226 6b6d4c5f58c2fffe202352ea3ab9295a0d409202
child 289228 423d8aa88b3a4221e7fa73e821c8674f77b9a3c9
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, sylvestre
bugs1192302
milestone42.0a2
Bug 1192302 - Part 1: Make MustCheckUndisplayedContent take its frame as an argument. r=bzbarsky a=sylvestre
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -2856,28 +2856,29 @@ ElementRestyler::AddPendingRestylesForDe
     if (n->IsElement()) {
       AddPendingRestylesForDescendantsMatchingSelectors(n->AsElement(),
                                                         restyleRoot);
     }
   }
 }
 
 bool
-ElementRestyler::MustCheckUndisplayedContent(nsIContent*& aUndisplayedParent)
+ElementRestyler::MustCheckUndisplayedContent(nsIFrame* aFrame,
+                                             nsIContent*& aUndisplayedParent)
 {
   // When the root element is display:none, we still construct *some*
   // frames that have the root element as their mContent, down to the
   // DocElementContainingBlock.
-  if (mFrame->StyleContext()->GetPseudo()) {
+  if (aFrame->StyleContext()->GetPseudo()) {
     aUndisplayedParent = nullptr;
-    return mFrame == mPresContext->FrameConstructor()->
+    return aFrame == mPresContext->FrameConstructor()->
                        GetDocElementContainingBlock();
   }
 
-  aUndisplayedParent = mFrame->GetContent();
+  aUndisplayedParent = aFrame->GetContent();
   return !!aUndisplayedParent;
 }
 
 /**
  * Helper for MoveStyleContextsForChildren, below.  Appends the style
  * contexts to be moved to mFrame's current (new) style context to
  * aContextsToMove.
  */
@@ -2940,17 +2941,17 @@ ElementRestyler::MoveStyleContextsForCon
  * moved.
  */
 bool
 ElementRestyler::MoveStyleContextsForChildren(nsStyleContext* aOldContext)
 {
   // Bail out if there are undisplayed or display:contents children.
   // FIXME: We could get this to work if we need to.
   nsIContent* undisplayedParent;
-  if (MustCheckUndisplayedContent(undisplayedParent)) {
+  if (MustCheckUndisplayedContent(mFrame, undisplayedParent)) {
     nsCSSFrameConstructor* fc = mPresContext->FrameConstructor();
     if (fc->GetAllUndisplayedContentIn(undisplayedParent) ||
         fc->GetAllDisplayContentsIn(undisplayedParent)) {
       return false;
     }
   }
 
   nsTArray<nsStyleContext*> contextsToMove;
@@ -4244,17 +4245,17 @@ ElementRestyler::ComputeStyleChangeFor(n
     }
   }
 }
 
 void
 ElementRestyler::RestyleUndisplayedDescendants(nsRestyleHint aChildRestyleHint)
 {
   nsIContent* undisplayedParent;
-  if (MustCheckUndisplayedContent(undisplayedParent)) {
+  if (MustCheckUndisplayedContent(mFrame, undisplayedParent)) {
     DoRestyleUndisplayedDescendants(aChildRestyleHint, undisplayedParent,
                                     mFrame->StyleContext());
   }
 }
 
 void
 ElementRestyler::DoRestyleUndisplayedDescendants(nsRestyleHint aChildRestyleHint,
                                                  nsIContent* aParent,
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -704,17 +704,18 @@ private:
                                      bool& aCanStopWithStyleChange);
   void ComputeRestyleResultFromNewContext(nsIFrame* aSelf,
                                           nsStyleContext* aNewContext,
                                           RestyleResult& aRestyleResult,
                                           bool& aCanStopWithStyleChange);
 
   // Helpers for RestyleChildren().
   void RestyleUndisplayedDescendants(nsRestyleHint aChildRestyleHint);
-  bool MustCheckUndisplayedContent(nsIContent*& aUndisplayedParent);
+  bool MustCheckUndisplayedContent(nsIFrame* aFrame,
+                                   nsIContent*& aUndisplayedParent);
 
   /**
    * In the following two methods, aParentStyleContext is either
    * mFrame->StyleContext() if we have a frame, or a display:contents
    * style context if we don't.
    */
   void DoRestyleUndisplayedDescendants(nsRestyleHint aChildRestyleHint,
                                        nsIContent* aParent,