Bug 1047928 patch 5 - Pass restyle hint to RestyleManager::PostRebuildAllStyleDataEvent. r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Wed, 08 Oct 2014 14:27:02 -0700
changeset 209472 56ee0c224417e0e02c6d2a9f0d861121cfb1f6e0
parent 209471 fd1674f6a37ade81a0e3a61409b1bbea527927c2
child 209473 d4f6fe019942566a24ea02747674186ac53c56f7
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbzbarsky
bugs1047928
milestone35.0a1
Bug 1047928 patch 5 - Pass restyle hint to RestyleManager::PostRebuildAllStyleDataEvent. r=bzbarsky This patch is not intended to contain any changes in behavior.
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/nsPresContext.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1684,26 +1684,26 @@ RestyleManager::PostRestyleEventInternal
 
   // Unconditionally flag our document as needing a flush.  The other
   // option here would be a dedicated boolean to track whether we need
   // to do so (set here and unset in ProcessPendingRestyles).
   presShell->GetDocument()->SetNeedStyleFlush();
 }
 
 void
-RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint)
+RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
+                                             nsRestyleHint aRestyleHint)
 {
   NS_ASSERTION(!(aExtraHint & nsChangeHint_ReconstructFrame),
                "Should not reconstruct the root of the frame tree.  "
                "Use ReconstructDocElementHierarchy instead.");
 
   mRebuildAllStyleData = true;
   NS_UpdateHint(mRebuildAllExtraHint, aExtraHint);
-  // FIXME: pass through from callers
-  mRebuildAllRestyleHint = eRestyle_Subtree;
+  mRebuildAllRestyleHint |= aRestyleHint;
 
   // Get a restyle event posted if necessary
   PostRestyleEventInternal(false);
 }
 
 #ifdef DEBUG
 static void
 DumpContext(nsIFrame* aFrame, nsStyleContext* aContext)
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -384,18 +384,21 @@ public:
    * Asynchronously clear style data from the root frame downwards and ensure
    * it will all be rebuilt. This is safe to call anytime; it will schedule
    * a restyle and take effect next time style changes are flushed.
    * This method is used to recompute the style data when some change happens
    * outside of any style rules, like a color preference change or a change
    * in a system font size, or to fix things up when an optimization in the
    * style data has become invalid. We assume that the root frame will not
    * need to be reframed.
+   *
+   * For parameters, see RebuildAllStyleData.
    */
-  void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint);
+  void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
+                                    nsRestyleHint aRestyleHint);
 
 #ifdef RESTYLE_LOGGING
   /**
    * Returns whether a restyle event currently being processed by this
    * RestyleManager should be logged.
    */
   bool ShouldLogRestyle() {
     return ShouldLogRestyle(mPresContext);
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1872,17 +1872,18 @@ nsPresContext::RebuildAllStyleData(nsCha
 
 void
 nsPresContext::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint)
 {
   if (!mShell) {
     // We must have been torn down. Nothing to do here.
     return;
   }
-  RestyleManager()->PostRebuildAllStyleDataEvent(aExtraHint);
+  // FIXME: Pass through from callers.
+  RestyleManager()->PostRebuildAllStyleDataEvent(aExtraHint, eRestyle_Subtree);
 }
 
 void
 nsPresContext::MediaFeatureValuesChanged(StyleRebuildType aShouldRebuild,
                                          nsChangeHint aChangeHint)
 {
   NS_ASSERTION(aShouldRebuild == eAlwaysRebuildStyle || aChangeHint == 0,
                "If you don't know if we need a rebuild, how can you provide a hint?");