Bug 505186. Don't add useless nsDisplayReflowCount items to display lists in debug builds. r=bzbarsky

This commit is contained in:
Robert O'Callahan 2009-07-22 12:44:52 +12:00
parent bec635e65d
commit a26d44577d
3 changed files with 18 additions and 5 deletions

View File

@ -922,7 +922,8 @@ protected:
#define DO_GLOBAL_REFLOW_COUNT_DSP(_name) \
PR_BEGIN_MACRO \
if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery()) { \
if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery() && \
PresContext()->PresShell()->IsPaintingFrameCounts()) { \
nsresult _rv = \
aLists.Outlines()->AppendNewToTop(new (aBuilder) \
nsDisplayReflowCount(this, _name)); \
@ -932,7 +933,8 @@ protected:
#define DO_GLOBAL_REFLOW_COUNT_DSP_COLOR(_name, _color) \
PR_BEGIN_MACRO \
if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery()) { \
if (!aBuilder->IsBackgroundOnly() && !aBuilder->IsForEventDelivery() && \
PresContext()->PresShell()->IsPaintingFrameCounts()) { \
nsresult _rv = \
aLists.Outlines()->AppendNewToTop(new (aBuilder) \
nsDisplayReflowCount(this, _name, \

View File

@ -105,8 +105,8 @@ typedef short SelectionType;
typedef PRUint32 nsFrameState;
#define NS_IPRESSHELL_IID \
{ 0x5039364e, 0x6e3e, 0x4aae, \
{ 0xb8, 0xac, 0xf1, 0xee, 0xf1, 0xcb, 0x85, 0x45 } }
{ 0xfea81c36, 0xed5b, 0x41f5, \
{ 0x89, 0x5d, 0x4c, 0x50, 0x79, 0x49, 0xad, 0x3b } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -690,6 +690,7 @@ public:
nsIFrame * aFrame,
PRUint32 aColor) = 0;
NS_IMETHOD SetPaintFrameCount(PRBool aOn) = 0;
virtual PRBool IsPaintingFrameCounts() = 0;
#endif
#ifdef DEBUG

View File

@ -376,6 +376,8 @@ public:
void SetDumpFrameByFrameCounts(PRBool aVal) { mDumpFrameByFrameCounts = aVal; }
void SetPaintFrameCounts(PRBool aVal) { mPaintFrameByFrameCounts = aVal; }
PRBool IsPaintingFrameCounts() { return mPaintFrameByFrameCounts; }
protected:
void DisplayTotals(PRUint32 aTotal, PRUint32 * aDupArray, char * aTitle);
void DisplayHTMLTotals(PRUint32 aTotal, PRUint32 * aDupArray, char * aTitle);
@ -1004,7 +1006,7 @@ public:
NS_IMETHOD PaintCount(const char * aName, nsIRenderingContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, PRUint32 aColor);
NS_IMETHOD SetPaintFrameCount(PRBool aOn);
virtual PRBool IsPaintingFrameCounts();
#endif
#ifdef DEBUG
@ -8098,6 +8100,14 @@ PresShell::SetPaintFrameCount(PRBool aPaintFrameCounts)
return NS_OK;
}
PRBool
PresShell::IsPaintingFrameCounts()
{
if (mReflowCountMgr)
return mReflowCountMgr->IsPaintingFrameCounts();
return PR_FALSE;
}
//------------------------------------------------------------------
//-- Reflow Counter Classes Impls
//------------------------------------------------------------------