From 4e9fbfafc590a3fbeb0446664224d31f59bd5fc9 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Sat, 20 Mar 1999 19:38:50 +0000 Subject: [PATCH] Added some debugging help for tracking down max-element-size bugs git-svn-id: svn://10.0.0.236/trunk@24588 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/generic/nsBlockReflowContext.cpp | 26 +++++++++++++++++-- mozilla/layout/generic/nsLineLayout.cpp | 24 ++++++++++++++++- .../html/base/src/nsBlockReflowContext.cpp | 26 +++++++++++++++++-- mozilla/layout/html/base/src/nsLineLayout.cpp | 24 ++++++++++++++++- 4 files changed, 94 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index 9a4a1f17cfd..8f74db41493 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -26,9 +26,11 @@ #include "nsHTMLContainerFrame.h" #ifdef NS_DEBUG -#define NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_MAX_ELEMENT_SIZE #else -#undef NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_MAX_ELEMENT_SIZE #endif nsBlockReflowContext::nsBlockReflowContext(nsIPresContext& aPresContext, @@ -169,6 +171,16 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, mMetrics.maxElementSize->width = 0; mMetrics.maxElementSize->height = 0; } + if ((nsnull != mMetrics.maxElementSize) && + ((mMetrics.maxElementSize->width > mMetrics.width) || + (mMetrics.maxElementSize->height > mMetrics.height))) { + printf("nsBlockReflowContext: "); + nsFrame::ListTag(stdout, aFrame); + printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + mMetrics.maxElementSize->width, + mMetrics.maxElementSize->height, + mMetrics.width, mMetrics.height); + } if ((mMetrics.width == nscoord(0xdeadbeef)) || (mMetrics.height == nscoord(0xdeadbeef)) || (mMetrics.ascent == nscoord(0xdeadbeef)) || @@ -179,6 +191,16 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, mMetrics.ascent, mMetrics.descent); } #endif +#ifdef NOISY_MAX_ELEMENT_SIZE + if (nsnull != mMetrics.maxElementSize) { + printf(" "); + nsFrame::ListTag(stdout, aFrame); + printf(": maxElementSize=%d,%d wh=%d,%d\n", + mMetrics.maxElementSize->width, + mMetrics.maxElementSize->height, + mMetrics.width, mMetrics.height); + } +#endif aFrame->GetFrameState(&state); if (0 == (NS_FRAME_OUTSIDE_CHILDREN & state)) { diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index a5462c93bb3..b773b1a346d 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -37,6 +37,7 @@ #undef NOISY_PUSHING #undef REALLY_NOISY_PUSHING #define DEBUG_ADD_TEXT +#undef NOISY_MAX_ELEMENT_SIZE #else #undef NOISY_HORIZONTAL_ALIGN #undef REALLY_NOISY_HORIZONTAL_ALIGN @@ -47,6 +48,7 @@ #undef NOISY_PUSHING #undef REALLY_NOISY_PUSHING #undef DEBUG_ADD_TEXT +#undef NOISY_MAX_ELEMENT_SIZE #endif nsTextRun::nsTextRun() @@ -759,16 +761,36 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, metrics.maxElementSize->width = 0; metrics.maxElementSize->height = 0; } + if (mComputeMaxElementSize && + ((metrics.maxElementSize->width > metrics.width) || + (metrics.maxElementSize->height > metrics.height))) { + printf("nsLineLayout: "); + nsFrame::ListTag(stdout, aFrame); + printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + metrics.maxElementSize->width, + metrics.maxElementSize->height, + metrics.width, metrics.height); + } if ((metrics.width == nscoord(0xdeadbeef)) || (metrics.height == nscoord(0xdeadbeef)) || (metrics.ascent == nscoord(0xdeadbeef)) || (metrics.descent == nscoord(0xdeadbeef))) { - printf("nsBlockReflowContext: "); + printf("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); printf(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height, metrics.ascent, metrics.descent); } #endif +#ifdef NOISY_MAX_ELEMENT_SIZE + if (mComputeMaxElementSize) { + printf(" "); + nsFrame::ListTag(stdout, aFrame); + printf(": maxElementSize=%d,%d wh=%d,%d,\n", + metrics.maxElementSize->width, + metrics.maxElementSize->height, + metrics.width, metrics.height); + } +#endif aFrame->GetFrameState(&state); if (NS_FRAME_OUTSIDE_CHILDREN & state) { diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp index 9a4a1f17cfd..8f74db41493 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp @@ -26,9 +26,11 @@ #include "nsHTMLContainerFrame.h" #ifdef NS_DEBUG -#define NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_MAX_ELEMENT_SIZE #else -#undef NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_SPECULATIVE_TOP_MARGIN +#undef NOISY_MAX_ELEMENT_SIZE #endif nsBlockReflowContext::nsBlockReflowContext(nsIPresContext& aPresContext, @@ -169,6 +171,16 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, mMetrics.maxElementSize->width = 0; mMetrics.maxElementSize->height = 0; } + if ((nsnull != mMetrics.maxElementSize) && + ((mMetrics.maxElementSize->width > mMetrics.width) || + (mMetrics.maxElementSize->height > mMetrics.height))) { + printf("nsBlockReflowContext: "); + nsFrame::ListTag(stdout, aFrame); + printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + mMetrics.maxElementSize->width, + mMetrics.maxElementSize->height, + mMetrics.width, mMetrics.height); + } if ((mMetrics.width == nscoord(0xdeadbeef)) || (mMetrics.height == nscoord(0xdeadbeef)) || (mMetrics.ascent == nscoord(0xdeadbeef)) || @@ -179,6 +191,16 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, mMetrics.ascent, mMetrics.descent); } #endif +#ifdef NOISY_MAX_ELEMENT_SIZE + if (nsnull != mMetrics.maxElementSize) { + printf(" "); + nsFrame::ListTag(stdout, aFrame); + printf(": maxElementSize=%d,%d wh=%d,%d\n", + mMetrics.maxElementSize->width, + mMetrics.maxElementSize->height, + mMetrics.width, mMetrics.height); + } +#endif aFrame->GetFrameState(&state); if (0 == (NS_FRAME_OUTSIDE_CHILDREN & state)) { diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index a5462c93bb3..b773b1a346d 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -37,6 +37,7 @@ #undef NOISY_PUSHING #undef REALLY_NOISY_PUSHING #define DEBUG_ADD_TEXT +#undef NOISY_MAX_ELEMENT_SIZE #else #undef NOISY_HORIZONTAL_ALIGN #undef REALLY_NOISY_HORIZONTAL_ALIGN @@ -47,6 +48,7 @@ #undef NOISY_PUSHING #undef REALLY_NOISY_PUSHING #undef DEBUG_ADD_TEXT +#undef NOISY_MAX_ELEMENT_SIZE #endif nsTextRun::nsTextRun() @@ -759,16 +761,36 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, metrics.maxElementSize->width = 0; metrics.maxElementSize->height = 0; } + if (mComputeMaxElementSize && + ((metrics.maxElementSize->width > metrics.width) || + (metrics.maxElementSize->height > metrics.height))) { + printf("nsLineLayout: "); + nsFrame::ListTag(stdout, aFrame); + printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + metrics.maxElementSize->width, + metrics.maxElementSize->height, + metrics.width, metrics.height); + } if ((metrics.width == nscoord(0xdeadbeef)) || (metrics.height == nscoord(0xdeadbeef)) || (metrics.ascent == nscoord(0xdeadbeef)) || (metrics.descent == nscoord(0xdeadbeef))) { - printf("nsBlockReflowContext: "); + printf("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); printf(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height, metrics.ascent, metrics.descent); } #endif +#ifdef NOISY_MAX_ELEMENT_SIZE + if (mComputeMaxElementSize) { + printf(" "); + nsFrame::ListTag(stdout, aFrame); + printf(": maxElementSize=%d,%d wh=%d,%d,\n", + metrics.maxElementSize->width, + metrics.maxElementSize->height, + metrics.width, metrics.height); + } +#endif aFrame->GetFrameState(&state); if (NS_FRAME_OUTSIDE_CHILDREN & state) {