Bug 1302758 Part 2 - Replace NOISY_FLOATMANAGER with nsBlockFrame::gNoisyFloatManager. r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 15 Sep 2016 14:32:12 +0800
changeset 314150 3b8d624b89da61815cf87ad738c8a9f1619ba120
parent 314149 98f95cc61ab3cb2db5e03be866c73a77cf5e3f3b
child 314151 1eb767946c2e3a07e7a4632966f5617f6c25dcd4
push id30708
push usercbook@mozilla.com
push dateFri, 16 Sep 2016 10:52:07 +0000
treeherdermozilla-central@3172114c06cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1302758
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 1302758 Part 2 - Replace NOISY_FLOATMANAGER with nsBlockFrame::gNoisyFloatManager. r=dholbert To see the flag in action, export GECKO_BLOCK_DEBUG_FLAGS="float-manager" and open a page containing float elements. For example: $ GECKO_BLOCK_DEBUG_FLAGS="float-manager" ./mach run layout/reftests/floats/orthogonal-floats-1a.html MozReview-Commit-ID: 7Rb45ophewf
layout/generic/BlockReflowInput.cpp
layout/generic/nsBlockDebugFlags.h
layout/generic/nsFloatManager.cpp
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -997,27 +997,27 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
   }
 
   if (!NS_FRAME_IS_FULLY_COMPLETE(reflowStatus)) {
     mBlock->SplitFloat(*this, aFloat, reflowStatus);
   } else {
     MOZ_ASSERT(!aFloat->GetNextInFlow());
   }
 
-#ifdef NOISY_FLOATMANAGER
-  nscoord tI, tB;
-  mFloatManager->GetTranslation(tI, tB);
-  nsIFrame::ListTag(stdout, mBlock);
-  printf(": FlowAndPlaceFloat: AddFloat: tIB=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
-         tI, tB, mFloatManagerI, mFloatManagerB,
-         region.IStart(wm), region.BStart(wm),
-         region.ISize(wm), region.BSize(wm));
-#endif
+#ifdef DEBUG
+  if (nsBlockFrame::gNoisyFloatManager) {
+    nscoord tI, tB;
+    mFloatManager->GetTranslation(tI, tB);
+    nsIFrame::ListTag(stdout, mBlock);
+    printf(": FlowAndPlaceFloat: AddFloat: tIB=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
+           tI, tB, mFloatManagerI, mFloatManagerB,
+           region.IStart(wm), region.BStart(wm),
+           region.ISize(wm), region.BSize(wm));
+  }
 
-#ifdef DEBUG
   if (nsBlockFrame::gNoisyReflow) {
     nsRect r = aFloat->GetRect();
     nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
     printf("placed float: ");
     nsFrame::ListTag(stdout, aFloat);
     printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height);
   }
 #endif
--- a/layout/generic/nsBlockDebugFlags.h
+++ b/layout/generic/nsBlockDebugFlags.h
@@ -10,13 +10,12 @@
 #undef NOISY_FLOAT                // enables debug output for float reflow (the in/out metrics for the floated block)
 #undef NOISY_FLOAT_CLEARING
 #undef NOISY_FINAL_SIZE           // enables debug output for desired width/height computation, once all children have been reflowed
 #undef NOISY_REMOVE_FRAME
 #undef NOISY_COMBINED_AREA        // enables debug output for combined area computation
 #undef NOISY_BLOCK_DIR_MARGINS
 #undef NOISY_REFLOW_REASON        // gives a little info about why each reflow was requested
 #undef REFLOW_STATUS_COVERAGE     // I think this is most useful for printing, to see which frames return "incomplete"
-#undef NOISY_FLOATMANAGER         // enables debug output for float manager use, useful for analysing reflow of floats
 #undef NOISY_BLOCK_INVALIDATE     // enables debug output for all calls to invalidate
 #undef REALLY_NOISY_REFLOW        // some extra debug info
 
 #endif // nsBlockDebugFlags_h__
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -5,17 +5,17 @@
 
 /* class that manages rules for positioning floats */
 
 #include "nsFloatManager.h"
 
 #include <algorithm>
 
 #include "mozilla/ReflowInput.h"
-#include "nsBlockDebugFlags.h"
+#include "nsBlockFrame.h"
 #include "nsError.h"
 #include "nsIPresShell.h"
 #include "nsMemory.h"
 
 using namespace mozilla;
 
 int32_t nsFloatManager::sCachedFloatManagerCount = 0;
 void* nsFloatManager::sCachedFloatManagers[NS_FLOAT_MANAGER_CACHE_SIZE];
@@ -554,27 +554,31 @@ nsFloatManager::FloatInfo::~FloatInfo()
 #endif
 
 //----------------------------------------------------------------------
 
 nsAutoFloatManager::~nsAutoFloatManager()
 {
   // Restore the old float manager in the reflow input if necessary.
   if (mNew) {
-#ifdef NOISY_FLOATMANAGER
-    printf("restoring old float manager %p\n", mOld);
+#ifdef DEBUG
+    if (nsBlockFrame::gNoisyFloatManager) {
+      printf("restoring old float manager %p\n", mOld);
+    }
 #endif
 
     mReflowInput.mFloatManager = mOld;
 
-#ifdef NOISY_FLOATMANAGER
-    if (mOld) {
-      mReflowInput.mFrame->ListTag(stdout);
-      printf(": float manager %p after reflow\n", mOld);
-      mOld->List(stdout);
+#ifdef DEBUG
+    if (nsBlockFrame::gNoisyFloatManager) {
+      if (mOld) {
+        mReflowInput.mFrame->ListTag(stdout);
+        printf(": float manager %p after reflow\n", mOld);
+        mOld->List(stdout);
+      }
     }
 #endif
 
     delete mNew;
   }
 }
 
 nsresult
@@ -583,18 +587,20 @@ nsAutoFloatManager::CreateFloatManager(n
   // Create a new float manager and install it in the reflow
   // input. `Remember' the old float manager so we can restore it
   // later.
   mNew = new nsFloatManager(aPresContext->PresShell(),
                             mReflowInput.GetWritingMode());
   if (! mNew)
     return NS_ERROR_OUT_OF_MEMORY;
 
-#ifdef NOISY_FLOATMANAGER
-  printf("constructed new float manager %p (replacing %p)\n",
-         mNew, mReflowInput.mFloatManager);
+#ifdef DEBUG
+  if (nsBlockFrame::gNoisyFloatManager) {
+    printf("constructed new float manager %p (replacing %p)\n",
+           mNew, mReflowInput.mFloatManager);
+  }
 #endif
 
   // Set the float manager in the existing reflow input.
   mOld = mReflowInput.mFloatManager;
   mReflowInput.mFloatManager = mNew;
   return NS_OK;
 }