Bug 1292930: Hoist ChangeHintToString to RestyleManagerBase. r=heycam
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Fri, 05 Aug 2016 11:54:22 -0700
changeset 309172 294df63717f1e5b7665164bda1e080fd95914a38
parent 309171 2d5a7f342256264b31c8378795c03b5844bfc53b
child 309173 0890cda8c432c2e8d781fd4160f4c9eb4acc1b47
push id31321
push userkwierso@gmail.com
push dateFri, 12 Aug 2016 23:30:18 +0000
treeherderautoland@c385cb6a0838 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1292930
milestone51.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 1292930: Hoist ChangeHintToString to RestyleManagerBase. r=heycam MozReview-Commit-ID: BLW40PYhc0o
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/RestyleManagerBase.cpp
layout/base/RestyleManagerBase.h
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -3906,77 +3906,16 @@ RestyleManager::StructsToLog()
     initialized = true;
   }
   return structs;
 }
 #endif
 
 #ifdef DEBUG
 /* static */ nsCString
-RestyleManager::ChangeHintToString(nsChangeHint aHint)
-{
-  nsCString result;
-  bool any = false;
-  const char* names[] = {
-    "RepaintFrame", "NeedReflow", "ClearAncestorIntrinsics",
-    "ClearDescendantIntrinsics", "NeedDirtyReflow", "SyncFrameView",
-    "UpdateCursor", "UpdateEffects", "UpdateOpacityLayer",
-    "UpdateTransformLayer", "ReconstructFrame", "UpdateOverflow",
-    "UpdateSubtreeOverflow", "UpdatePostTransformOverflow",
-    "UpdateParentOverflow",
-    "ChildrenOnlyTransform", "RecomputePosition", "AddOrRemoveTransform",
-    "BorderStyleNoneChange", "UpdateTextPath", "SchedulePaint",
-    "NeutralChange", "InvalidateRenderingObservers",
-    "ReflowChangesSizeOrPosition", "UpdateComputedBSize",
-    "UpdateUsesOpacity"
-  };
-  uint32_t hint = aHint & ((1 << ArrayLength(names)) - 1);
-  uint32_t rest = aHint & ~((1 << ArrayLength(names)) - 1);
-  if (hint == nsChangeHint_Hints_NotHandledForDescendants) {
-    result.AppendLiteral("nsChangeHint_Hints_NotHandledForDescendants");
-    hint = 0;
-    any = true;
-  } else {
-    if ((hint & NS_STYLE_HINT_REFLOW) == NS_STYLE_HINT_REFLOW) {
-      result.AppendLiteral("NS_STYLE_HINT_REFLOW");
-      hint = hint & ~NS_STYLE_HINT_REFLOW;
-      any = true;
-    } else if ((hint & nsChangeHint_AllReflowHints) == nsChangeHint_AllReflowHints) {
-      result.AppendLiteral("nsChangeHint_AllReflowHints");
-      hint = hint & ~nsChangeHint_AllReflowHints;
-      any = true;
-    } else if ((hint & NS_STYLE_HINT_VISUAL) == NS_STYLE_HINT_VISUAL) {
-      result.AppendLiteral("NS_STYLE_HINT_VISUAL");
-      hint = hint & ~NS_STYLE_HINT_VISUAL;
-      any = true;
-    }
-  }
-  for (uint32_t i = 0; i < ArrayLength(names); i++) {
-    if (hint & (1 << i)) {
-      if (any) {
-        result.AppendLiteral(" | ");
-      }
-      result.AppendPrintf("nsChangeHint_%s", names[i]);
-      any = true;
-    }
-  }
-  if (rest) {
-    if (any) {
-      result.AppendLiteral(" | ");
-    }
-    result.AppendPrintf("0x%0x", rest);
-  } else {
-    if (!any) {
-      result.AppendLiteral("nsChangeHint(0)");
-    }
-  }
-  return result;
-}
-
-/* static */ nsCString
 RestyleManager::StructNamesToString(uint32_t aSIDs)
 {
   nsCString result;
   bool any = false;
   for (nsStyleStructID sid = nsStyleStructID(0);
        sid < nsStyleStructID_Length;
        sid = nsStyleStructID(sid + 1)) {
     if (aSIDs & nsCachedStyleData::GetBitForSID(sid)) {
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -375,20 +375,16 @@ public:
                         nsChangeHint aMinChangeHint,
                         const RestyleHintData* aRestyleHintData = nullptr);
 
   void PostRestyleEventForLazyConstruction()
   {
     PostRestyleEventInternal(true);
   }
 
-#ifdef DEBUG
-  static nsCString ChangeHintToString(nsChangeHint aHint);
-#endif
-
 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
--- a/layout/base/RestyleManagerBase.cpp
+++ b/layout/base/RestyleManagerBase.cpp
@@ -131,16 +131,79 @@ RestyleManagerBase::RestyleHintToString(
   } else {
     if (!any) {
       result.AppendLiteral("0");
     }
   }
   return result;
 }
 
+#ifdef DEBUG
+/* static */ nsCString
+RestyleManagerBase::ChangeHintToString(nsChangeHint aHint)
+{
+  nsCString result;
+  bool any = false;
+  const char* names[] = {
+    "RepaintFrame", "NeedReflow", "ClearAncestorIntrinsics",
+    "ClearDescendantIntrinsics", "NeedDirtyReflow", "SyncFrameView",
+    "UpdateCursor", "UpdateEffects", "UpdateOpacityLayer",
+    "UpdateTransformLayer", "ReconstructFrame", "UpdateOverflow",
+    "UpdateSubtreeOverflow", "UpdatePostTransformOverflow",
+    "UpdateParentOverflow",
+    "ChildrenOnlyTransform", "RecomputePosition", "AddOrRemoveTransform",
+    "BorderStyleNoneChange", "UpdateTextPath", "SchedulePaint",
+    "NeutralChange", "InvalidateRenderingObservers",
+    "ReflowChangesSizeOrPosition", "UpdateComputedBSize",
+    "UpdateUsesOpacity"
+  };
+  uint32_t hint = aHint & ((1 << ArrayLength(names)) - 1);
+  uint32_t rest = aHint & ~((1 << ArrayLength(names)) - 1);
+  if (hint == nsChangeHint_Hints_NotHandledForDescendants) {
+    result.AppendLiteral("nsChangeHint_Hints_NotHandledForDescendants");
+    hint = 0;
+    any = true;
+  } else {
+    if ((hint & NS_STYLE_HINT_REFLOW) == NS_STYLE_HINT_REFLOW) {
+      result.AppendLiteral("NS_STYLE_HINT_REFLOW");
+      hint = hint & ~NS_STYLE_HINT_REFLOW;
+      any = true;
+    } else if ((hint & nsChangeHint_AllReflowHints) == nsChangeHint_AllReflowHints) {
+      result.AppendLiteral("nsChangeHint_AllReflowHints");
+      hint = hint & ~nsChangeHint_AllReflowHints;
+      any = true;
+    } else if ((hint & NS_STYLE_HINT_VISUAL) == NS_STYLE_HINT_VISUAL) {
+      result.AppendLiteral("NS_STYLE_HINT_VISUAL");
+      hint = hint & ~NS_STYLE_HINT_VISUAL;
+      any = true;
+    }
+  }
+  for (uint32_t i = 0; i < ArrayLength(names); i++) {
+    if (hint & (1 << i)) {
+      if (any) {
+        result.AppendLiteral(" | ");
+      }
+      result.AppendPrintf("nsChangeHint_%s", names[i]);
+      any = true;
+    }
+  }
+  if (rest) {
+    if (any) {
+      result.AppendLiteral(" | ");
+    }
+    result.AppendPrintf("0x%0x", rest);
+  } else {
+    if (!any) {
+      result.AppendLiteral("nsChangeHint(0)");
+    }
+  }
+  return result;
+}
+#endif
+
 void
 RestyleManagerBase::PostRestyleEventInternal(bool aForLazyConstruction)
 {
   // Make sure we're not in a style refresh; if we are, we still have
   // a call to ProcessPendingRestyles coming and there's no need to
   // add ourselves as a refresh observer until then.
   bool inRefresh = !aForLazyConstruction && mInStyleRefresh;
   nsIPresShell* presShell = PresContext()->PresShell();
--- a/layout/base/RestyleManagerBase.h
+++ b/layout/base/RestyleManagerBase.h
@@ -43,16 +43,18 @@ public:
       mObservingRefreshDriver = aObserving;
   }
 
   void Disconnect() { mPresContext = nullptr; }
 
   static nsCString RestyleHintToString(nsRestyleHint aHint);
 
 #ifdef DEBUG
+  static nsCString ChangeHintToString(nsChangeHint aHint);
+
   /**
    * DEBUG ONLY method to verify integrity of style tree versus frame tree
    */
   static void DebugVerifyStyleTree(nsIFrame* aFrame);
 #endif
 
   void FlushOverflowChangedTracker() {
     mOverflowChangedTracker.Flush();