From 441adab325043740ce4530dcbf71a010a5d013f2 Mon Sep 17 00:00:00 2001 From: "bernd.mielke%snafu.de" Date: Wed, 16 May 2001 14:56:09 +0000 Subject: [PATCH] encapsulate printf's in BasicTableLayoutStrategy.cpp bug 78770 r= karnaze sr = atttinasi --- .../table/src/BasicTableLayoutStrategy.cpp | 39 +++++++++++-------- layout/html/table/src/makefile.win | 5 ++- layout/tables/BasicTableLayoutStrategy.cpp | 39 +++++++++++-------- 3 files changed, 48 insertions(+), 35 deletions(-) diff --git a/layout/html/table/src/BasicTableLayoutStrategy.cpp b/layout/html/table/src/BasicTableLayoutStrategy.cpp index 4e4d1ad9f8c5..e5fb3ceca28f 100644 --- a/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -30,15 +30,9 @@ #include "nsVoidArray.h" #include "nsHTMLIIDs.h" -#if 1 -static PRBool gsDebugAssign = PR_FALSE; -static PRBool gsDebugBalance = PR_FALSE; -#else -static PRBool gsDebugAssign = PR_TRUE; -static PRBool gsDebugBalance = PR_TRUE; -#endif +#ifdef DEBUG_TABLE_STRATEGY static PRInt32 gsDebugCount = 0; - +#endif // The priority of allocations for columns is as follows // 1) max(MIN, MIN_ADJ) // 2) max (PCT, PCT_ADJ) @@ -170,7 +164,9 @@ PRBool BCW_Wrapup(nsIPresContext* aPresContext, { if (aAllocTypes) delete [] aAllocTypes; - if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eBalanceCols, *aTableFrame, (nsHTMLReflowState&)aReflowState, PR_FALSE); #endif @@ -196,7 +192,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState) { - if (gsDebugBalance) {printf("BalanceColumnWidths en count=%d \n", gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("BalanceColumnWidths en count=%d \n", gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eBalanceCols, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_TRUE); #endif @@ -656,7 +654,9 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd PRInt32& aLimitType, float aPixelToTwips) { - //DumpColWidths(*mTableFrame, "enter ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#ifdef DEBUG_TABLE_STRATEGY + DumpColWidths(*mTableFrame, "enter ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#endif PRBool result = PR_TRUE; nscoord spanCellSpacing = 0; // total cell spacing cells being spanned @@ -905,8 +905,9 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd } } } - - //DumpColWidths(*mTableFrame, "exit ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#ifdef DEBUG_TABLE_STRATEGY + DumpColWidths(*mTableFrame, "exit ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#endif return result; } @@ -927,7 +928,9 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eNonPctCols, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_TRUE); #endif - if (gsDebugAssign) {printf("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif PRBool rv = PR_FALSE; PRInt32 numRows = mTableFrame->GetRowCount(); PRInt32 numCols = mTableFrame->GetColCount(); @@ -1123,7 +1126,9 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre mTableFrame->SetColumnWidth(colX, minWidth); } - if (gsDebugAssign) {printf("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eNonPctCols, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_FALSE); #endif @@ -1968,7 +1973,7 @@ PRBool BasicTableLayoutStrategy::ColIsSpecifiedAsMinimumWidth(PRInt32 aColIndex) return result; } - +#ifdef DEBUG_TABLE_STRATEGY void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) { char* indent = new char[aIndent + 1]; @@ -1985,4 +1990,4 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) printf(" **END BASIC STRATEGY DUMP** \n"); delete [] indent; } - +#endif diff --git a/layout/html/table/src/makefile.win b/layout/html/table/src/makefile.win index 3486cbd2ee3c..1c2b410af6ff 100644 --- a/layout/html/table/src/makefile.win +++ b/layout/html/table/src/makefile.win @@ -24,7 +24,10 @@ DEPTH=..\..\..\.. LIBRARY_NAME=layouthtmltable_s MODULE=raptor -DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN -DoffDEBUG_TABLE_REFLOW -DoffDEBUG_TABLE_REFLOW_TIMING -DoffDEBUG_TABLE_REFLOW_TIMING_DETAIL +DEFINES =-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN -DoffDEBUG_TABLE_REFLOW \ + -DoffDEBUG_TABLE_REFLOW_TIMING -DoffDEBUG_TABLE_REFLOW_TIMING_DETAIL \ + -DoffDEBUG_TABLE_STRATEGY \ + $(NULL) CPPSRCS= nsCellMap.cpp \ nsTableCellFrame.cpp \ diff --git a/layout/tables/BasicTableLayoutStrategy.cpp b/layout/tables/BasicTableLayoutStrategy.cpp index 4e4d1ad9f8c5..e5fb3ceca28f 100644 --- a/layout/tables/BasicTableLayoutStrategy.cpp +++ b/layout/tables/BasicTableLayoutStrategy.cpp @@ -30,15 +30,9 @@ #include "nsVoidArray.h" #include "nsHTMLIIDs.h" -#if 1 -static PRBool gsDebugAssign = PR_FALSE; -static PRBool gsDebugBalance = PR_FALSE; -#else -static PRBool gsDebugAssign = PR_TRUE; -static PRBool gsDebugBalance = PR_TRUE; -#endif +#ifdef DEBUG_TABLE_STRATEGY static PRInt32 gsDebugCount = 0; - +#endif // The priority of allocations for columns is as follows // 1) max(MIN, MIN_ADJ) // 2) max (PCT, PCT_ADJ) @@ -170,7 +164,9 @@ PRBool BCW_Wrapup(nsIPresContext* aPresContext, { if (aAllocTypes) delete [] aAllocTypes; - if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eBalanceCols, *aTableFrame, (nsHTMLReflowState&)aReflowState, PR_FALSE); #endif @@ -196,7 +192,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState) { - if (gsDebugBalance) {printf("BalanceColumnWidths en count=%d \n", gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("BalanceColumnWidths en count=%d \n", gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eBalanceCols, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_TRUE); #endif @@ -656,7 +654,9 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd PRInt32& aLimitType, float aPixelToTwips) { - //DumpColWidths(*mTableFrame, "enter ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#ifdef DEBUG_TABLE_STRATEGY + DumpColWidths(*mTableFrame, "enter ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#endif PRBool result = PR_TRUE; nscoord spanCellSpacing = 0; // total cell spacing cells being spanned @@ -905,8 +905,9 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd } } } - - //DumpColWidths(*mTableFrame, "exit ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#ifdef DEBUG_TABLE_STRATEGY + DumpColWidths(*mTableFrame, "exit ComputeNonPctColspanWidths", aCellFrame, aColIndex, aWidthIndex, aLimitType); +#endif return result; } @@ -927,7 +928,9 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eNonPctCols, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_TRUE); #endif - if (gsDebugAssign) {printf("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif PRBool rv = PR_FALSE; PRInt32 numRows = mTableFrame->GetRowCount(); PRInt32 numCols = mTableFrame->GetColCount(); @@ -1123,7 +1126,9 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre mTableFrame->SetColumnWidth(colX, minWidth); } - if (gsDebugAssign) {printf("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} +#ifdef DEBUG_TABLE_STRATEGY + printf("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); +#endif #ifdef DEBUG_TABLE_REFLOW_TIMING nsTableFrame::DebugTimeMethod(nsTableFrame::eNonPctCols, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_FALSE); #endif @@ -1968,7 +1973,7 @@ PRBool BasicTableLayoutStrategy::ColIsSpecifiedAsMinimumWidth(PRInt32 aColIndex) return result; } - +#ifdef DEBUG_TABLE_STRATEGY void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) { char* indent = new char[aIndent + 1]; @@ -1985,4 +1990,4 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) printf(" **END BASIC STRATEGY DUMP** \n"); delete [] indent; } - +#endif