From b66ea190f51c4755189792dbfeb8a76d2adce4fa Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Thu, 15 Sep 2016 14:32:12 +0800 Subject: [PATCH] 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 --HG-- extra : rebase_source : f40703a2ec448bf39a4a49e98fcd50f5550bbdd3 --- layout/generic/BlockReflowInput.cpp | 20 ++++++++++---------- layout/generic/nsBlockDebugFlags.h | 1 - layout/generic/nsFloatManager.cpp | 28 +++++++++++++++++----------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/layout/generic/BlockReflowInput.cpp b/layout/generic/BlockReflowInput.cpp index 0b0271c699ca..dc41322149e2 100644 --- a/layout/generic/BlockReflowInput.cpp +++ b/layout/generic/BlockReflowInput.cpp @@ -1002,17 +1002,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat) 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)); + } + if (nsBlockFrame::gNoisyReflow) { nsRect r = aFloat->GetRect(); nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent); diff --git a/layout/generic/nsBlockDebugFlags.h b/layout/generic/nsBlockDebugFlags.h index 9bb10f7cf32d..c2eeabcb56e7 100644 --- a/layout/generic/nsBlockDebugFlags.h +++ b/layout/generic/nsBlockDebugFlags.h @@ -15,7 +15,6 @@ #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 diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index 1bebe7f45995..8e570236e0a0 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -10,7 +10,7 @@ #include #include "mozilla/ReflowInput.h" -#include "nsBlockDebugFlags.h" +#include "nsBlockFrame.h" #include "nsError.h" #include "nsIPresShell.h" #include "nsMemory.h" @@ -559,17 +559,21 @@ 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 @@ -588,9 +592,11 @@ nsAutoFloatManager::CreateFloatManager(nsPresContext *aPresContext) 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.