diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 4fd2442ba7c5..45c203ca4dea 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -819,8 +819,12 @@ DumpContext(nsIFrame* aFrame, nsIStyleContext* aContext) if (aFrame) { fputs("frame: ", stdout); nsAutoString name; - aFrame->GetFrameName(name); - fputs(name, stdout); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(aFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + fputs(name, stdout); + } fprintf(stdout, " (%p)", aFrame); } if (aContext) { diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index 26aad0ca0c8d..297c659bcc69 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -18,9 +18,11 @@ */ #include "nsILayoutDebugger.h" #include "nsIFrame.h" +#include "nsIFrameDebug.h" static NS_DEFINE_IID(kILayoutDebuggerIID, NS_ILAYOUT_DEBUGGER_IID); +#ifdef NS_DEBUG class nsLayoutDebugger : public nsILayoutDebugger { public: nsLayoutDebugger(); @@ -71,14 +73,14 @@ NS_IMPL_ISUPPORTS(nsLayoutDebugger, kILayoutDebuggerIID); NS_IMETHODIMP nsLayoutDebugger::SetShowFrameBorders(PRBool aEnable) { - nsIFrame::ShowFrameBorders(aEnable); + nsIFrameDebug::ShowFrameBorders(aEnable); return NS_OK; } NS_IMETHODIMP nsLayoutDebugger::GetShowFrameBorders(PRBool* aResult) { - *aResult = nsIFrame::GetShowFrameBorders(); + *aResult = nsIFrameDebug::GetShowFrameBorders(); return NS_OK; } @@ -105,3 +107,4 @@ nsLayoutDebugger::GetStyleSize(nsIPresShell* aPresentation, *aSizeInBytesResult = 0; return NS_ERROR_FAILURE; } +#endif diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 8070e1c9a991..fa00682063d1 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -69,6 +69,9 @@ #ifdef MOZ_PERF_METRICS #include "nsITimeRecorder.h" #endif +#ifdef NS_DEBUG +#include "nsIFrameDebug.h" +#endif // Drag & Drop, Clipboard #include "nsWidgetsCID.h" @@ -326,8 +329,9 @@ protected: PRBool mCaretEnabled; -#ifdef NS_DEBUG nsresult CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult); + +#ifdef NS_DEBUG PRBool VerifyIncrementalReflow(); PRBool mInVerifyReflow; #endif @@ -380,7 +384,7 @@ private: static void VerifyStyleTree(nsIFrameManager* aFrameManager) { - if (aFrameManager && nsIFrame::GetVerifyStyleTreeEnable()) { + if (aFrameManager && nsIFrameDebug::GetVerifyStyleTreeEnable()) { nsIFrame* rootFrame; aFrameManager->GetRootFrame(&rootFrame); @@ -927,8 +931,12 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight)); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif #ifdef DEBUG_kipp @@ -951,8 +959,12 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height)); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif VERIFY_STYLE_TREE; @@ -1004,8 +1016,12 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::ResizeReflow: %d,%d", aWidth, aHeight)); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif #ifdef DEBUG_kipp @@ -1026,8 +1042,12 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) rootFrame->Reflow(*mPresContext, desiredSize, reflowState, status); rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif VERIFY_STYLE_TREE; @@ -1183,8 +1203,12 @@ PresShell::StyleChangeReflow() NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::StyleChangeReflow")); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif nsRect bounds; @@ -1203,8 +1227,12 @@ PresShell::StyleChangeReflow() rootFrame->Reflow(*mPresContext, desiredSize, reflowState, status); rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif VERIFY_STYLE_TREE; @@ -1431,8 +1459,12 @@ PresShell::ProcessReflowCommands() NS_IF_RELEASE(rcx); #ifdef DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } if (GetVerifyReflowEnable()) { // First synchronously render what we have so far so that we can @@ -2085,7 +2117,7 @@ PresShell::Paint(nsIView *aView, #ifdef NS_DEBUG // Draw a border around the frame - if (nsIFrame::GetShowFrameBorders()) { + if (nsIFrameDebug::GetShowFrameBorders()) { nsRect r; frame->GetRect(r); aRenderingContext.SetColor(NS_RGB(0,0,255)); @@ -2273,7 +2305,11 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) printf("verifyreflow: "); nsAutoString name; if (nsnull != k1) { - k1->GetFrameName(name); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k1->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + } } else { name = "(null)"; @@ -2283,7 +2319,11 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) printf(" != "); if (nsnull != k2) { - k2->GetFrameName(name); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k2->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + } } else { name = "(null)"; @@ -2299,14 +2339,20 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, { printf("verifyreflow: "); nsAutoString name; - k1->GetFrameName(name); - fputs(name, stdout); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k1->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + fputs(name, stdout); + } printf("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height); printf(" != "); - k2->GetFrameName(name); - fputs(name, stdout); + if (NS_SUCCEEDED(k2->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + fputs(name, stdout); + } printf("{%d, %d, %d, %d}", r2.x, r2.y, r2.width, r2.height); printf(" %s\n", aMsg); @@ -2445,6 +2491,7 @@ CompareTrees(nsIPresContext* aPresContext, nsIFrame* aA, nsIFrame* aB) return ok; } +#endif #if 0 static nsIFrame* @@ -2522,6 +2569,7 @@ PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult) return NS_OK; } +#ifdef DEBUG // After an incremental reflow, we verify the correctness by doing a // full reflow into a fresh frame tree. PRBool @@ -2640,9 +2688,15 @@ PresShell::VerifyIncrementalReflow() PRBool ok = CompareTrees(mPresContext, root1, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { printf("Verify reflow failed, primary tree:\n"); - root1->List(mPresContext, stdout, 0); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(root1->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(mPresContext, stdout, 0); + } printf("Verification tree:\n"); - root2->List(mPresContext, stdout, 0); + if (NS_SUCCEEDED(root2->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(mPresContext, stdout, 0); + } } // printf("Incremental reflow doomed view tree:\n"); diff --git a/layout/base/public/MANIFEST b/layout/base/public/MANIFEST index 06910d1eb551..f9ef551283d1 100644 --- a/layout/base/public/MANIFEST +++ b/layout/base/public/MANIFEST @@ -14,6 +14,7 @@ nsIDocumentObserver.h nsIDocumentViewer.h nsIFocusTracker.h nsIFrame.h +nsIFrameDebug.h nsIFrameSelection.h nsIFrameUtil.h nsIFrameImageLoader.h diff --git a/layout/base/public/Makefile.in b/layout/base/public/Makefile.in index 3e2b3228e8e4..603005bfc7b3 100644 --- a/layout/base/public/Makefile.in +++ b/layout/base/public/Makefile.in @@ -38,6 +38,7 @@ nsIDocumentObserver.h \ nsIDocumentViewer.h \ nsIFocusTracker.h \ nsIFrame.h \ +nsIFrameDebug.h \ nsIFrameImageLoader.h \ nsIFrameManager.h \ nsILayoutDebugger.h \ diff --git a/layout/base/public/makefile.win b/layout/base/public/makefile.win index d9f7e8115898..819625b1edbb 100644 --- a/layout/base/public/makefile.win +++ b/layout/base/public/makefile.win @@ -31,6 +31,7 @@ EXPORTS = \ nsIDocumentViewer.h \ nsIFocusTracker.h \ nsIFrame.h \ + nsIFrameDebug.h \ nsIFrameImageLoader.h \ nsIFrameManager.h \ nsISelectionControler.h \ diff --git a/layout/base/public/nsFrameList.h b/layout/base/public/nsFrameList.h index cac6933c36bf..ae8a611f6e12 100644 --- a/layout/base/public/nsFrameList.h +++ b/layout/base/public/nsFrameList.h @@ -121,7 +121,9 @@ public: void VerifyParent(nsIFrame* aParent) const; +#ifdef NS_DEBUG void List(nsIPresContext* aPresContext, FILE* out) const; +#endif protected: nsIFrame* mFirstChild; diff --git a/layout/base/public/nsIFrame.h b/layout/base/public/nsIFrame.h index 691880f95a8c..5859ad886cbc 100644 --- a/layout/base/public/nsIFrame.h +++ b/layout/base/public/nsIFrame.h @@ -862,42 +862,7 @@ public: */ NS_IMETHOD Scrolled(nsIView *aView) = 0; - // Debugging - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0; - /** - * Get a printable from of the name of the frame type. - */ - NS_IMETHOD GetFrameName(nsString& aResult) const = 0; - - /** - * Called to dump out regression data that describes the layout - * of the frame and it's children, and so on. The format of the - * data is dictated to be XML (using a specific DTD); the - * specific kind of data dumped is up to the frame itself, with - * the caveat that some base types are defined. - * For more information, see XXX. - */ - NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) = 0; - - /** - * Get the size of the frame object. The size value should include - * all subordinate data referenced by the frame that is not - * accounted for by child frames. However, this value should not - * include the content objects, style contexts, views or other data - * that lies logically outside the frame system. - * - * If the implementation so chooses, instead of returning the total - * subordinate data it may instead use the sizeof handler to store - * away subordinate data under its own key so that the subordinate - * data may be tabulated independently of the frame itself. - * - * The caller is responsible for recursing over all child-lists that - * the frame supports. - */ - NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; - - NS_IMETHOD VerifyTree() const = 0; /** Selection related calls */ @@ -928,45 +893,6 @@ public: */ NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) = 0; - /** - * See if tree verification is enabled. To enable tree verification add - * "frameverifytree:1" to your NSPR_LOG_MODULES environment variable - * (any non-zero debug level will work). Or, call SetVerifyTreeEnable - * with PR_TRUE. - */ - static NS_LAYOUT PRBool GetVerifyTreeEnable(); - - /** - * Set the verify-tree enable flag. - */ - static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled); - - /** - * See if style tree verification is enabled. To enable style tree - * verification add "styleverifytree:1" to your NSPR_LOG_MODULES - * environment variable (any non-zero debug level will work). Or, - * call SetVerifyStyleTreeEnable with PR_TRUE. - */ - static NS_LAYOUT PRBool GetVerifyStyleTreeEnable(); - - /** - * Set the verify-style-tree enable flag. - */ - static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled); - - /** - * The frame class and related classes share an nspr log module - * for logging frame activity. - * - * Note: the log module is created during library initialization which - * means that you cannot perform logging before then. - */ - static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo(); - - // Show frame borders when rendering - static NS_LAYOUT void ShowFrameBorders(PRBool aEnable); - static NS_LAYOUT PRBool GetShowFrameBorders(); - private: NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; NS_IMETHOD_(nsrefcnt) Release(void) = 0; diff --git a/layout/base/public/nsIFrameDebug.h b/layout/base/public/nsIFrameDebug.h new file mode 100644 index 000000000000..b6057c85b2c2 --- /dev/null +++ b/layout/base/public/nsIFrameDebug.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsIFrameDebug_h___ +#define nsIFrameDebug_h___ + +#include "nslayout.h" +#include "nsISupports.h" + +class nsIFrame; +class nsIPresContext; + +// IID for the nsIFrameDebug interface {a6cf9069-15b3-11d2-932e-00805f8add32} +#define NS_IFRAMEDEBUG_IID \ +{ 0xa6cf9069, 0x15b3, 0x11d2, \ + {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} + +/** + * Debug related functions + */ +class nsIFrameDebug : public nsISupports { +public: + static const nsIID& GetIID() { static nsIID iid = NS_IFRAMEDEBUG_IID; return iid; } + + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0; + + /** + * Get a printable from of the name of the frame type. + * XXX This should be eliminated and we use GetFrameType() instead... + */ + NS_IMETHOD GetFrameName(nsString& aResult) const = 0; + /** + * Called to dump out regression data that describes the layout + * of the frame and it's children, and so on. The format of the + * data is dictated to be XML (using a specific DTD); the + * specific kind of data dumped is up to the frame itself, with + * the caveat that some base types are defined. + * For more information, see XXX. + */ + NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) = 0; + + /** + * Get the size of the frame object. The size value should include + * all subordinate data referenced by the frame that is not + * accounted for by child frames. However, this value should not + * include the content objects, style contexts, views or other data + * that lies logically outside the frame system. + * + * If the implementation so chooses, instead of returning the total + * subordinate data it may instead use the sizeof handler to store + * away subordinate data under its own key so that the subordinate + * data may be tabulated independently of the frame itself. + * + * The caller is responsible for recursing over all child-lists that + * the frame supports. + */ + NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; + + NS_IMETHOD VerifyTree() const = 0; + + /** + * See if tree verification is enabled. To enable tree verification add + * "frameverifytree:1" to your NSPR_LOG_MODULES environment variable + * (any non-zero debug level will work). Or, call SetVerifyTreeEnable + * with PR_TRUE. + */ + static NS_LAYOUT PRBool GetVerifyTreeEnable(); + + /** + * Set the verify-tree enable flag. + */ + static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled); + + /** + * See if style tree verification is enabled. To enable style tree + * verification add "styleverifytree:1" to your NSPR_LOG_MODULES + * environment variable (any non-zero debug level will work). Or, + * call SetVerifyStyleTreeEnable with PR_TRUE. + */ + static NS_LAYOUT PRBool GetVerifyStyleTreeEnable(); + + /** + * Set the verify-style-tree enable flag. + */ + static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled); + + /** + * The frame class and related classes share an nspr log module + * for logging frame activity. + * + * Note: the log module is created during library initialization which + * means that you cannot perform logging before then. + */ + static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo(); + + // Show frame borders when rendering + static NS_LAYOUT void ShowFrameBorders(PRBool aEnable); + static NS_LAYOUT PRBool GetShowFrameBorders(); + +private: + NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; + NS_IMETHOD_(nsrefcnt) Release(void) = 0; +}; + +#endif /* nsIFrameDebug_h___ */ diff --git a/layout/base/public/nsISpaceManager.h b/layout/base/public/nsISpaceManager.h index 8d11990fb5b3..44138ed2527f 100644 --- a/layout/base/public/nsISpaceManager.h +++ b/layout/base/public/nsISpaceManager.h @@ -184,12 +184,12 @@ public: */ NS_IMETHOD ClearRegions() = 0; +#ifdef DEBUG /** * Dump the state of the spacemanager out to a file */ NS_IMETHOD List(FILE* out) = 0; -#ifdef DEBUG virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const = 0; #endif }; diff --git a/layout/base/src/nsFrameList.cpp b/layout/base/src/nsFrameList.cpp index 9edde9256d63..670edf754281 100644 --- a/layout/base/src/nsFrameList.cpp +++ b/layout/base/src/nsFrameList.cpp @@ -17,6 +17,9 @@ * Netscape Communications Corporation. All Rights Reserved. */ #include "nsFrameList.h" +#ifdef NS_DEBUG +#include "nsIFrameDebug.h" +#endif void nsFrameList::DestroyFrames(nsIPresContext& aPresContext) @@ -345,14 +348,20 @@ nsFrameList::VerifyParent(nsIFrame* aParent) const #endif } +#ifdef NS_DEBUG void nsFrameList::List(nsIPresContext* aPresContext, FILE* out) const { fputs("<\n", out); nsIFrame* frame = mFirstChild; while (nsnull != frame) { - frame->List(aPresContext, out, 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, 1); + } frame->GetNextSibling(&frame); } fputs(">\n", out); } +#endif diff --git a/layout/base/src/nsFrameUtil.cpp b/layout/base/src/nsFrameUtil.cpp index 0b63f0a6ddbb..4aadea472797 100644 --- a/layout/base/src/nsFrameUtil.cpp +++ b/layout/base/src/nsFrameUtil.cpp @@ -26,6 +26,7 @@ static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); +#ifdef NS_DEBUG class nsFrameUtil : public nsIFrameUtil { public: nsFrameUtil(); @@ -630,3 +631,4 @@ nsFrameUtil::DumpRegressionData(FILE* aInputFile, FILE* aOutputFile) } return NS_ERROR_FAILURE; } +#endif diff --git a/layout/base/src/nsLayoutDebugger.cpp b/layout/base/src/nsLayoutDebugger.cpp index 26aad0ca0c8d..297c659bcc69 100644 --- a/layout/base/src/nsLayoutDebugger.cpp +++ b/layout/base/src/nsLayoutDebugger.cpp @@ -18,9 +18,11 @@ */ #include "nsILayoutDebugger.h" #include "nsIFrame.h" +#include "nsIFrameDebug.h" static NS_DEFINE_IID(kILayoutDebuggerIID, NS_ILAYOUT_DEBUGGER_IID); +#ifdef NS_DEBUG class nsLayoutDebugger : public nsILayoutDebugger { public: nsLayoutDebugger(); @@ -71,14 +73,14 @@ NS_IMPL_ISUPPORTS(nsLayoutDebugger, kILayoutDebuggerIID); NS_IMETHODIMP nsLayoutDebugger::SetShowFrameBorders(PRBool aEnable) { - nsIFrame::ShowFrameBorders(aEnable); + nsIFrameDebug::ShowFrameBorders(aEnable); return NS_OK; } NS_IMETHODIMP nsLayoutDebugger::GetShowFrameBorders(PRBool* aResult) { - *aResult = nsIFrame::GetShowFrameBorders(); + *aResult = nsIFrameDebug::GetShowFrameBorders(); return NS_OK; } @@ -105,3 +107,4 @@ nsLayoutDebugger::GetStyleSize(nsIPresShell* aPresentation, *aSizeInBytesResult = 0; return NS_ERROR_FAILURE; } +#endif diff --git a/layout/base/src/nsSpaceManager.cpp b/layout/base/src/nsSpaceManager.cpp index c10126818908..3f845c7d6895 100644 --- a/layout/base/src/nsSpaceManager.cpp +++ b/layout/base/src/nsSpaceManager.cpp @@ -23,7 +23,9 @@ #include "nsVoidArray.h" #include "nsIFrame.h" #include "nsString.h" - +#ifdef DEBUG +#include "nsIFrameDebug.h" +#endif static NS_DEFINE_IID(kISpaceManagerIID, NS_ISPACEMANAGER_IID); ///////////////////////////////////////////////////////////////////////////// @@ -904,18 +906,22 @@ nsSpaceManager::ClearRegions() return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsSpaceManager::List(FILE* out) { -#ifdef DEBUG nsAutoString tmp; fprintf(out, "SpaceManager@%p", this); if (mFrame) { - mFrame->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); - fprintf(out, "@%p", mFrame); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(mFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fprintf(out, " frame="); + fputs(tmp, out); + fprintf(out, "@%p", mFrame); + } } fprintf(out, " xy=%d,%d <\n", mX, mY); if (mBandList.IsEmpty()) { @@ -928,10 +934,14 @@ nsSpaceManager::List(FILE* out) band->mLeft, band->mTop, band->mRight, band->mBottom, band->mNumFrames); if (1 == band->mNumFrames) { - band->mFrame->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); - fprintf(out, "@%p", band->mFrame); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(band->mFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fprintf(out, " frame="); + fputs(tmp, out); + fprintf(out, "@%p", band->mFrame); + } } else if (1 < band->mNumFrames) { fprintf(out, "\n "); @@ -940,9 +950,13 @@ nsSpaceManager::List(FILE* out) for (i = 0; i < n; i++) { nsIFrame* frame = (nsIFrame*) a->ElementAt(i); if (frame) { - frame->GetFrameName(tmp); - fputs(tmp, out); - fprintf(out, "@%p ", frame); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fputs(tmp, out); + fprintf(out, "@%p ", frame); + } } } } @@ -951,9 +965,9 @@ nsSpaceManager::List(FILE* out) } while (band != mBandList.Head()); } fprintf(out, ">\n"); -#endif return NS_OK; } +#endif nsSpaceManager::FrameInfo* nsSpaceManager::GetFrameInfoFor(nsIFrame* aFrame) diff --git a/layout/base/src/nsSpaceManager.h b/layout/base/src/nsSpaceManager.h index c682f74af405..4ecbd6e958c9 100644 --- a/layout/base/src/nsSpaceManager.h +++ b/layout/base/src/nsSpaceManager.h @@ -53,10 +53,10 @@ public: NS_IMETHOD RemoveRegion(nsIFrame* aFrame); NS_IMETHOD ClearRegions(); - NS_IMETHOD List(FILE* out); #ifdef DEBUG - void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; + NS_IMETHOD List(FILE* out); + void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif protected: diff --git a/layout/build/nsLayoutFactory.cpp b/layout/build/nsLayoutFactory.cpp index 477ff4082796..b18bf4d94099 100644 --- a/layout/build/nsLayoutFactory.cpp +++ b/layout/build/nsLayoutFactory.cpp @@ -87,10 +87,12 @@ extern nsresult NS_NewRangeList(nsIFrameSelection** aResult); extern nsresult NS_NewRange(nsIDOMRange** aResult); extern nsresult NS_NewContentIterator(nsIContentIterator** aResult); extern nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult); -extern nsresult NS_NewFrameUtil(nsIFrameUtil** aResult); extern nsresult NS_NewLayoutDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult); +#ifdef NS_DEBUG +extern nsresult NS_NewFrameUtil(nsIFrameUtil** aResult); extern nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult); +#endif extern nsresult NS_NewHTMLElementFactory(nsIHTMLElementFactory** aResult); extern nsresult NS_NewHTMLEncoder(nsIDocumentEncoder** aResult); extern nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult); @@ -263,13 +265,6 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter, return res; } } - else if (mClassID.Equals(kFrameUtilCID)) { - res = NS_NewFrameUtil((nsIFrameUtil**) &inst); - if (NS_FAILED(res)) { - LOG_NEW_FAILURE("NS_NewFrameUtil", res); - return res; - } - } else if (mClassID.Equals(kEventListenerManagerCID)) { res = NS_NewEventListenerManager((nsIEventListenerManager**) &inst); if (NS_FAILED(res)) { @@ -291,6 +286,14 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter, return res; } } +#ifdef DEBUG + else if (mClassID.Equals(kFrameUtilCID)) { + res = NS_NewFrameUtil((nsIFrameUtil**) &inst); + if (NS_FAILED(res)) { + LOG_NEW_FAILURE("NS_NewFrameUtil", res); + return res; + } + } else if (mClassID.Equals(kLayoutDebuggerCID)) { res = NS_NewLayoutDebugger((nsILayoutDebugger**) &inst); if (NS_FAILED(res)) { @@ -298,6 +301,7 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter, return res; } } +#endif else if (mClassID.Equals(kHTMLElementFactoryCID)) { res = NS_NewHTMLElementFactory((nsIHTMLElementFactory**) &inst); if (NS_FAILED(res)) { diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 4298a5dd9779..7e33557e4491 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -886,12 +886,14 @@ nsComboboxControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, //-------------------------------------------------------------- + +#ifdef NS_DEBUG NS_IMETHODIMP nsComboboxControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ComboboxControl", aResult); } - +#endif //---------------------------------------------------------------------- diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index 177f7da526dc..fbfd0ee09c74 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -79,7 +79,9 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD Destroy(nsIPresContext& aPresContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const; NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index 1ce9c287fa54..7c8984f04d12 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -74,9 +74,11 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("FieldSet", aResult); } +#endif protected: @@ -269,6 +271,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext, PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { nsIView* view; GetView(&aPresContext, &view); @@ -280,6 +283,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext, } aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif return NS_OK; } diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 75d7afc69701..85e3b2c052ba 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -427,11 +427,13 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, return NS_OK; } +#ifdef NS_DEBUG NS_IMETHODIMP nsFileControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FileControl", aResult); } +#endif NS_IMETHODIMP nsFileControlFrame::GetFormContent(nsIContent*& aContent) const diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index 4f9cb9cb06f7..1500108a3071 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -71,7 +71,9 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight) { return NS_OK; }; NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index c7ad23b60f8e..33cd9adcad37 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -135,13 +135,13 @@ nsGfxButtonControlFrame::GetCID() return kButtonCID; } +#ifdef DEBUG NS_IMETHODIMP nsGfxButtonControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ButtonControl", aResult); } - - +#endif NS_IMETHODIMP nsGfxButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/forms/nsGfxButtonControlFrame.h b/layout/forms/nsGfxButtonControlFrame.h index d67ba449dd28..7c85c72d90a8 100644 --- a/layout/forms/nsGfxButtonControlFrame.h +++ b/layout/forms/nsGfxButtonControlFrame.h @@ -46,7 +46,9 @@ public: // nsFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, diff --git a/layout/forms/nsGfxCheckboxControlFrame.h b/layout/forms/nsGfxCheckboxControlFrame.h index 7f648c096c96..f959e3355cdb 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.h +++ b/layout/forms/nsGfxCheckboxControlFrame.h @@ -28,9 +28,11 @@ private: public: nsGfxCheckboxControlFrame(); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("CheckboxControl", aResult); } +#endif NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index 0a654aca52d4..d3a4f1028385 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -92,10 +92,11 @@ public: NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("ButtonControl", aResult); } +#endif virtual nsresult RequiresWidget(PRBool &aRequiresWidget); diff --git a/layout/forms/nsImageControlFrame.cpp b/layout/forms/nsImageControlFrame.cpp index 0fe4925a7313..fc6ff73ffe82 100644 --- a/layout/forms/nsImageControlFrame.cpp +++ b/layout/forms/nsImageControlFrame.cpp @@ -74,9 +74,11 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("ImageControl", aResult); } +#endif NS_IMETHOD GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index c295672ab38f..b2685aaac2ec 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -90,8 +90,10 @@ PRInt32 nsLegendFrame::GetAlign() return intValue; } +#ifdef NS_DEBUG NS_IMETHODIMP nsLegendFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Legend", aResult); } +#endif diff --git a/layout/forms/nsLegendFrame.h b/layout/forms/nsLegendFrame.h index 28c49bfc230d..e30c424b4982 100644 --- a/layout/forms/nsLegendFrame.h +++ b/layout/forms/nsLegendFrame.h @@ -37,7 +37,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif PRInt32 GetAlign(); }; diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index dc0018c008ee..56bd55b2b2ce 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -328,12 +328,13 @@ nsTextControlFrame::GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, PRI return NS_OK; } - +#ifdef DEBUG NS_IMETHODIMP nsTextControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TextControl", aResult); } +#endif //--------------------------------------------------------- NS_IMETHODIMP diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 83444e176a00..193acd004952 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -39,7 +39,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const; virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const; diff --git a/layout/generic/nsAreaFrame.cpp b/layout/generic/nsAreaFrame.cpp index fb3c0674d1a6..ab817e1e3878 100644 --- a/layout/generic/nsAreaFrame.cpp +++ b/layout/generic/nsAreaFrame.cpp @@ -378,13 +378,13 @@ nsAreaFrame::DidReflow(nsIPresContext& aPresContext, ///////////////////////////////////////////////////////////////////////////// // Diagnostics +#ifdef NS_DEBUG NS_IMETHODIMP nsAreaFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Area", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsAreaFrame.h b/layout/generic/nsAreaFrame.h index 2b7ffa508f21..e9d80dd0a0a3 100644 --- a/layout/generic/nsAreaFrame.h +++ b/layout/generic/nsAreaFrame.h @@ -88,9 +88,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif diff --git a/layout/generic/nsBRFrame.cpp b/layout/generic/nsBRFrame.cpp index 9619a3d7cf86..217f9d955a16 100644 --- a/layout/generic/nsBRFrame.cpp +++ b/layout/generic/nsBRFrame.cpp @@ -30,10 +30,12 @@ class BRFrame : public nsFrame { public: // nsIFrame +#ifdef NS_DEBUG NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); +#endif // nsIHTMLReflow NS_IMETHOD Reflow(nsIPresContext& aPresContext, @@ -70,6 +72,7 @@ BRFrame::~BRFrame() { } +#ifdef NS_DEBUG NS_IMETHODIMP BRFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -85,6 +88,7 @@ BRFrame::Paint(nsIPresContext& aPresContext, } return NS_OK; } +#endif NS_IMETHODIMP BRFrame::Reflow(nsIPresContext& aPresContext, diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 7e1ffee39b89..c50305ea44f2 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1158,6 +1158,7 @@ nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } +#ifdef DEBUG static void ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) { @@ -1170,7 +1171,6 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) NS_METHOD nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { -#ifdef DEBUG IndentBy(out, aIndent); ListTag(out); nsIView* view; @@ -1242,7 +1242,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1266,7 +1270,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); -#endif return NS_OK; } @@ -1275,6 +1278,7 @@ nsBlockFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Block", aResult); } +#endif NS_IMETHODIMP nsBlockFrame::GetFrameType(nsIAtom** aType) const @@ -5682,7 +5686,6 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) } return PR_FALSE; } -#endif NS_IMETHODIMP nsBlockFrame::VerifyTree() const @@ -5691,7 +5694,6 @@ nsBlockFrame::VerifyTree() const return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index aabaf7359048..103f99b2900d 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -90,13 +90,13 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; -#endif NS_IMETHOD VerifyTree() const; +#endif NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 7e1ffee39b89..c50305ea44f2 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -1158,6 +1158,7 @@ nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } +#ifdef DEBUG static void ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) { @@ -1170,7 +1171,6 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) NS_METHOD nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { -#ifdef DEBUG IndentBy(out, aIndent); ListTag(out); nsIView* view; @@ -1242,7 +1242,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1266,7 +1270,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); -#endif return NS_OK; } @@ -1275,6 +1278,7 @@ nsBlockFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Block", aResult); } +#endif NS_IMETHODIMP nsBlockFrame::GetFrameType(nsIAtom** aType) const @@ -5682,7 +5686,6 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) } return PR_FALSE; } -#endif NS_IMETHODIMP nsBlockFrame::VerifyTree() const @@ -5691,7 +5694,6 @@ nsBlockFrame::VerifyTree() const return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index 7e1ffee39b89..c50305ea44f2 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -1158,6 +1158,7 @@ nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } +#ifdef DEBUG static void ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) { @@ -1170,7 +1171,6 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) NS_METHOD nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { -#ifdef DEBUG IndentBy(out, aIndent); ListTag(out); nsIView* view; @@ -1242,7 +1242,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1266,7 +1270,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); -#endif return NS_OK; } @@ -1275,6 +1278,7 @@ nsBlockFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Block", aResult); } +#endif NS_IMETHODIMP nsBlockFrame::GetFrameType(nsIAtom** aType) const @@ -5682,7 +5686,6 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) } return PR_FALSE; } -#endif NS_IMETHODIMP nsBlockFrame::VerifyTree() const @@ -5691,7 +5694,6 @@ nsBlockFrame::VerifyTree() const return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 0a59066ee7b5..ec26ccb88c82 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -86,11 +86,13 @@ nsBulletFrame::Init(nsIPresContext& aPresContext, return NS_OK; } +#ifdef NS_DEBUG NS_IMETHODIMP nsBulletFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Bullet", aResult); } +#endif NS_IMETHODIMP nsBulletFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/generic/nsBulletFrame.h b/layout/generic/nsBulletFrame.h index e092d9b503b3..395a4b5d1d0a 100644 --- a/layout/generic/nsBulletFrame.h +++ b/layout/generic/nsBulletFrame.h @@ -44,7 +44,9 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif // nsIHTMLReflow NS_IMETHOD Reflow(nsIPresContext& aPresContext, diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 76102af7c36a..4b89e43e9e99 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -248,7 +248,7 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, #ifdef NS_DEBUG // Draw a border around the child - if (nsIFrame::GetShowFrameBorders() && !kidRect.IsEmpty()) { + if (nsIFrameDebug::GetShowFrameBorders() && !kidRect.IsEmpty()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(kidRect); } @@ -605,6 +605,7 @@ nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) ///////////////////////////////////////////////////////////////////////////// // Debugging +#ifdef NS_DEBUG NS_IMETHODIMP nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { @@ -649,7 +650,11 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -666,7 +671,6 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index 6ec21ed5a386..cd44cffb7717 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -45,8 +45,8 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; #ifdef DEBUG + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif diff --git a/layout/generic/nsFirstLetterFrame.cpp b/layout/generic/nsFirstLetterFrame.cpp index 00c9a5e86e9c..de17a9083823 100644 --- a/layout/generic/nsFirstLetterFrame.cpp +++ b/layout/generic/nsFirstLetterFrame.cpp @@ -41,7 +41,9 @@ public: NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, nsIFrame* aChildList); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -74,11 +76,13 @@ nsFirstLetterFrame::nsFirstLetterFrame() { } +#ifdef NS_DEBUG NS_IMETHODIMP nsFirstLetterFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Letter", aResult); } +#endif NS_IMETHODIMP nsFirstLetterFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index ea1a3fa58f10..838ade95c5a9 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -88,14 +88,15 @@ static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aSta //---------------------------------------------------------------------- +#ifdef NS_DEBUG static PRBool gShowFrameBorders = PR_FALSE; -NS_LAYOUT void nsIFrame::ShowFrameBorders(PRBool aEnable) +NS_LAYOUT void nsIFrameDebug::ShowFrameBorders(PRBool aEnable) { gShowFrameBorders = aEnable; } -NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders() +NS_LAYOUT PRBool nsIFrameDebug::GetShowFrameBorders() { return gShowFrameBorders; } @@ -106,16 +107,13 @@ NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders() */ static PRLogModuleInfo* gLogModule; -#ifdef NS_DEBUG static PRLogModuleInfo* gFrameVerifyTreeLogModuleInfo; -#endif static PRBool gFrameVerifyTreeEnable = PRBool(0x55); NS_LAYOUT PRBool -nsIFrame::GetVerifyTreeEnable() +nsIFrameDebug::GetVerifyTreeEnable() { -#ifdef NS_DEBUG if (gFrameVerifyTreeEnable == PRBool(0x55)) { if (nsnull == gFrameVerifyTreeLogModuleInfo) { gFrameVerifyTreeLogModuleInfo = PR_NewLogModule("frameverifytree"); @@ -124,26 +122,22 @@ nsIFrame::GetVerifyTreeEnable() gFrameVerifyTreeEnable ? "en" : "dis"); } } -#endif return gFrameVerifyTreeEnable; } NS_LAYOUT void -nsIFrame::SetVerifyTreeEnable(PRBool aEnabled) +nsIFrameDebug::SetVerifyTreeEnable(PRBool aEnabled) { gFrameVerifyTreeEnable = aEnabled; } -#ifdef NS_DEBUG static PRLogModuleInfo* gStyleVerifyTreeLogModuleInfo; -#endif static PRBool gStyleVerifyTreeEnable = PRBool(0x55); NS_LAYOUT PRBool -nsIFrame::GetVerifyStyleTreeEnable() +nsIFrameDebug::GetVerifyStyleTreeEnable() { -#ifdef NS_DEBUG if (gStyleVerifyTreeEnable == PRBool(0x55)) { if (nsnull == gStyleVerifyTreeLogModuleInfo) { gStyleVerifyTreeLogModuleInfo = PR_NewLogModule("styleverifytree"); @@ -152,24 +146,24 @@ nsIFrame::GetVerifyStyleTreeEnable() gStyleVerifyTreeEnable ? "en" : "dis"); } } -#endif return gStyleVerifyTreeEnable; } NS_LAYOUT void -nsIFrame::SetVerifyStyleTreeEnable(PRBool aEnabled) +nsIFrameDebug::SetVerifyStyleTreeEnable(PRBool aEnabled) { gStyleVerifyTreeEnable = aEnabled; } NS_LAYOUT PRLogModuleInfo* -nsIFrame::GetLogModuleInfo() +nsIFrameDebug::GetLogModuleInfo() { if (nsnull == gLogModule) { gLogModule = PR_NewLogModule("frame"); } return gLogModule; } +#endif //---------------------------------------------------------------------- @@ -1697,6 +1691,7 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) return result; } +#ifdef NS_DEBUG // Debugging NS_IMETHODIMP nsFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const @@ -1744,6 +1739,7 @@ nsFrame::MakeFrameName(const char* aType, nsString& aResult) const aResult.Append(buf); return NS_OK; } +#endif void nsFrame::XMLQuote(nsString& aString) @@ -1794,6 +1790,7 @@ nsFrame::ParentDisablesSelection() const */ } +#ifdef NS_DEBUG NS_IMETHODIMP nsFrame::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) { @@ -1861,7 +1858,11 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 } aIndent++; while (nsnull != kid) { - kid->DumpRegressionData(aPresContext, out, aIndent); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->DumpRegressionData(aPresContext, out, aIndent); + } kid->GetNextSibling(&kid); } aIndent--; @@ -1893,6 +1894,7 @@ nsFrame::VerifyTree() const NS_ASSERTION(0 == (mState & NS_FRAME_IN_REFLOW), "frame is in reflow"); return NS_OK; } +#endif /*this method may.. invalidate if the state was changed or if aForceRedraw is PR_TRUE it will not update immediately.*/ diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 0f2ef84071e8..e11f7858d0ca 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -22,6 +22,9 @@ #include "nsRect.h" #include "nsString.h" #include "prlog.h" +#ifdef NS_DEBUG +#include "nsIFrameDebug.h" +#endif /** * nsFrame logging constants. We redefine the nspr @@ -39,7 +42,7 @@ #ifdef NS_DEBUG #define NS_FRAME_LOG(_bit,_args) \ PR_BEGIN_MACRO \ - if (NS_FRAME_LOG_TEST(nsIFrame::GetLogModuleInfo(),_bit)) { \ + if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \ PR_LogPrint _args; \ } \ PR_END_MACRO @@ -56,14 +59,14 @@ // XXX remove me #define NS_FRAME_TRACE_MSG(_bit,_args) \ PR_BEGIN_MACRO \ - if (NS_FRAME_LOG_TEST(nsIFrame::GetLogModuleInfo(),_bit)) { \ + if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \ TraceMsg _args; \ } \ PR_END_MACRO #define NS_FRAME_TRACE(_bit,_args) \ PR_BEGIN_MACRO \ - if (NS_FRAME_LOG_TEST(nsIFrame::GetLogModuleInfo(),_bit)) { \ + if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \ TraceMsg _args; \ } \ PR_END_MACRO @@ -93,6 +96,9 @@ * behavior is to keep the frame and view position and size in sync. */ class nsFrame : public nsIFrame +#ifdef NS_DEBUG + , public nsIFrameDebug +#endif { public: /** @@ -215,11 +221,13 @@ public: NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const; NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling); NS_IMETHOD Scrolled(nsIView *aView); +#ifdef NS_DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; NS_IMETHOD VerifyTree() const; +#endif NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); NS_IMETHOD GetSelected(PRBool *aSelected) const; NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ; @@ -307,15 +315,18 @@ public: // Helper function that verifies that each frame in the list has the // NS_FRAME_IS_DIRTY bit set static void VerifyDirtyBitSet(nsIFrame* aFrameList); -#endif void ListTag(FILE* out) const { - ListTag(out, this); + ListTag(out, (nsIFrame*)this); } - static void ListTag(FILE* out, const nsIFrame* aFrame) { + static void ListTag(FILE* out, nsIFrame* aFrame) { nsAutoString tmp; - aFrame->GetFrameName(tmp); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(aFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + } fputs(tmp, out); fprintf(out, "@%p", aFrame); } @@ -323,6 +334,20 @@ public: static void IndentBy(FILE* out, PRInt32 aIndent) { while (--aIndent >= 0) fputs(" ", out); } + + /** + * Dump out the "base classes" regression data. This should dump + * out the interior data, not the "frame" XML container. And it + * should call the base classes same named method before doing + * anything specific in a derived class. This means that derived + * classes need not override DumpRegressionData unless they need + * some custom behavior that requires changing how the outer "frame" + * XML container is dumped. + */ + virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); + + nsresult MakeFrameName(const char* aKind, nsString& aResult) const; +#endif protected: // Protected constructor and destructor @@ -343,19 +368,6 @@ protected: static void GetLastLeaf(nsIFrame **aFrame); static void GetFirstLeaf(nsIFrame **aFrame); - /** - * Dump out the "base classes" regression data. This should dump - * out the interior data, not the "frame" XML container. And it - * should call the base classes same named method before doing - * anything specific in a derived class. This means that derived - * classes need not override DumpRegressionData unless they need - * some custom behavior that requires changing how the outer "frame" - * XML container is dumped. - */ - virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); - - nsresult MakeFrameName(const char* aKind, nsString& aResult) const; - static void XMLQuote(nsString& aString); virtual PRBool ParentDisablesSelection() const; diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index a5bb183de4c9..ab01b4bc5854 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -88,7 +88,9 @@ class nsHTMLFrameOuterFrame : public nsHTMLFrameOuterFrameSuper { public: nsHTMLFrameOuterFrame(); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; @@ -135,7 +137,9 @@ public: nsHTMLFrameInnerFrame(); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; @@ -286,10 +290,12 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext& aPresContext, } } +#ifdef DEBUG NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FrameOuter", aResult); } +#endif NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameType(nsIAtom** aType) const @@ -566,10 +572,12 @@ PRInt32 nsHTMLFrameInnerFrame::GetMarginHeight(nsIPresContext* aPresContext, nsI return marginHeight; } +#ifdef DEBUG NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FrameInner", aResult); } +#endif NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index 9edde9256d63..670edf754281 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -17,6 +17,9 @@ * Netscape Communications Corporation. All Rights Reserved. */ #include "nsFrameList.h" +#ifdef NS_DEBUG +#include "nsIFrameDebug.h" +#endif void nsFrameList::DestroyFrames(nsIPresContext& aPresContext) @@ -345,14 +348,20 @@ nsFrameList::VerifyParent(nsIFrame* aParent) const #endif } +#ifdef NS_DEBUG void nsFrameList::List(nsIPresContext* aPresContext, FILE* out) const { fputs("<\n", out); nsIFrame* frame = mFirstChild; while (nsnull != frame) { - frame->List(aPresContext, out, 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, 1); + } frame->GetNextSibling(&frame); } fputs(">\n", out); } +#endif diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index cac6933c36bf..ae8a611f6e12 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -121,7 +121,9 @@ public: void VerifyParent(nsIFrame* aParent) const; +#ifdef NS_DEBUG void List(nsIPresContext* aPresContext, FILE* out) const; +#endif protected: nsIFrame* mFirstChild; diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 0a00b7ccf343..3cd8ddfdd101 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -102,7 +102,9 @@ void nsFramesetDrag::UnSet() class nsHTMLFramesetBorderFrame : public nsLeafFrame { public: +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, @@ -153,7 +155,9 @@ protected: class nsHTMLFramesetBlankFrame : public nsLeafFrame { public: +#ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out = stdout, PRInt32 aIndent = 0) const; +#endif NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -1713,10 +1717,12 @@ nsHTMLFramesetBorderFrame::GetCursor(nsIPresContext& aPresContext, return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsHTMLFramesetBorderFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FramesetBorder", aResult); } +#endif /******************************************************************************* * nsHTMLFramesetBlankFrame @@ -1780,7 +1786,7 @@ nsHTMLFramesetBlankFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } - +#ifdef DEBUG NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const @@ -1789,4 +1795,4 @@ NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(nsIPresContext* aPresContext, fprintf(out, "%p BLANK \n", this); return nsLeafFrame::List(aPresContext, out, aIndent); } - +#endif diff --git a/layout/generic/nsFrameUtil.cpp b/layout/generic/nsFrameUtil.cpp index 0b63f0a6ddbb..4aadea472797 100644 --- a/layout/generic/nsFrameUtil.cpp +++ b/layout/generic/nsFrameUtil.cpp @@ -26,6 +26,7 @@ static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); +#ifdef NS_DEBUG class nsFrameUtil : public nsIFrameUtil { public: nsFrameUtil(); @@ -630,3 +631,4 @@ nsFrameUtil::DumpRegressionData(FILE* aInputFile, FILE* aOutputFile) } return NS_ERROR_FAILURE; } +#endif diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 9e58932208cb..3c76c0279a77 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -611,11 +611,13 @@ nsGfxScrollFrame::GetFrameType(nsIAtom** aType) const return nsHTMLContainerFrame::GetFrameType(aType); } +#ifdef NS_DEBUG NS_IMETHODIMP nsGfxScrollFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("GfxScroll", aResult); } +#endif NS_IMETHODIMP nsGfxScrollFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 8a96e2ec5111..ea206569edaf 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -107,7 +107,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif protected: nsGfxScrollFrame(nsIDocument* aDocument); diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index 684074646648..1df4d570719d 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -88,8 +88,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif @@ -445,13 +445,13 @@ RootFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP RootFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Root", aResult); } -#ifdef DEBUG NS_IMETHODIMP RootFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 691880f95a8c..5859ad886cbc 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -862,42 +862,7 @@ public: */ NS_IMETHOD Scrolled(nsIView *aView) = 0; - // Debugging - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0; - /** - * Get a printable from of the name of the frame type. - */ - NS_IMETHOD GetFrameName(nsString& aResult) const = 0; - - /** - * Called to dump out regression data that describes the layout - * of the frame and it's children, and so on. The format of the - * data is dictated to be XML (using a specific DTD); the - * specific kind of data dumped is up to the frame itself, with - * the caveat that some base types are defined. - * For more information, see XXX. - */ - NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) = 0; - - /** - * Get the size of the frame object. The size value should include - * all subordinate data referenced by the frame that is not - * accounted for by child frames. However, this value should not - * include the content objects, style contexts, views or other data - * that lies logically outside the frame system. - * - * If the implementation so chooses, instead of returning the total - * subordinate data it may instead use the sizeof handler to store - * away subordinate data under its own key so that the subordinate - * data may be tabulated independently of the frame itself. - * - * The caller is responsible for recursing over all child-lists that - * the frame supports. - */ - NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; - - NS_IMETHOD VerifyTree() const = 0; /** Selection related calls */ @@ -928,45 +893,6 @@ public: */ NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) = 0; - /** - * See if tree verification is enabled. To enable tree verification add - * "frameverifytree:1" to your NSPR_LOG_MODULES environment variable - * (any non-zero debug level will work). Or, call SetVerifyTreeEnable - * with PR_TRUE. - */ - static NS_LAYOUT PRBool GetVerifyTreeEnable(); - - /** - * Set the verify-tree enable flag. - */ - static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled); - - /** - * See if style tree verification is enabled. To enable style tree - * verification add "styleverifytree:1" to your NSPR_LOG_MODULES - * environment variable (any non-zero debug level will work). Or, - * call SetVerifyStyleTreeEnable with PR_TRUE. - */ - static NS_LAYOUT PRBool GetVerifyStyleTreeEnable(); - - /** - * Set the verify-style-tree enable flag. - */ - static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled); - - /** - * The frame class and related classes share an nspr log module - * for logging frame activity. - * - * Note: the log module is created during library initialization which - * means that you cannot perform logging before then. - */ - static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo(); - - // Show frame borders when rendering - static NS_LAYOUT void ShowFrameBorders(PRBool aEnable); - static NS_LAYOUT PRBool GetShowFrameBorders(); - private: NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; NS_IMETHOD_(nsrefcnt) Release(void) = 0; diff --git a/layout/generic/nsIFrameDebug.h b/layout/generic/nsIFrameDebug.h new file mode 100644 index 000000000000..b6057c85b2c2 --- /dev/null +++ b/layout/generic/nsIFrameDebug.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsIFrameDebug_h___ +#define nsIFrameDebug_h___ + +#include "nslayout.h" +#include "nsISupports.h" + +class nsIFrame; +class nsIPresContext; + +// IID for the nsIFrameDebug interface {a6cf9069-15b3-11d2-932e-00805f8add32} +#define NS_IFRAMEDEBUG_IID \ +{ 0xa6cf9069, 0x15b3, 0x11d2, \ + {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} + +/** + * Debug related functions + */ +class nsIFrameDebug : public nsISupports { +public: + static const nsIID& GetIID() { static nsIID iid = NS_IFRAMEDEBUG_IID; return iid; } + + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0; + + /** + * Get a printable from of the name of the frame type. + * XXX This should be eliminated and we use GetFrameType() instead... + */ + NS_IMETHOD GetFrameName(nsString& aResult) const = 0; + /** + * Called to dump out regression data that describes the layout + * of the frame and it's children, and so on. The format of the + * data is dictated to be XML (using a specific DTD); the + * specific kind of data dumped is up to the frame itself, with + * the caveat that some base types are defined. + * For more information, see XXX. + */ + NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) = 0; + + /** + * Get the size of the frame object. The size value should include + * all subordinate data referenced by the frame that is not + * accounted for by child frames. However, this value should not + * include the content objects, style contexts, views or other data + * that lies logically outside the frame system. + * + * If the implementation so chooses, instead of returning the total + * subordinate data it may instead use the sizeof handler to store + * away subordinate data under its own key so that the subordinate + * data may be tabulated independently of the frame itself. + * + * The caller is responsible for recursing over all child-lists that + * the frame supports. + */ + NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; + + NS_IMETHOD VerifyTree() const = 0; + + /** + * See if tree verification is enabled. To enable tree verification add + * "frameverifytree:1" to your NSPR_LOG_MODULES environment variable + * (any non-zero debug level will work). Or, call SetVerifyTreeEnable + * with PR_TRUE. + */ + static NS_LAYOUT PRBool GetVerifyTreeEnable(); + + /** + * Set the verify-tree enable flag. + */ + static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled); + + /** + * See if style tree verification is enabled. To enable style tree + * verification add "styleverifytree:1" to your NSPR_LOG_MODULES + * environment variable (any non-zero debug level will work). Or, + * call SetVerifyStyleTreeEnable with PR_TRUE. + */ + static NS_LAYOUT PRBool GetVerifyStyleTreeEnable(); + + /** + * Set the verify-style-tree enable flag. + */ + static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled); + + /** + * The frame class and related classes share an nspr log module + * for logging frame activity. + * + * Note: the log module is created during library initialization which + * means that you cannot perform logging before then. + */ + static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo(); + + // Show frame borders when rendering + static NS_LAYOUT void ShowFrameBorders(PRBool aEnable); + static NS_LAYOUT PRBool GetShowFrameBorders(); + +private: + NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; + NS_IMETHOD_(nsrefcnt) Release(void) = 0; +}; + +#endif /* nsIFrameDebug_h___ */ diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 14b6960639e5..028183dff567 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -517,6 +517,7 @@ nsImageFrame::Paint(nsIPresContext& aPresContext, aRenderingContext.DrawImage(image, inner); } +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { nsImageMap* map = GetImageMap(); @@ -531,6 +532,7 @@ nsImageFrame::Paint(nsIPresContext& aPresContext, aRenderingContext.PopState(clipState); } } +#endif } if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index 4cc079e2d64e..83371dc291d6 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -70,11 +70,13 @@ nsInlineFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsInlineFrameSuper::QueryInterface(aIID, aInstancePtr); } +#ifdef DEBUG NS_IMETHODIMP nsInlineFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Inline", aResult); } +#endif NS_IMETHODIMP nsInlineFrame::GetFrameType(nsIAtom** aType) const @@ -660,11 +662,13 @@ nsFirstLineFrame::nsFirstLineFrame() { } +#ifdef DEBUG NS_IMETHODIMP nsFirstLineFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Line", aResult); } +#endif NS_IMETHODIMP nsFirstLineFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/generic/nsInlineFrame.h b/layout/generic/nsInlineFrame.h index 2fcd9f0ddaca..aeecf814e43c 100644 --- a/layout/generic/nsInlineFrame.h +++ b/layout/generic/nsInlineFrame.h @@ -63,7 +63,9 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; // nsIHTMLReflow overrides diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index 96630034ec07..cc8cd7d52a2f 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -92,6 +92,7 @@ nsLineBox::Reset(nsIFrame* aFrame, PRInt32 aCount, PRBool aIsBlock) mFlags.mBlock = aIsBlock; } +#ifdef DEBUG static void ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters) { @@ -104,8 +105,12 @@ ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters) fprintf(out, "placeholder@%p ", ph); nsIFrame* frame = ph->GetOutOfFlowFrame(); if (nsnull != frame) { - frame->GetFrameName(frameName); - fputs(frameName, out); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(frameName); + fputs(frameName, out); + } } fprintf(out, " %s region={%d,%d,%d,%d} combinedArea={%d,%d,%d,%d}", fc->mIsCurrentLineFloater ? "cl" : "bcl", @@ -119,6 +124,7 @@ ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters) fc = fc->Next(); } } +#endif char* nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const @@ -132,6 +138,7 @@ nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const return aBuf; } +#ifdef DEBUG void nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { @@ -159,7 +166,11 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const nsIFrame* frame = mFirstChild; PRInt32 n = GetChildCount(); while (--n >= 0) { - frame->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } frame->GetNextSibling(&frame); } @@ -171,6 +182,7 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const } fputs(">\n", out); } +#endif nsIFrame* nsLineBox::LastChild() const diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h index d6a31515deff..aa8362eaf84a 100644 --- a/layout/generic/nsLineBox.h +++ b/layout/generic/nsLineBox.h @@ -261,7 +261,9 @@ public: static nsLineBox* FindLineContaining(nsLineBox* aLine, nsIFrame* aFrame, PRInt32* aFrameIndexInLine); +#ifdef DEBUG void List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; +#endif nsIFrame* LastChild() const; diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index ede0c3d1f0e1..12e514260b23 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -62,6 +62,7 @@ nsTextRun::~nsTextRun() MOZ_COUNT_DTOR(nsTextRun); } +#ifdef DEBUG void nsTextRun::List(FILE* out, PRInt32 aIndent) { @@ -72,12 +73,17 @@ nsTextRun::List(FILE* out, PRInt32 aIndent) for (i = 0; i < n; i++) { nsIFrame* text = (nsIFrame*) mArray.ElementAt(i); nsAutoString tmp; - text->GetFrameName(tmp); - fputs(tmp, out); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(text->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fputs(tmp, out); + } printf("@%p ", text); } fputs(">\n", out); } +#endif //---------------------------------------------------------------------- @@ -1827,11 +1833,13 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) const nsStyleText* textStyle; frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle); nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit(); +#ifdef DEBUG if (eStyleUnit_Inherit == verticalAlignUnit) { printf("XXX: vertical-align: inherit not implemented for "); nsFrame::ListTag(stdout, frame); printf("\n"); } +#endif #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, frame); diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index a8da72c75c48..f51f6d177772 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -200,7 +200,9 @@ public: NS_IMETHOD Scrolled(nsIView *aView); NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, @@ -402,11 +404,13 @@ nsObjectFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsObjectFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ObjectFrame", aResult); } +#endif nsresult nsObjectFrame::CreateWidget(nsIPresContext* aPresContext, diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 96e1d5712c9d..037dea9523c7 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -157,11 +157,13 @@ nsPageFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsPageFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Page", aResult); } +#endif NS_IMETHODIMP nsPageFrame::IsPercentageBase(PRBool& aBase) const diff --git a/layout/generic/nsPageFrame.h b/layout/generic/nsPageFrame.h index 63b0db8a1760..5d3a9e9e3931 100644 --- a/layout/generic/nsPageFrame.h +++ b/layout/generic/nsPageFrame.h @@ -38,8 +38,10 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef DEBUG // Debugging NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif protected: nsPageFrame(); diff --git a/layout/generic/nsPlaceholderFrame.cpp b/layout/generic/nsPlaceholderFrame.cpp index df905bd24c35..4ab2f1a9b03b 100644 --- a/layout/generic/nsPlaceholderFrame.cpp +++ b/layout/generic/nsPlaceholderFrame.cpp @@ -58,6 +58,16 @@ nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } +NS_IMETHODIMP +nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::placeholderFrame; + NS_ADDREF(*aType); + return NS_OK; +} + +#ifdef DEBUG NS_IMETHODIMP nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -78,16 +88,6 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const -{ - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::placeholderFrame; - NS_ADDREF(*aType); - return NS_OK; -} - - NS_IMETHODIMP nsPlaceholderFrame::GetFrameName(nsString& aResult) const { @@ -116,7 +116,6 @@ nsPlaceholderFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aInden return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsPlaceholderFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsPlaceholderFrame.h b/layout/generic/nsPlaceholderFrame.h index f8b888a22f65..0967ab2e7f18 100644 --- a/layout/generic/nsPlaceholderFrame.h +++ b/layout/generic/nsPlaceholderFrame.h @@ -42,11 +42,13 @@ public: nsReflowStatus& aStatus); // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; +#endif /** * Get the "type" of the frame @@ -55,9 +57,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #endif protected: diff --git a/layout/generic/nsSimplePageSequence.cpp b/layout/generic/nsSimplePageSequence.cpp index a97518238b33..d047a9b9827f 100644 --- a/layout/generic/nsSimplePageSequence.cpp +++ b/layout/generic/nsSimplePageSequence.cpp @@ -279,11 +279,13 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, //---------------------------------------------------------------------- +#ifdef DEBUG NS_IMETHODIMP nsSimplePageSequenceFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("SimplePageSequence", aResult); } +#endif NS_IMETHODIMP nsSimplePageSequenceFrame::Paint(nsIPresContext& aPresContext, diff --git a/layout/generic/nsSimplePageSequence.h b/layout/generic/nsSimplePageSequence.h index 48f05143a701..d17174bbca8b 100644 --- a/layout/generic/nsSimplePageSequence.h +++ b/layout/generic/nsSimplePageSequence.h @@ -47,8 +47,10 @@ public: const nsPrintOptions& aPrintOptions, nsIPrintStatusCallback* aStatusCallback); +#ifdef DEBUG // Debugging NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif protected: nsSimplePageSequenceFrame(); diff --git a/layout/generic/nsSpaceManager.cpp b/layout/generic/nsSpaceManager.cpp index c10126818908..3f845c7d6895 100644 --- a/layout/generic/nsSpaceManager.cpp +++ b/layout/generic/nsSpaceManager.cpp @@ -23,7 +23,9 @@ #include "nsVoidArray.h" #include "nsIFrame.h" #include "nsString.h" - +#ifdef DEBUG +#include "nsIFrameDebug.h" +#endif static NS_DEFINE_IID(kISpaceManagerIID, NS_ISPACEMANAGER_IID); ///////////////////////////////////////////////////////////////////////////// @@ -904,18 +906,22 @@ nsSpaceManager::ClearRegions() return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsSpaceManager::List(FILE* out) { -#ifdef DEBUG nsAutoString tmp; fprintf(out, "SpaceManager@%p", this); if (mFrame) { - mFrame->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); - fprintf(out, "@%p", mFrame); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(mFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fprintf(out, " frame="); + fputs(tmp, out); + fprintf(out, "@%p", mFrame); + } } fprintf(out, " xy=%d,%d <\n", mX, mY); if (mBandList.IsEmpty()) { @@ -928,10 +934,14 @@ nsSpaceManager::List(FILE* out) band->mLeft, band->mTop, band->mRight, band->mBottom, band->mNumFrames); if (1 == band->mNumFrames) { - band->mFrame->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); - fprintf(out, "@%p", band->mFrame); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(band->mFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fprintf(out, " frame="); + fputs(tmp, out); + fprintf(out, "@%p", band->mFrame); + } } else if (1 < band->mNumFrames) { fprintf(out, "\n "); @@ -940,9 +950,13 @@ nsSpaceManager::List(FILE* out) for (i = 0; i < n; i++) { nsIFrame* frame = (nsIFrame*) a->ElementAt(i); if (frame) { - frame->GetFrameName(tmp); - fputs(tmp, out); - fprintf(out, "@%p ", frame); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fputs(tmp, out); + fprintf(out, "@%p ", frame); + } } } } @@ -951,9 +965,9 @@ nsSpaceManager::List(FILE* out) } while (band != mBandList.Head()); } fprintf(out, ">\n"); -#endif return NS_OK; } +#endif nsSpaceManager::FrameInfo* nsSpaceManager::GetFrameInfoFor(nsIFrame* aFrame) diff --git a/layout/generic/nsSpaceManager.h b/layout/generic/nsSpaceManager.h index c682f74af405..4ecbd6e958c9 100644 --- a/layout/generic/nsSpaceManager.h +++ b/layout/generic/nsSpaceManager.h @@ -53,10 +53,10 @@ public: NS_IMETHOD RemoveRegion(nsIFrame* aFrame); NS_IMETHOD ClearRegions(); - NS_IMETHOD List(FILE* out); #ifdef DEBUG - void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; + NS_IMETHOD List(FILE* out); + void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif protected: diff --git a/layout/generic/nsSplittableFrame.cpp b/layout/generic/nsSplittableFrame.cpp index 17d487f71c8d..e0e703506bcd 100644 --- a/layout/generic/nsSplittableFrame.cpp +++ b/layout/generic/nsSplittableFrame.cpp @@ -154,6 +154,7 @@ nsIFrame * nsSplittableFrame::GetNextInFlow() return mNextInFlow; } +#ifdef DEBUG void nsSplittableFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) { @@ -169,7 +170,6 @@ nsSplittableFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* ou } -#ifdef DEBUG NS_IMETHODIMP nsSplittableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/generic/nsSplittableFrame.h b/layout/generic/nsSplittableFrame.h index 0f31de11b8ad..a8c65f415fa1 100644 --- a/layout/generic/nsSplittableFrame.h +++ b/layout/generic/nsSplittableFrame.h @@ -62,7 +62,9 @@ public: nsIFrame* GetNextInFlow(); protected: +#ifdef DEBUG virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); +#endif nsIFrame* mPrevInFlow; nsIFrame* mNextInFlow; diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 6b2b0ec33d32..f354552c77e0 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -313,8 +313,6 @@ public: return NS_OK; } - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; - /** * Get the "type" of the frame * @@ -322,10 +320,10 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #endif NS_IMETHOD GetPosition(nsIPresContext& aCX, @@ -3424,7 +3422,6 @@ nsTextFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const *aResult = sizeof(*this); return NS_OK; } -#endif NS_IMETHODIMP nsTextFrame::GetFrameName(nsString& aResult) const @@ -3487,3 +3484,5 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons return NS_OK; } +#endif + diff --git a/layout/generic/nsViewportFrame.cpp b/layout/generic/nsViewportFrame.cpp index 422a545b5614..19e43394d599 100644 --- a/layout/generic/nsViewportFrame.cpp +++ b/layout/generic/nsViewportFrame.cpp @@ -82,8 +82,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif @@ -563,13 +563,13 @@ ViewportFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP ViewportFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Viewport", aResult); } -#ifdef DEBUG NS_IMETHODIMP ViewportFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsAreaFrame.cpp b/layout/html/base/src/nsAreaFrame.cpp index fb3c0674d1a6..ab817e1e3878 100644 --- a/layout/html/base/src/nsAreaFrame.cpp +++ b/layout/html/base/src/nsAreaFrame.cpp @@ -378,13 +378,13 @@ nsAreaFrame::DidReflow(nsIPresContext& aPresContext, ///////////////////////////////////////////////////////////////////////////// // Diagnostics +#ifdef NS_DEBUG NS_IMETHODIMP nsAreaFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Area", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsAreaFrame.h b/layout/html/base/src/nsAreaFrame.h index 2b7ffa508f21..e9d80dd0a0a3 100644 --- a/layout/html/base/src/nsAreaFrame.h +++ b/layout/html/base/src/nsAreaFrame.h @@ -88,9 +88,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif diff --git a/layout/html/base/src/nsBRFrame.cpp b/layout/html/base/src/nsBRFrame.cpp index 9619a3d7cf86..217f9d955a16 100644 --- a/layout/html/base/src/nsBRFrame.cpp +++ b/layout/html/base/src/nsBRFrame.cpp @@ -30,10 +30,12 @@ class BRFrame : public nsFrame { public: // nsIFrame +#ifdef NS_DEBUG NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); +#endif // nsIHTMLReflow NS_IMETHOD Reflow(nsIPresContext& aPresContext, @@ -70,6 +72,7 @@ BRFrame::~BRFrame() { } +#ifdef NS_DEBUG NS_IMETHODIMP BRFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -85,6 +88,7 @@ BRFrame::Paint(nsIPresContext& aPresContext, } return NS_OK; } +#endif NS_IMETHODIMP BRFrame::Reflow(nsIPresContext& aPresContext, diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 7e1ffee39b89..c50305ea44f2 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -1158,6 +1158,7 @@ nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } +#ifdef DEBUG static void ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) { @@ -1170,7 +1171,6 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) NS_METHOD nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { -#ifdef DEBUG IndentBy(out, aIndent); ListTag(out); nsIView* view; @@ -1242,7 +1242,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1266,7 +1270,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); -#endif return NS_OK; } @@ -1275,6 +1278,7 @@ nsBlockFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Block", aResult); } +#endif NS_IMETHODIMP nsBlockFrame::GetFrameType(nsIAtom** aType) const @@ -5682,7 +5686,6 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) } return PR_FALSE; } -#endif NS_IMETHODIMP nsBlockFrame::VerifyTree() const @@ -5691,7 +5694,6 @@ nsBlockFrame::VerifyTree() const return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsBlockFrame.h b/layout/html/base/src/nsBlockFrame.h index aabaf7359048..103f99b2900d 100644 --- a/layout/html/base/src/nsBlockFrame.h +++ b/layout/html/base/src/nsBlockFrame.h @@ -90,13 +90,13 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; -#endif NS_IMETHOD VerifyTree() const; +#endif NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index 7e1ffee39b89..c50305ea44f2 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -1158,6 +1158,7 @@ nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } +#ifdef DEBUG static void ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) { @@ -1170,7 +1171,6 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) NS_METHOD nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { -#ifdef DEBUG IndentBy(out, aIndent); ListTag(out); nsIView* view; @@ -1242,7 +1242,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1266,7 +1270,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); -#endif return NS_OK; } @@ -1275,6 +1278,7 @@ nsBlockFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Block", aResult); } +#endif NS_IMETHODIMP nsBlockFrame::GetFrameType(nsIAtom** aType) const @@ -5682,7 +5686,6 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) } return PR_FALSE; } -#endif NS_IMETHODIMP nsBlockFrame::VerifyTree() const @@ -5691,7 +5694,6 @@ nsBlockFrame::VerifyTree() const return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index 7e1ffee39b89..c50305ea44f2 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -1158,6 +1158,7 @@ nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const return NS_OK; } +#ifdef DEBUG static void ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) { @@ -1170,7 +1171,6 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) NS_METHOD nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { -#ifdef DEBUG IndentBy(out, aIndent); ListTag(out); nsIView* view; @@ -1242,7 +1242,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1266,7 +1270,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); -#endif return NS_OK; } @@ -1275,6 +1278,7 @@ nsBlockFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Block", aResult); } +#endif NS_IMETHODIMP nsBlockFrame::GetFrameType(nsIAtom** aType) const @@ -5682,7 +5686,6 @@ nsBlockFrame::IsChild(nsIFrame* aFrame) } return PR_FALSE; } -#endif NS_IMETHODIMP nsBlockFrame::VerifyTree() const @@ -5691,7 +5694,6 @@ nsBlockFrame::VerifyTree() const return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsBlockFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsBulletFrame.cpp b/layout/html/base/src/nsBulletFrame.cpp index 0a59066ee7b5..ec26ccb88c82 100644 --- a/layout/html/base/src/nsBulletFrame.cpp +++ b/layout/html/base/src/nsBulletFrame.cpp @@ -86,11 +86,13 @@ nsBulletFrame::Init(nsIPresContext& aPresContext, return NS_OK; } +#ifdef NS_DEBUG NS_IMETHODIMP nsBulletFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Bullet", aResult); } +#endif NS_IMETHODIMP nsBulletFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/html/base/src/nsBulletFrame.h b/layout/html/base/src/nsBulletFrame.h index e092d9b503b3..395a4b5d1d0a 100644 --- a/layout/html/base/src/nsBulletFrame.h +++ b/layout/html/base/src/nsBulletFrame.h @@ -44,7 +44,9 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif // nsIHTMLReflow NS_IMETHOD Reflow(nsIPresContext& aPresContext, diff --git a/layout/html/base/src/nsContainerFrame.cpp b/layout/html/base/src/nsContainerFrame.cpp index 76102af7c36a..4b89e43e9e99 100644 --- a/layout/html/base/src/nsContainerFrame.cpp +++ b/layout/html/base/src/nsContainerFrame.cpp @@ -248,7 +248,7 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, #ifdef NS_DEBUG // Draw a border around the child - if (nsIFrame::GetShowFrameBorders() && !kidRect.IsEmpty()) { + if (nsIFrameDebug::GetShowFrameBorders() && !kidRect.IsEmpty()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(kidRect); } @@ -605,6 +605,7 @@ nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) ///////////////////////////////////////////////////////////////////////////// // Debugging +#ifdef NS_DEBUG NS_IMETHODIMP nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { @@ -649,7 +650,11 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) } fputs("<\n", out); while (nsnull != kid) { - kid->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -666,7 +671,6 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsContainerFrame.h b/layout/html/base/src/nsContainerFrame.h index 6ec21ed5a386..cd44cffb7717 100644 --- a/layout/html/base/src/nsContainerFrame.h +++ b/layout/html/base/src/nsContainerFrame.h @@ -45,8 +45,8 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; #ifdef DEBUG + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif diff --git a/layout/html/base/src/nsFirstLetterFrame.cpp b/layout/html/base/src/nsFirstLetterFrame.cpp index 00c9a5e86e9c..de17a9083823 100644 --- a/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/layout/html/base/src/nsFirstLetterFrame.cpp @@ -41,7 +41,9 @@ public: NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, nsIFrame* aChildList); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -74,11 +76,13 @@ nsFirstLetterFrame::nsFirstLetterFrame() { } +#ifdef NS_DEBUG NS_IMETHODIMP nsFirstLetterFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Letter", aResult); } +#endif NS_IMETHODIMP nsFirstLetterFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index ea1a3fa58f10..838ade95c5a9 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -88,14 +88,15 @@ static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aSta //---------------------------------------------------------------------- +#ifdef NS_DEBUG static PRBool gShowFrameBorders = PR_FALSE; -NS_LAYOUT void nsIFrame::ShowFrameBorders(PRBool aEnable) +NS_LAYOUT void nsIFrameDebug::ShowFrameBorders(PRBool aEnable) { gShowFrameBorders = aEnable; } -NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders() +NS_LAYOUT PRBool nsIFrameDebug::GetShowFrameBorders() { return gShowFrameBorders; } @@ -106,16 +107,13 @@ NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders() */ static PRLogModuleInfo* gLogModule; -#ifdef NS_DEBUG static PRLogModuleInfo* gFrameVerifyTreeLogModuleInfo; -#endif static PRBool gFrameVerifyTreeEnable = PRBool(0x55); NS_LAYOUT PRBool -nsIFrame::GetVerifyTreeEnable() +nsIFrameDebug::GetVerifyTreeEnable() { -#ifdef NS_DEBUG if (gFrameVerifyTreeEnable == PRBool(0x55)) { if (nsnull == gFrameVerifyTreeLogModuleInfo) { gFrameVerifyTreeLogModuleInfo = PR_NewLogModule("frameverifytree"); @@ -124,26 +122,22 @@ nsIFrame::GetVerifyTreeEnable() gFrameVerifyTreeEnable ? "en" : "dis"); } } -#endif return gFrameVerifyTreeEnable; } NS_LAYOUT void -nsIFrame::SetVerifyTreeEnable(PRBool aEnabled) +nsIFrameDebug::SetVerifyTreeEnable(PRBool aEnabled) { gFrameVerifyTreeEnable = aEnabled; } -#ifdef NS_DEBUG static PRLogModuleInfo* gStyleVerifyTreeLogModuleInfo; -#endif static PRBool gStyleVerifyTreeEnable = PRBool(0x55); NS_LAYOUT PRBool -nsIFrame::GetVerifyStyleTreeEnable() +nsIFrameDebug::GetVerifyStyleTreeEnable() { -#ifdef NS_DEBUG if (gStyleVerifyTreeEnable == PRBool(0x55)) { if (nsnull == gStyleVerifyTreeLogModuleInfo) { gStyleVerifyTreeLogModuleInfo = PR_NewLogModule("styleverifytree"); @@ -152,24 +146,24 @@ nsIFrame::GetVerifyStyleTreeEnable() gStyleVerifyTreeEnable ? "en" : "dis"); } } -#endif return gStyleVerifyTreeEnable; } NS_LAYOUT void -nsIFrame::SetVerifyStyleTreeEnable(PRBool aEnabled) +nsIFrameDebug::SetVerifyStyleTreeEnable(PRBool aEnabled) { gStyleVerifyTreeEnable = aEnabled; } NS_LAYOUT PRLogModuleInfo* -nsIFrame::GetLogModuleInfo() +nsIFrameDebug::GetLogModuleInfo() { if (nsnull == gLogModule) { gLogModule = PR_NewLogModule("frame"); } return gLogModule; } +#endif //---------------------------------------------------------------------- @@ -1697,6 +1691,7 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) return result; } +#ifdef NS_DEBUG // Debugging NS_IMETHODIMP nsFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const @@ -1744,6 +1739,7 @@ nsFrame::MakeFrameName(const char* aType, nsString& aResult) const aResult.Append(buf); return NS_OK; } +#endif void nsFrame::XMLQuote(nsString& aString) @@ -1794,6 +1790,7 @@ nsFrame::ParentDisablesSelection() const */ } +#ifdef NS_DEBUG NS_IMETHODIMP nsFrame::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) { @@ -1861,7 +1858,11 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 } aIndent++; while (nsnull != kid) { - kid->DumpRegressionData(aPresContext, out, aIndent); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->DumpRegressionData(aPresContext, out, aIndent); + } kid->GetNextSibling(&kid); } aIndent--; @@ -1893,6 +1894,7 @@ nsFrame::VerifyTree() const NS_ASSERTION(0 == (mState & NS_FRAME_IN_REFLOW), "frame is in reflow"); return NS_OK; } +#endif /*this method may.. invalidate if the state was changed or if aForceRedraw is PR_TRUE it will not update immediately.*/ diff --git a/layout/html/base/src/nsFrame.h b/layout/html/base/src/nsFrame.h index 0f2ef84071e8..e11f7858d0ca 100644 --- a/layout/html/base/src/nsFrame.h +++ b/layout/html/base/src/nsFrame.h @@ -22,6 +22,9 @@ #include "nsRect.h" #include "nsString.h" #include "prlog.h" +#ifdef NS_DEBUG +#include "nsIFrameDebug.h" +#endif /** * nsFrame logging constants. We redefine the nspr @@ -39,7 +42,7 @@ #ifdef NS_DEBUG #define NS_FRAME_LOG(_bit,_args) \ PR_BEGIN_MACRO \ - if (NS_FRAME_LOG_TEST(nsIFrame::GetLogModuleInfo(),_bit)) { \ + if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \ PR_LogPrint _args; \ } \ PR_END_MACRO @@ -56,14 +59,14 @@ // XXX remove me #define NS_FRAME_TRACE_MSG(_bit,_args) \ PR_BEGIN_MACRO \ - if (NS_FRAME_LOG_TEST(nsIFrame::GetLogModuleInfo(),_bit)) { \ + if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \ TraceMsg _args; \ } \ PR_END_MACRO #define NS_FRAME_TRACE(_bit,_args) \ PR_BEGIN_MACRO \ - if (NS_FRAME_LOG_TEST(nsIFrame::GetLogModuleInfo(),_bit)) { \ + if (NS_FRAME_LOG_TEST(nsIFrameDebug::GetLogModuleInfo(),_bit)) { \ TraceMsg _args; \ } \ PR_END_MACRO @@ -93,6 +96,9 @@ * behavior is to keep the frame and view position and size in sync. */ class nsFrame : public nsIFrame +#ifdef NS_DEBUG + , public nsIFrameDebug +#endif { public: /** @@ -215,11 +221,13 @@ public: NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const; NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling); NS_IMETHOD Scrolled(nsIView *aView); +#ifdef NS_DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; NS_IMETHOD VerifyTree() const; +#endif NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); NS_IMETHOD GetSelected(PRBool *aSelected) const; NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ; @@ -307,15 +315,18 @@ public: // Helper function that verifies that each frame in the list has the // NS_FRAME_IS_DIRTY bit set static void VerifyDirtyBitSet(nsIFrame* aFrameList); -#endif void ListTag(FILE* out) const { - ListTag(out, this); + ListTag(out, (nsIFrame*)this); } - static void ListTag(FILE* out, const nsIFrame* aFrame) { + static void ListTag(FILE* out, nsIFrame* aFrame) { nsAutoString tmp; - aFrame->GetFrameName(tmp); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(aFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + } fputs(tmp, out); fprintf(out, "@%p", aFrame); } @@ -323,6 +334,20 @@ public: static void IndentBy(FILE* out, PRInt32 aIndent) { while (--aIndent >= 0) fputs(" ", out); } + + /** + * Dump out the "base classes" regression data. This should dump + * out the interior data, not the "frame" XML container. And it + * should call the base classes same named method before doing + * anything specific in a derived class. This means that derived + * classes need not override DumpRegressionData unless they need + * some custom behavior that requires changing how the outer "frame" + * XML container is dumped. + */ + virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); + + nsresult MakeFrameName(const char* aKind, nsString& aResult) const; +#endif protected: // Protected constructor and destructor @@ -343,19 +368,6 @@ protected: static void GetLastLeaf(nsIFrame **aFrame); static void GetFirstLeaf(nsIFrame **aFrame); - /** - * Dump out the "base classes" regression data. This should dump - * out the interior data, not the "frame" XML container. And it - * should call the base classes same named method before doing - * anything specific in a derived class. This means that derived - * classes need not override DumpRegressionData unless they need - * some custom behavior that requires changing how the outer "frame" - * XML container is dumped. - */ - virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); - - nsresult MakeFrameName(const char* aKind, nsString& aResult) const; - static void XMLQuote(nsString& aString); virtual PRBool ParentDisablesSelection() const; diff --git a/layout/html/base/src/nsFrameManager.cpp b/layout/html/base/src/nsFrameManager.cpp index 4fd2442ba7c5..45c203ca4dea 100644 --- a/layout/html/base/src/nsFrameManager.cpp +++ b/layout/html/base/src/nsFrameManager.cpp @@ -819,8 +819,12 @@ DumpContext(nsIFrame* aFrame, nsIStyleContext* aContext) if (aFrame) { fputs("frame: ", stdout); nsAutoString name; - aFrame->GetFrameName(name); - fputs(name, stdout); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(aFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + fputs(name, stdout); + } fprintf(stdout, " (%p)", aFrame); } if (aContext) { diff --git a/layout/html/base/src/nsGfxScrollFrame.cpp b/layout/html/base/src/nsGfxScrollFrame.cpp index 9e58932208cb..3c76c0279a77 100644 --- a/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/layout/html/base/src/nsGfxScrollFrame.cpp @@ -611,11 +611,13 @@ nsGfxScrollFrame::GetFrameType(nsIAtom** aType) const return nsHTMLContainerFrame::GetFrameType(aType); } +#ifdef NS_DEBUG NS_IMETHODIMP nsGfxScrollFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("GfxScroll", aResult); } +#endif NS_IMETHODIMP nsGfxScrollFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) diff --git a/layout/html/base/src/nsGfxScrollFrame.h b/layout/html/base/src/nsGfxScrollFrame.h index 8a96e2ec5111..ea206569edaf 100644 --- a/layout/html/base/src/nsGfxScrollFrame.h +++ b/layout/html/base/src/nsGfxScrollFrame.h @@ -107,7 +107,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif protected: nsGfxScrollFrame(nsIDocument* aDocument); diff --git a/layout/html/base/src/nsHTMLFrame.cpp b/layout/html/base/src/nsHTMLFrame.cpp index 684074646648..1df4d570719d 100644 --- a/layout/html/base/src/nsHTMLFrame.cpp +++ b/layout/html/base/src/nsHTMLFrame.cpp @@ -88,8 +88,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif @@ -445,13 +445,13 @@ RootFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP RootFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Root", aResult); } -#ifdef DEBUG NS_IMETHODIMP RootFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsImageFrame.cpp b/layout/html/base/src/nsImageFrame.cpp index 14b6960639e5..028183dff567 100644 --- a/layout/html/base/src/nsImageFrame.cpp +++ b/layout/html/base/src/nsImageFrame.cpp @@ -517,6 +517,7 @@ nsImageFrame::Paint(nsIPresContext& aPresContext, aRenderingContext.DrawImage(image, inner); } +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { nsImageMap* map = GetImageMap(); @@ -531,6 +532,7 @@ nsImageFrame::Paint(nsIPresContext& aPresContext, aRenderingContext.PopState(clipState); } } +#endif } if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { diff --git a/layout/html/base/src/nsInlineFrame.cpp b/layout/html/base/src/nsInlineFrame.cpp index 4cc079e2d64e..83371dc291d6 100644 --- a/layout/html/base/src/nsInlineFrame.cpp +++ b/layout/html/base/src/nsInlineFrame.cpp @@ -70,11 +70,13 @@ nsInlineFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsInlineFrameSuper::QueryInterface(aIID, aInstancePtr); } +#ifdef DEBUG NS_IMETHODIMP nsInlineFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Inline", aResult); } +#endif NS_IMETHODIMP nsInlineFrame::GetFrameType(nsIAtom** aType) const @@ -660,11 +662,13 @@ nsFirstLineFrame::nsFirstLineFrame() { } +#ifdef DEBUG NS_IMETHODIMP nsFirstLineFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Line", aResult); } +#endif NS_IMETHODIMP nsFirstLineFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/html/base/src/nsInlineFrame.h b/layout/html/base/src/nsInlineFrame.h index 2fcd9f0ddaca..aeecf814e43c 100644 --- a/layout/html/base/src/nsInlineFrame.h +++ b/layout/html/base/src/nsInlineFrame.h @@ -63,7 +63,9 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; // nsIHTMLReflow overrides diff --git a/layout/html/base/src/nsLineBox.cpp b/layout/html/base/src/nsLineBox.cpp index 96630034ec07..cc8cd7d52a2f 100644 --- a/layout/html/base/src/nsLineBox.cpp +++ b/layout/html/base/src/nsLineBox.cpp @@ -92,6 +92,7 @@ nsLineBox::Reset(nsIFrame* aFrame, PRInt32 aCount, PRBool aIsBlock) mFlags.mBlock = aIsBlock; } +#ifdef DEBUG static void ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters) { @@ -104,8 +105,12 @@ ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters) fprintf(out, "placeholder@%p ", ph); nsIFrame* frame = ph->GetOutOfFlowFrame(); if (nsnull != frame) { - frame->GetFrameName(frameName); - fputs(frameName, out); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(frameName); + fputs(frameName, out); + } } fprintf(out, " %s region={%d,%d,%d,%d} combinedArea={%d,%d,%d,%d}", fc->mIsCurrentLineFloater ? "cl" : "bcl", @@ -119,6 +124,7 @@ ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters) fc = fc->Next(); } } +#endif char* nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const @@ -132,6 +138,7 @@ nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const return aBuf; } +#ifdef DEBUG void nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { @@ -159,7 +166,11 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const nsIFrame* frame = mFirstChild; PRInt32 n = GetChildCount(); while (--n >= 0) { - frame->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(frame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } frame->GetNextSibling(&frame); } @@ -171,6 +182,7 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const } fputs(">\n", out); } +#endif nsIFrame* nsLineBox::LastChild() const diff --git a/layout/html/base/src/nsLineBox.h b/layout/html/base/src/nsLineBox.h index d6a31515deff..aa8362eaf84a 100644 --- a/layout/html/base/src/nsLineBox.h +++ b/layout/html/base/src/nsLineBox.h @@ -261,7 +261,9 @@ public: static nsLineBox* FindLineContaining(nsLineBox* aLine, nsIFrame* aFrame, PRInt32* aFrameIndexInLine); +#ifdef DEBUG void List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; +#endif nsIFrame* LastChild() const; diff --git a/layout/html/base/src/nsLineLayout.cpp b/layout/html/base/src/nsLineLayout.cpp index ede0c3d1f0e1..12e514260b23 100644 --- a/layout/html/base/src/nsLineLayout.cpp +++ b/layout/html/base/src/nsLineLayout.cpp @@ -62,6 +62,7 @@ nsTextRun::~nsTextRun() MOZ_COUNT_DTOR(nsTextRun); } +#ifdef DEBUG void nsTextRun::List(FILE* out, PRInt32 aIndent) { @@ -72,12 +73,17 @@ nsTextRun::List(FILE* out, PRInt32 aIndent) for (i = 0; i < n; i++) { nsIFrame* text = (nsIFrame*) mArray.ElementAt(i); nsAutoString tmp; - text->GetFrameName(tmp); - fputs(tmp, out); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(text->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(tmp); + fputs(tmp, out); + } printf("@%p ", text); } fputs(">\n", out); } +#endif //---------------------------------------------------------------------- @@ -1827,11 +1833,13 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) const nsStyleText* textStyle; frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle); nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit(); +#ifdef DEBUG if (eStyleUnit_Inherit == verticalAlignUnit) { printf("XXX: vertical-align: inherit not implemented for "); nsFrame::ListTag(stdout, frame); printf("\n"); } +#endif #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, frame); diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index a8da72c75c48..f51f6d177772 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -200,7 +200,9 @@ public: NS_IMETHOD Scrolled(nsIView *aView); NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, @@ -402,11 +404,13 @@ nsObjectFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsObjectFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ObjectFrame", aResult); } +#endif nsresult nsObjectFrame::CreateWidget(nsIPresContext* aPresContext, diff --git a/layout/html/base/src/nsPageFrame.cpp b/layout/html/base/src/nsPageFrame.cpp index 96e1d5712c9d..037dea9523c7 100644 --- a/layout/html/base/src/nsPageFrame.cpp +++ b/layout/html/base/src/nsPageFrame.cpp @@ -157,11 +157,13 @@ nsPageFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsPageFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Page", aResult); } +#endif NS_IMETHODIMP nsPageFrame::IsPercentageBase(PRBool& aBase) const diff --git a/layout/html/base/src/nsPageFrame.h b/layout/html/base/src/nsPageFrame.h index 63b0db8a1760..5d3a9e9e3931 100644 --- a/layout/html/base/src/nsPageFrame.h +++ b/layout/html/base/src/nsPageFrame.h @@ -38,8 +38,10 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef DEBUG // Debugging NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif protected: nsPageFrame(); diff --git a/layout/html/base/src/nsPlaceholderFrame.cpp b/layout/html/base/src/nsPlaceholderFrame.cpp index df905bd24c35..4ab2f1a9b03b 100644 --- a/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/layout/html/base/src/nsPlaceholderFrame.cpp @@ -58,6 +58,16 @@ nsPlaceholderFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } +NS_IMETHODIMP +nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::placeholderFrame; + NS_ADDREF(*aType); + return NS_OK; +} + +#ifdef DEBUG NS_IMETHODIMP nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -78,16 +88,6 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const -{ - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::placeholderFrame; - NS_ADDREF(*aType); - return NS_OK; -} - - NS_IMETHODIMP nsPlaceholderFrame::GetFrameName(nsString& aResult) const { @@ -116,7 +116,6 @@ nsPlaceholderFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aInden return NS_OK; } -#ifdef DEBUG NS_IMETHODIMP nsPlaceholderFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsPlaceholderFrame.h b/layout/html/base/src/nsPlaceholderFrame.h index f8b888a22f65..0967ab2e7f18 100644 --- a/layout/html/base/src/nsPlaceholderFrame.h +++ b/layout/html/base/src/nsPlaceholderFrame.h @@ -42,11 +42,13 @@ public: nsReflowStatus& aStatus); // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; +#endif /** * Get the "type" of the frame @@ -55,9 +57,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #endif protected: diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 8070e1c9a991..fa00682063d1 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -69,6 +69,9 @@ #ifdef MOZ_PERF_METRICS #include "nsITimeRecorder.h" #endif +#ifdef NS_DEBUG +#include "nsIFrameDebug.h" +#endif // Drag & Drop, Clipboard #include "nsWidgetsCID.h" @@ -326,8 +329,9 @@ protected: PRBool mCaretEnabled; -#ifdef NS_DEBUG nsresult CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult); + +#ifdef NS_DEBUG PRBool VerifyIncrementalReflow(); PRBool mInVerifyReflow; #endif @@ -380,7 +384,7 @@ private: static void VerifyStyleTree(nsIFrameManager* aFrameManager) { - if (aFrameManager && nsIFrame::GetVerifyStyleTreeEnable()) { + if (aFrameManager && nsIFrameDebug::GetVerifyStyleTreeEnable()) { nsIFrame* rootFrame; aFrameManager->GetRootFrame(&rootFrame); @@ -927,8 +931,12 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight)); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif #ifdef DEBUG_kipp @@ -951,8 +959,12 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height)); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif VERIFY_STYLE_TREE; @@ -1004,8 +1016,12 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::ResizeReflow: %d,%d", aWidth, aHeight)); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif #ifdef DEBUG_kipp @@ -1026,8 +1042,12 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) rootFrame->Reflow(*mPresContext, desiredSize, reflowState, status); rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif VERIFY_STYLE_TREE; @@ -1183,8 +1203,12 @@ PresShell::StyleChangeReflow() NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("enter nsPresShell::StyleChangeReflow")); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif nsRect bounds; @@ -1203,8 +1227,12 @@ PresShell::StyleChangeReflow() rootFrame->Reflow(*mPresContext, desiredSize, reflowState, status); rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } #endif VERIFY_STYLE_TREE; @@ -1431,8 +1459,12 @@ PresShell::ProcessReflowCommands() NS_IF_RELEASE(rcx); #ifdef DEBUG - if (nsIFrame::GetVerifyTreeEnable()) { - rootFrame->VerifyTree(); + if (nsIFrameDebug::GetVerifyTreeEnable()) { + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->VerifyTree(); + } } if (GetVerifyReflowEnable()) { // First synchronously render what we have so far so that we can @@ -2085,7 +2117,7 @@ PresShell::Paint(nsIView *aView, #ifdef NS_DEBUG // Draw a border around the frame - if (nsIFrame::GetShowFrameBorders()) { + if (nsIFrameDebug::GetShowFrameBorders()) { nsRect r; frame->GetRect(r); aRenderingContext.SetColor(NS_RGB(0,0,255)); @@ -2273,7 +2305,11 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) printf("verifyreflow: "); nsAutoString name; if (nsnull != k1) { - k1->GetFrameName(name); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k1->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + } } else { name = "(null)"; @@ -2283,7 +2319,11 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) printf(" != "); if (nsnull != k2) { - k2->GetFrameName(name); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k2->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + } } else { name = "(null)"; @@ -2299,14 +2339,20 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, { printf("verifyreflow: "); nsAutoString name; - k1->GetFrameName(name); - fputs(name, stdout); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(k1->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + fputs(name, stdout); + } printf("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height); printf(" != "); - k2->GetFrameName(name); - fputs(name, stdout); + if (NS_SUCCEEDED(k2->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->GetFrameName(name); + fputs(name, stdout); + } printf("{%d, %d, %d, %d}", r2.x, r2.y, r2.width, r2.height); printf(" %s\n", aMsg); @@ -2445,6 +2491,7 @@ CompareTrees(nsIPresContext* aPresContext, nsIFrame* aA, nsIFrame* aB) return ok; } +#endif #if 0 static nsIFrame* @@ -2522,6 +2569,7 @@ PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult) return NS_OK; } +#ifdef DEBUG // After an incremental reflow, we verify the correctness by doing a // full reflow into a fresh frame tree. PRBool @@ -2640,9 +2688,15 @@ PresShell::VerifyIncrementalReflow() PRBool ok = CompareTrees(mPresContext, root1, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { printf("Verify reflow failed, primary tree:\n"); - root1->List(mPresContext, stdout, 0); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(root1->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(mPresContext, stdout, 0); + } printf("Verification tree:\n"); - root2->List(mPresContext, stdout, 0); + if (NS_SUCCEEDED(root2->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(mPresContext, stdout, 0); + } } // printf("Incremental reflow doomed view tree:\n"); diff --git a/layout/html/base/src/nsScrollFrame.cpp b/layout/html/base/src/nsScrollFrame.cpp index 38fa4f84eaab..8807ebea0b8c 100644 --- a/layout/html/base/src/nsScrollFrame.cpp +++ b/layout/html/base/src/nsScrollFrame.cpp @@ -796,13 +796,13 @@ nsScrollFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsScrollFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Scroll", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsScrollFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsScrollFrame.h b/layout/html/base/src/nsScrollFrame.h index b677f455b2b6..43c0246a260e 100644 --- a/layout/html/base/src/nsScrollFrame.h +++ b/layout/html/base/src/nsScrollFrame.h @@ -85,8 +85,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif diff --git a/layout/html/base/src/nsScrollPortFrame.cpp b/layout/html/base/src/nsScrollPortFrame.cpp index 743d16b624b0..039232f1d6de 100644 --- a/layout/html/base/src/nsScrollPortFrame.cpp +++ b/layout/html/base/src/nsScrollPortFrame.cpp @@ -545,11 +545,13 @@ nsScrollPortFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef NS_DEBUG NS_IMETHODIMP nsScrollPortFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Scroll", aResult); } +#endif /** * Goes though each child asking for its size to determine our size. Returns our box size minus our border. diff --git a/layout/html/base/src/nsScrollPortFrame.h b/layout/html/base/src/nsScrollPortFrame.h index 9ed03397043d..ec4f608cc484 100644 --- a/layout/html/base/src/nsScrollPortFrame.h +++ b/layout/html/base/src/nsScrollPortFrame.h @@ -86,7 +86,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif // nsIBox methods NS_IMETHOD GetBoxInfo(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize); diff --git a/layout/html/base/src/nsSimplePageSequence.cpp b/layout/html/base/src/nsSimplePageSequence.cpp index a97518238b33..d047a9b9827f 100644 --- a/layout/html/base/src/nsSimplePageSequence.cpp +++ b/layout/html/base/src/nsSimplePageSequence.cpp @@ -279,11 +279,13 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, //---------------------------------------------------------------------- +#ifdef DEBUG NS_IMETHODIMP nsSimplePageSequenceFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("SimplePageSequence", aResult); } +#endif NS_IMETHODIMP nsSimplePageSequenceFrame::Paint(nsIPresContext& aPresContext, diff --git a/layout/html/base/src/nsSimplePageSequence.h b/layout/html/base/src/nsSimplePageSequence.h index 48f05143a701..d17174bbca8b 100644 --- a/layout/html/base/src/nsSimplePageSequence.h +++ b/layout/html/base/src/nsSimplePageSequence.h @@ -47,8 +47,10 @@ public: const nsPrintOptions& aPrintOptions, nsIPrintStatusCallback* aStatusCallback); +#ifdef DEBUG // Debugging NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif protected: nsSimplePageSequenceFrame(); diff --git a/layout/html/base/src/nsSplittableFrame.cpp b/layout/html/base/src/nsSplittableFrame.cpp index 17d487f71c8d..e0e703506bcd 100644 --- a/layout/html/base/src/nsSplittableFrame.cpp +++ b/layout/html/base/src/nsSplittableFrame.cpp @@ -154,6 +154,7 @@ nsIFrame * nsSplittableFrame::GetNextInFlow() return mNextInFlow; } +#ifdef DEBUG void nsSplittableFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) { @@ -169,7 +170,6 @@ nsSplittableFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* ou } -#ifdef DEBUG NS_IMETHODIMP nsSplittableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/base/src/nsSplittableFrame.h b/layout/html/base/src/nsSplittableFrame.h index 0f31de11b8ad..a8c65f415fa1 100644 --- a/layout/html/base/src/nsSplittableFrame.h +++ b/layout/html/base/src/nsSplittableFrame.h @@ -62,7 +62,9 @@ public: nsIFrame* GetNextInFlow(); protected: +#ifdef DEBUG virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); +#endif nsIFrame* mPrevInFlow; nsIFrame* mNextInFlow; diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index 6b2b0ec33d32..f354552c77e0 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -313,8 +313,6 @@ public: return NS_OK; } - NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; - /** * Get the "type" of the frame * @@ -322,10 +320,10 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #endif NS_IMETHOD GetPosition(nsIPresContext& aCX, @@ -3424,7 +3422,6 @@ nsTextFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const *aResult = sizeof(*this); return NS_OK; } -#endif NS_IMETHODIMP nsTextFrame::GetFrameName(nsString& aResult) const @@ -3487,3 +3484,5 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons return NS_OK; } +#endif + diff --git a/layout/html/base/src/nsTextRun.h b/layout/html/base/src/nsTextRun.h index 1da7f39e1b41..2ee7b1aa7a29 100644 --- a/layout/html/base/src/nsTextRun.h +++ b/layout/html/base/src/nsTextRun.h @@ -63,7 +63,9 @@ public: return (nsIFrame*) mArray[aIndex]; } +#ifdef DEBUG void List(FILE* out, PRInt32 aIndent); +#endif static void DeleteTextRuns(nsTextRun* aRun) { while (nsnull != aRun) { diff --git a/layout/html/base/src/nsViewportFrame.cpp b/layout/html/base/src/nsViewportFrame.cpp index 422a545b5614..19e43394d599 100644 --- a/layout/html/base/src/nsViewportFrame.cpp +++ b/layout/html/base/src/nsViewportFrame.cpp @@ -82,8 +82,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif @@ -563,13 +563,13 @@ ViewportFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP ViewportFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Viewport", aResult); } -#ifdef DEBUG NS_IMETHODIMP ViewportFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/document/src/nsFrameFrame.cpp b/layout/html/document/src/nsFrameFrame.cpp index a5bb183de4c9..ab01b4bc5854 100644 --- a/layout/html/document/src/nsFrameFrame.cpp +++ b/layout/html/document/src/nsFrameFrame.cpp @@ -88,7 +88,9 @@ class nsHTMLFrameOuterFrame : public nsHTMLFrameOuterFrameSuper { public: nsHTMLFrameOuterFrame(); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; @@ -135,7 +137,9 @@ public: nsHTMLFrameInnerFrame(); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD GetFrameType(nsIAtom** aType) const; @@ -286,10 +290,12 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext& aPresContext, } } +#ifdef DEBUG NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FrameOuter", aResult); } +#endif NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameType(nsIAtom** aType) const @@ -566,10 +572,12 @@ PRInt32 nsHTMLFrameInnerFrame::GetMarginHeight(nsIPresContext* aPresContext, nsI return marginHeight; } +#ifdef DEBUG NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FrameInner", aResult); } +#endif NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const diff --git a/layout/html/document/src/nsFrameSetFrame.cpp b/layout/html/document/src/nsFrameSetFrame.cpp index 0a00b7ccf343..3cd8ddfdd101 100644 --- a/layout/html/document/src/nsFrameSetFrame.cpp +++ b/layout/html/document/src/nsFrameSetFrame.cpp @@ -102,7 +102,9 @@ void nsFramesetDrag::UnSet() class nsHTMLFramesetBorderFrame : public nsLeafFrame { public: +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, @@ -153,7 +155,9 @@ protected: class nsHTMLFramesetBlankFrame : public nsLeafFrame { public: +#ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out = stdout, PRInt32 aIndent = 0) const; +#endif NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -1713,10 +1717,12 @@ nsHTMLFramesetBorderFrame::GetCursor(nsIPresContext& aPresContext, return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsHTMLFramesetBorderFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FramesetBorder", aResult); } +#endif /******************************************************************************* * nsHTMLFramesetBlankFrame @@ -1780,7 +1786,7 @@ nsHTMLFramesetBlankFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } - +#ifdef DEBUG NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const @@ -1789,4 +1795,4 @@ NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(nsIPresContext* aPresContext, fprintf(out, "%p BLANK \n", this); return nsLeafFrame::List(aPresContext, out, aIndent); } - +#endif diff --git a/layout/html/forms/src/nsButtonControlFrame.cpp b/layout/html/forms/src/nsButtonControlFrame.cpp index bb0b88420c4d..e9c0ae72e031 100644 --- a/layout/html/forms/src/nsButtonControlFrame.cpp +++ b/layout/html/forms/src/nsButtonControlFrame.cpp @@ -312,11 +312,13 @@ nsButtonControlFrame::GetCID() return kButtonCID; } +#ifdef DEBUG NS_IMETHODIMP nsButtonControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ButtonControl", aResult); } +#endif void nsButtonControlFrame::SetFocus(PRBool aOn, PRBool aRepaint) diff --git a/layout/html/forms/src/nsButtonControlFrame.h b/layout/html/forms/src/nsButtonControlFrame.h index 035ec92e7cbf..2343a38dafb6 100644 --- a/layout/html/forms/src/nsButtonControlFrame.h +++ b/layout/html/forms/src/nsButtonControlFrame.h @@ -35,7 +35,9 @@ public: NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif virtual void MouseClicked(nsIPresContext* aPresContext); diff --git a/layout/html/forms/src/nsCheckboxControlFrame.h b/layout/html/forms/src/nsCheckboxControlFrame.h index 3cc2b3627e0d..1afe9212ae1c 100644 --- a/layout/html/forms/src/nsCheckboxControlFrame.h +++ b/layout/html/forms/src/nsCheckboxControlFrame.h @@ -57,9 +57,11 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow) ; +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("CheckboxControl", aResult); } +#endif virtual const nsIID& GetCID(); virtual const nsIID& GetIID(); diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index 4298a5dd9779..7e33557e4491 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -886,12 +886,14 @@ nsComboboxControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, //-------------------------------------------------------------- + +#ifdef NS_DEBUG NS_IMETHODIMP nsComboboxControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ComboboxControl", aResult); } - +#endif //---------------------------------------------------------------------- diff --git a/layout/html/forms/src/nsComboboxControlFrame.h b/layout/html/forms/src/nsComboboxControlFrame.h index 177f7da526dc..fbfd0ee09c74 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.h +++ b/layout/html/forms/src/nsComboboxControlFrame.h @@ -79,7 +79,9 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD Destroy(nsIPresContext& aPresContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const; NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, diff --git a/layout/html/forms/src/nsFieldSetFrame.cpp b/layout/html/forms/src/nsFieldSetFrame.cpp index 1ce9c287fa54..7c8984f04d12 100644 --- a/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/layout/html/forms/src/nsFieldSetFrame.cpp @@ -74,9 +74,11 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("FieldSet", aResult); } +#endif protected: @@ -269,6 +271,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext, PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { nsIView* view; GetView(&aPresContext, &view); @@ -280,6 +283,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext, } aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif return NS_OK; } diff --git a/layout/html/forms/src/nsFileControlFrame.cpp b/layout/html/forms/src/nsFileControlFrame.cpp index 75d7afc69701..85e3b2c052ba 100644 --- a/layout/html/forms/src/nsFileControlFrame.cpp +++ b/layout/html/forms/src/nsFileControlFrame.cpp @@ -427,11 +427,13 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, return NS_OK; } +#ifdef NS_DEBUG NS_IMETHODIMP nsFileControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("FileControl", aResult); } +#endif NS_IMETHODIMP nsFileControlFrame::GetFormContent(nsIContent*& aContent) const diff --git a/layout/html/forms/src/nsFileControlFrame.h b/layout/html/forms/src/nsFileControlFrame.h index 4f9cb9cb06f7..1500108a3071 100644 --- a/layout/html/forms/src/nsFileControlFrame.h +++ b/layout/html/forms/src/nsFileControlFrame.h @@ -71,7 +71,9 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight) { return NS_OK; }; NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/layout/html/forms/src/nsGfxButtonControlFrame.cpp index c7ad23b60f8e..33cd9adcad37 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -135,13 +135,13 @@ nsGfxButtonControlFrame::GetCID() return kButtonCID; } +#ifdef DEBUG NS_IMETHODIMP nsGfxButtonControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("ButtonControl", aResult); } - - +#endif NS_IMETHODIMP nsGfxButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.h b/layout/html/forms/src/nsGfxButtonControlFrame.h index d67ba449dd28..7c85c72d90a8 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.h +++ b/layout/html/forms/src/nsGfxButtonControlFrame.h @@ -46,7 +46,9 @@ public: // nsFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, diff --git a/layout/html/forms/src/nsGfxCheckboxControlFrame.h b/layout/html/forms/src/nsGfxCheckboxControlFrame.h index 7f648c096c96..f959e3355cdb 100644 --- a/layout/html/forms/src/nsGfxCheckboxControlFrame.h +++ b/layout/html/forms/src/nsGfxCheckboxControlFrame.h @@ -28,9 +28,11 @@ private: public: nsGfxCheckboxControlFrame(); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("CheckboxControl", aResult); } +#endif NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index 357e015804df..9e3272074b26 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -734,7 +734,7 @@ nsGfxTextControlFrame::PaintChild(nsIPresContext& aPresContext, #ifdef NS_DEBUG // Draw a border around the child - if (nsIFrame::GetShowFrameBorders() && !kidRect.IsEmpty()) { + if (nsIFrameDebug::GetShowFrameBorders() && !kidRect.IsEmpty()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(kidRect); } @@ -2287,6 +2287,7 @@ void nsGfxTextControlFrame::RemoveNewlines(nsString &aString) aString.StripChars(badChars); } +#ifdef NS_DEBUG NS_IMETHODIMP nsGfxTextControlFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { @@ -2319,7 +2320,11 @@ nsGfxTextControlFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIn nsIFrame* rootFrame; shell->GetRootFrame(&rootFrame); if (rootFrame) { - rootFrame->List(aPresContext, out, aIndent + 1); + nsIFrameDebug* frameDebug; + + if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } nsCOMPtr doc; docv->GetDocument(*getter_AddRefs(doc)); if (doc) { @@ -2339,10 +2344,14 @@ nsGfxTextControlFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIn fputs(">\n", out); if (mDisplayFrame) { + nsIFrameDebug* frameDebug; + IndentBy(out, aIndent); nsAutoString tmp; fputs("<\n", out); - mDisplayFrame->List(aPresContext, out, aIndent + 1); + if (NS_SUCCEEDED(mDisplayFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { + frameDebug->List(aPresContext, out, aIndent + 1); + } IndentBy(out, aIndent); fputs(">\n", out); } @@ -2350,6 +2359,7 @@ nsGfxTextControlFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIn return NS_OK; } +#endif /******************************************************************************* * EnderFrameLoadingInfo diff --git a/layout/html/forms/src/nsGfxTextControlFrame.h b/layout/html/forms/src/nsGfxTextControlFrame.h index 6fc5e71aeb4a..4b1873f1e8dd 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.h +++ b/layout/html/forms/src/nsGfxTextControlFrame.h @@ -347,10 +347,12 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); +#ifdef NS_DEBUG /** debug method to dump frames * @see nsIFrame */ NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; +#endif /** create all the objects required for editing. */ NS_IMETHOD CreateEditor(); diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.h b/layout/html/forms/src/nsHTMLButtonControlFrame.h index 0a654aca52d4..d3a4f1028385 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.h +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.h @@ -92,10 +92,11 @@ public: NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("ButtonControl", aResult); } +#endif virtual nsresult RequiresWidget(PRBool &aRequiresWidget); diff --git a/layout/html/forms/src/nsImageControlFrame.cpp b/layout/html/forms/src/nsImageControlFrame.cpp index 0fe4925a7313..fc6ff73ffe82 100644 --- a/layout/html/forms/src/nsImageControlFrame.cpp +++ b/layout/html/forms/src/nsImageControlFrame.cpp @@ -74,9 +74,11 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("ImageControl", aResult); } +#endif NS_IMETHOD GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, diff --git a/layout/html/forms/src/nsLabelFrame.cpp b/layout/html/forms/src/nsLabelFrame.cpp index c1e0879ae293..841ff931748b 100644 --- a/layout/html/forms/src/nsLabelFrame.cpp +++ b/layout/html/forms/src/nsLabelFrame.cpp @@ -94,9 +94,11 @@ public: NS_IMETHOD GetFor(nsString& aFor); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("Label", aResult); } +#endif protected: PRBool FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aResultFrame); diff --git a/layout/html/forms/src/nsLegendFrame.cpp b/layout/html/forms/src/nsLegendFrame.cpp index c295672ab38f..b2685aaac2ec 100644 --- a/layout/html/forms/src/nsLegendFrame.cpp +++ b/layout/html/forms/src/nsLegendFrame.cpp @@ -90,8 +90,10 @@ PRInt32 nsLegendFrame::GetAlign() return intValue; } +#ifdef NS_DEBUG NS_IMETHODIMP nsLegendFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Legend", aResult); } +#endif diff --git a/layout/html/forms/src/nsLegendFrame.h b/layout/html/forms/src/nsLegendFrame.h index 28c49bfc230d..e30c424b4982 100644 --- a/layout/html/forms/src/nsLegendFrame.h +++ b/layout/html/forms/src/nsLegendFrame.h @@ -37,7 +37,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +#ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif PRInt32 GetAlign(); }; diff --git a/layout/html/forms/src/nsNativeSelectControlFrame.cpp b/layout/html/forms/src/nsNativeSelectControlFrame.cpp index 6dd71c2d1248..afc080913652 100644 --- a/layout/html/forms/src/nsNativeSelectControlFrame.cpp +++ b/layout/html/forms/src/nsNativeSelectControlFrame.cpp @@ -77,9 +77,11 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("SelectControl", aResult); } +#endif virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext& aPresContext); diff --git a/layout/html/forms/src/nsRadioControlFrame.cpp b/layout/html/forms/src/nsRadioControlFrame.cpp index 484aead978d9..d694677c66f8 100644 --- a/layout/html/forms/src/nsRadioControlFrame.cpp +++ b/layout/html/forms/src/nsRadioControlFrame.cpp @@ -164,12 +164,13 @@ nsRadioControlFrame::Reset() SetCurrentCheckState(checked); } +#ifdef DEBUG NS_IMETHODIMP nsRadioControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("RadioControl", aResult); } - +#endif NS_IMETHODIMP nsRadioControlFrame::SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext) diff --git a/layout/html/forms/src/nsRadioControlFrame.h b/layout/html/forms/src/nsRadioControlFrame.h index 85fa1f2a737f..7903694c53bf 100644 --- a/layout/html/forms/src/nsRadioControlFrame.h +++ b/layout/html/forms/src/nsRadioControlFrame.h @@ -45,7 +45,9 @@ public: nscoord& aWidth, nscoord& aHeight); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif //nsIRadioControlFrame methods NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); diff --git a/layout/html/forms/src/nsTextControlFrame.cpp b/layout/html/forms/src/nsTextControlFrame.cpp index dc0018c008ee..56bd55b2b2ce 100644 --- a/layout/html/forms/src/nsTextControlFrame.cpp +++ b/layout/html/forms/src/nsTextControlFrame.cpp @@ -328,12 +328,13 @@ nsTextControlFrame::GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, PRI return NS_OK; } - +#ifdef DEBUG NS_IMETHODIMP nsTextControlFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TextControl", aResult); } +#endif //--------------------------------------------------------- NS_IMETHODIMP diff --git a/layout/html/forms/src/nsTextControlFrame.h b/layout/html/forms/src/nsTextControlFrame.h index 83444e176a00..193acd004952 100644 --- a/layout/html/forms/src/nsTextControlFrame.h +++ b/layout/html/forms/src/nsTextControlFrame.h @@ -39,7 +39,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; +#endif virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const; virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const; diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index cc0fece1fffe..195b4c0dbc96 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -270,11 +270,13 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, } } +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0, 0, 128)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif // if the cell originates in a row and/or col that is collapsed, the // bottom and/or right portion of the cell is painted by translating @@ -1103,7 +1105,6 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram } } - NS_IMETHODIMP nsTableCellFrame::GetFrameType(nsIAtom** aType) const { @@ -1113,11 +1114,13 @@ nsTableCellFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableCellFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableCell", aResult); } +#endif // Destructor function for the collapse offset frame property static void diff --git a/layout/html/table/src/nsTableCellFrame.h b/layout/html/table/src/nsTableCellFrame.h index e8ba9c3e26cf..b8f22e690e06 100644 --- a/layout/html/table/src/nsTableCellFrame.h +++ b/layout/html/table/src/nsTableCellFrame.h @@ -122,11 +122,10 @@ public: NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif - NS_IMETHOD GetFrameName(nsString& aResult) const; - virtual void VerticallyAlignChild(nsIPresContext* aPresContext); /** diff --git a/layout/html/table/src/nsTableColFrame.cpp b/layout/html/table/src/nsTableColFrame.cpp index bba03b31ae0e..004ee81b7f6b 100644 --- a/layout/html/table/src/nsTableColFrame.cpp +++ b/layout/html/table/src/nsTableColFrame.cpp @@ -182,13 +182,13 @@ nsTableColFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableColFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableCol", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableColFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/table/src/nsTableColFrame.h b/layout/html/table/src/nsTableColFrame.h index 710c4ca4789e..830219c088ac 100644 --- a/layout/html/table/src/nsTableColFrame.h +++ b/layout/html/table/src/nsTableColFrame.h @@ -88,8 +88,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/html/table/src/nsTableColGroupFrame.cpp b/layout/html/table/src/nsTableColGroupFrame.cpp index a158d7cbd168..0c4367b00148 100644 --- a/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/layout/html/table/src/nsTableColGroupFrame.cpp @@ -705,13 +705,13 @@ nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableColGroupFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableColGroup", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/table/src/nsTableColGroupFrame.h b/layout/html/table/src/nsTableColGroupFrame.h index f9b56761435c..bef649706dc3 100644 --- a/layout/html/table/src/nsTableColGroupFrame.h +++ b/layout/html/table/src/nsTableColGroupFrame.h @@ -85,8 +85,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 8a2da03bdb8e..14254284d343 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -956,11 +956,14 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext, } } } + +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,255,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -3896,11 +3899,13 @@ PRBool nsTableFrame::RequiresPass1Layout() return (PRBool)(NS_STYLE_TABLE_LAYOUT_FIXED!=tableStyle->mLayoutStrategy); } +#ifdef DEBUG NS_IMETHODIMP nsTableFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Table", aResult); } +#endif // This assumes that aFrame is a scroll frame if // XXX make this a macro if it becomes an issue diff --git a/layout/html/table/src/nsTableFrame.h b/layout/html/table/src/nsTableFrame.h index 04ee030f2ab9..a3516a54da7c 100644 --- a/layout/html/table/src/nsTableFrame.h +++ b/layout/html/table/src/nsTableFrame.h @@ -227,10 +227,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef DEBUG /** @see nsIFrame::GetFrameName */ NS_IMETHOD GetFrameName(nsString& aResult) const; - -#ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 8dd21caff349..94a754172a5f 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -223,11 +223,13 @@ NS_METHOD nsTableOuterFrame::Paint(nsIPresContext& aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -1141,13 +1143,13 @@ NS_NewTableOuterFrame(nsIFrame** aNewFrame) return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableOuterFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableOuter", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableOuterFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/table/src/nsTableOuterFrame.h b/layout/html/table/src/nsTableOuterFrame.h index abb658353a5f..460e996e0154 100644 --- a/layout/html/table/src/nsTableOuterFrame.h +++ b/layout/html/table/src/nsTableOuterFrame.h @@ -89,10 +89,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - /** @see nsIFrame::GetFrameName */ - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index feebfe8faffe..e127a6332cc7 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -432,11 +432,14 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext, } } } + +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,255,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -484,11 +487,13 @@ void nsTableRowFrame::PaintChildren(nsIPresContext& aPresContext, aRenderingContext.Translate(kidRect.x, kidRect.y); kid->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height); } +#endif aRenderingContext.PopState(clipState); } } @@ -1551,13 +1556,13 @@ NS_NewTableRowFrame(nsIFrame** aNewFrame) return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableRowFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableRow", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableRowFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/table/src/nsTableRowFrame.h b/layout/html/table/src/nsTableRowFrame.h index 7dc0f7826c05..48a9ec64f700 100644 --- a/layout/html/table/src/nsTableRowFrame.h +++ b/layout/html/table/src/nsTableRowFrame.h @@ -155,9 +155,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index c57678054981..f7c41c2acc3d 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -229,11 +229,14 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext& aPresContext, } } } + +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,255,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -280,11 +283,13 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext, aRenderingContext.PushState(); aRenderingContext.Translate(kidRect.x, kidRect.y); kid->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height); } +#endif aRenderingContext.PopState(clipState); } GetNextFrame(kid, &kid); @@ -1623,14 +1628,13 @@ NS_NewTableRowGroupFrame(nsIFrame** aNewFrame) return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableRowGroupFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableRowGroup", aResult); } - -#ifdef DEBUG NS_IMETHODIMP nsTableRowGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/html/table/src/nsTableRowGroupFrame.h b/layout/html/table/src/nsTableRowGroupFrame.h index 32d51dd230bc..d70799bca94f 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.h +++ b/layout/html/table/src/nsTableRowGroupFrame.h @@ -155,11 +155,10 @@ public: NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif - NS_IMETHOD GetFrameName(nsString& aResult) const; - /** set aCount to the number of child rows (not necessarily == number of child frames) */ NS_METHOD GetRowCount(PRInt32 &aCount, PRBool aDeepCount = PR_TRUE); diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index cc0fece1fffe..195b4c0dbc96 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -270,11 +270,13 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, } } +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0, 0, 128)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif // if the cell originates in a row and/or col that is collapsed, the // bottom and/or right portion of the cell is painted by translating @@ -1103,7 +1105,6 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram } } - NS_IMETHODIMP nsTableCellFrame::GetFrameType(nsIAtom** aType) const { @@ -1113,11 +1114,13 @@ nsTableCellFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableCellFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableCell", aResult); } +#endif // Destructor function for the collapse offset frame property static void diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index e8ba9c3e26cf..b8f22e690e06 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -122,11 +122,10 @@ public: NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif - NS_IMETHOD GetFrameName(nsString& aResult) const; - virtual void VerticallyAlignChild(nsIPresContext* aPresContext); /** diff --git a/layout/tables/nsTableColFrame.cpp b/layout/tables/nsTableColFrame.cpp index bba03b31ae0e..004ee81b7f6b 100644 --- a/layout/tables/nsTableColFrame.cpp +++ b/layout/tables/nsTableColFrame.cpp @@ -182,13 +182,13 @@ nsTableColFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableColFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableCol", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableColFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/tables/nsTableColFrame.h b/layout/tables/nsTableColFrame.h index 710c4ca4789e..830219c088ac 100644 --- a/layout/tables/nsTableColFrame.h +++ b/layout/tables/nsTableColFrame.h @@ -88,8 +88,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index a158d7cbd168..0c4367b00148 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -705,13 +705,13 @@ nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableColGroupFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableColGroup", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index f9b56761435c..bef649706dc3 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -85,8 +85,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 8a2da03bdb8e..14254284d343 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -956,11 +956,14 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext, } } } + +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,255,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -3896,11 +3899,13 @@ PRBool nsTableFrame::RequiresPass1Layout() return (PRBool)(NS_STYLE_TABLE_LAYOUT_FIXED!=tableStyle->mLayoutStrategy); } +#ifdef DEBUG NS_IMETHODIMP nsTableFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("Table", aResult); } +#endif // This assumes that aFrame is a scroll frame if // XXX make this a macro if it becomes an issue diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index 04ee030f2ab9..a3516a54da7c 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -227,10 +227,9 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; +#ifdef DEBUG /** @see nsIFrame::GetFrameName */ NS_IMETHOD GetFrameName(nsString& aResult) const; - -#ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 8dd21caff349..94a754172a5f 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -223,11 +223,13 @@ NS_METHOD nsTableOuterFrame::Paint(nsIPresContext& aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -1141,13 +1143,13 @@ NS_NewTableOuterFrame(nsIFrame** aNewFrame) return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableOuterFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableOuter", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableOuterFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index abb658353a5f..460e996e0154 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -89,10 +89,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - /** @see nsIFrame::GetFrameName */ - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index feebfe8faffe..e127a6332cc7 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -432,11 +432,14 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext, } } } + +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,255,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -484,11 +487,13 @@ void nsTableRowFrame::PaintChildren(nsIPresContext& aPresContext, aRenderingContext.Translate(kidRect.x, kidRect.y); kid->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height); } +#endif aRenderingContext.PopState(clipState); } } @@ -1551,13 +1556,13 @@ NS_NewTableRowFrame(nsIFrame** aNewFrame) return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableRowFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableRow", aResult); } -#ifdef DEBUG NS_IMETHODIMP nsTableRowFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 7dc0f7826c05..48a9ec64f700 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -155,9 +155,8 @@ public: */ NS_IMETHOD GetFrameType(nsIAtom** aType) const; - NS_IMETHOD GetFrameName(nsString& aResult) const; - #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index c57678054981..f7c41c2acc3d 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -229,11 +229,14 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext& aPresContext, } } } + +#ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(0,255,0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } +#endif PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); return NS_OK; @@ -280,11 +283,13 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext, aRenderingContext.PushState(); aRenderingContext.Translate(kidRect.x, kidRect.y); kid->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height); } +#endif aRenderingContext.PopState(clipState); } GetNextFrame(kid, &kid); @@ -1623,14 +1628,13 @@ NS_NewTableRowGroupFrame(nsIFrame** aNewFrame) return NS_OK; } +#ifdef DEBUG NS_IMETHODIMP nsTableRowGroupFrame::GetFrameName(nsString& aResult) const { return MakeFrameName("TableRowGroup", aResult); } - -#ifdef DEBUG NS_IMETHODIMP nsTableRowGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const { diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 32d51dd230bc..d70799bca94f 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -155,11 +155,10 @@ public: NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG + NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif - NS_IMETHOD GetFrameName(nsString& aResult) const; - /** set aCount to the number of child rows (not necessarily == number of child frames) */ NS_METHOD GetRowCount(PRInt32 &aCount, PRBool aDeepCount = PR_TRUE); diff --git a/layout/xul/base/src/nsColorPickerFrame.h b/layout/xul/base/src/nsColorPickerFrame.h index b011047cfb48..723e624b966e 100644 --- a/layout/xul/base/src/nsColorPickerFrame.h +++ b/layout/xul/base/src/nsColorPickerFrame.h @@ -48,12 +48,13 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); - - // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("ColorPickerFrame", aResult); } +#endif + // nsIFrame overrides NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus); diff --git a/layout/xul/base/src/nsFontPickerFrame.h b/layout/xul/base/src/nsFontPickerFrame.h index 954fcb238a94..e24d83285b10 100644 --- a/layout/xul/base/src/nsFontPickerFrame.h +++ b/layout/xul/base/src/nsFontPickerFrame.h @@ -40,10 +40,13 @@ class nsFontPickerFrame : public nsLeafFrame public: nsFontPickerFrame(); - // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("FontPickerFrame", aResult); } +#endif + + // nsIFrame overrides NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, diff --git a/layout/xul/base/src/nsScrollbarFrame.h b/layout/xul/base/src/nsScrollbarFrame.h index e72081f45aa2..c97f04139e1d 100644 --- a/layout/xul/base/src/nsScrollbarFrame.h +++ b/layout/xul/base/src/nsScrollbarFrame.h @@ -37,12 +37,13 @@ class nsScrollbarFrame : public nsBoxFrame, public: nsScrollbarFrame() {} - // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("ScrollbarFrame", aResult); } +#endif - + // nsIFrame overrides NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, diff --git a/layout/xul/base/src/nsSliderFrame.h b/layout/xul/base/src/nsSliderFrame.h index a37a20be511d..585e5e68791c 100644 --- a/layout/xul/base/src/nsSliderFrame.h +++ b/layout/xul/base/src/nsSliderFrame.h @@ -52,11 +52,13 @@ public: nsSliderFrame(); virtual ~nsSliderFrame(); - // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("SliderFrame", aResult); } +#endif + // nsIFrame overrides NS_IMETHOD Destroy(nsIPresContext& aPresContext); NS_IMETHOD Paint(nsIPresContext& aPresContext, diff --git a/layout/xul/base/src/nsSpinnerFrame.h b/layout/xul/base/src/nsSpinnerFrame.h index 9bd305da4083..5d66acf7530f 100644 --- a/layout/xul/base/src/nsSpinnerFrame.h +++ b/layout/xul/base/src/nsSpinnerFrame.h @@ -40,10 +40,13 @@ class nsSpinnerFrame : public nsLeafFrame public: nsSpinnerFrame(); - // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("SpinnerFrame", aResult); } +#endif + + // nsIFrame overrides NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, diff --git a/layout/xul/base/src/nsSplitterFrame.h b/layout/xul/base/src/nsSplitterFrame.h index c3d6ba65a7a0..47cd017c4ef7 100644 --- a/layout/xul/base/src/nsSplitterFrame.h +++ b/layout/xul/base/src/nsSplitterFrame.h @@ -38,12 +38,13 @@ public: nsSplitterFrame(); ~nsSplitterFrame(); - // nsIFrame overrides +#ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { return MakeFrameName("SplitterFrame", aResult); } +#endif - + // nsIFrame overrides NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, diff --git a/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/layout/xul/base/src/nsTreeRowGroupFrame.cpp index 8167446b4f9e..10a19e946333 100644 --- a/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -761,11 +761,13 @@ void nsTreeRowGroupFrame::PaintChildren(nsIPresContext& aPresContext, aRenderingContext.PushState(); aRenderingContext.Translate(kidRect.x, kidRect.y); mScrollbar->Paint(aPresContext, aRenderingContext, kidDamageArea, aWhichLayer); +#ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawRect(0, 0, kidRect.width, kidRect.height); } +#endif aRenderingContext.PopState(clipState); } } diff --git a/webshell/tests/viewer/nsWebCrawler.cpp b/webshell/tests/viewer/nsWebCrawler.cpp index 20a86f434f54..5a7b22822bc3 100644 --- a/webshell/tests/viewer/nsWebCrawler.cpp +++ b/webshell/tests/viewer/nsWebCrawler.cpp @@ -276,6 +276,7 @@ nsWebCrawler::OnEndDocumentLoad(nsIDocumentLoader* loader, vm->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE); } +#ifdef NS_DEBUG if (mOutputDir.Length() > 0) { nsIFrame* root; shell->GetRootFrame(&root); @@ -309,6 +310,7 @@ nsWebCrawler::OnEndDocumentLoad(nsIDocumentLoader* loader, root->DumpRegressionData(presContext, stdout, 0); } } +#endif if (mJiggleLayout) { nsRect r;