From 661ba87dcb1c8e4bd42891d2def39726449dcf97 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Sat, 13 Mar 1999 12:49:37 +0000 Subject: [PATCH] bug 2220; changed wording of some warnings. --- layout/html/table/src/nsTableCellFrame.cpp | 42 +++++++++++++++------- layout/html/table/src/nsTableRowFrame.cpp | 10 +++--- layout/tables/nsTableCellFrame.cpp | 42 +++++++++++++++------- layout/tables/nsTableRowFrame.cpp | 10 +++--- 4 files changed, 72 insertions(+), 32 deletions(-) diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 5e4d4607613..696bb044679 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -372,6 +372,32 @@ PRInt32 nsTableCellFrame::GetColSpan() } +void DebugCheckChildSize(nsIFrame* aChild, nsHTMLReflowMetrics& aMet, nsSize& aAvailSize) +{ + if (aMet.width > aAvailSize.width) { + nsAutoString tmp; + aChild->GetFrameName(tmp); + printf("WARNING: cell %s content has desired width %d given avail width %d\n", + tmp, aMet.width, aAvailSize.width); + } + if ((aMet.width < 0) || (aMet.width > 30000)) { + printf("WARNING: cell content %X has large width %d \n", aChild, aMet.width); + } + if ((aMet.height < 0) || (aMet.height > 30000)) { + printf("WARNING: cell content %X has large height %d \n", aChild, aMet.height); + } + if (aMet.maxElementSize) { + nscoord tmp = aMet.maxElementSize->width; + if ((tmp < 0) || (tmp > 30000)) { + printf("WARNING: cell content %X has large max element width %d \n", aChild, tmp); + } + tmp = aMet.maxElementSize->height; + if ((tmp < 0) || (tmp > 30000)) { + printf("WARNING: cell content %X has large max element height %d \n", aChild, tmp); + } + } +} + /** */ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, @@ -430,7 +456,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, if (eReflowReason_Incremental == aReflowState.reason) { - // XXX We *must* do this otherwise incremental reflow that's + // We *must* do this otherwise incremental reflow that's // passing through will not work right. nsIFrame* next; aReflowState.reflowCommand->GetNext(next); @@ -474,21 +500,13 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus); #ifdef NS_DEBUG - if (kidSize.width > availSize.width) - { - printf("WARNING: cell "); - nsAutoString tmp; - firstKid->GetFrameName(tmp); - fputs(tmp, stdout); - printf(" content returned desired width %d given avail width %d\n", - kidSize.width, availSize.width); - } + DebugCheckChildSize(firstKid, kidSize, availSize); #endif // Nav4 hack for 0 dimensioned cells. // Empty cells are assigned a width and height of 4px // see testcase "cellHeights.html" - if (eReflowReason_Initial == aReflowState.reason) + if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth) { if ((0==kidSize.width) && (0==kidSize.height)) SetContentEmpty(PR_TRUE); @@ -497,7 +515,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, } if (0==kidSize.width) { - if (eReflowReason_Initial == aReflowState.reason) + if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth) { float p2t; aPresContext.GetScaledPixelsToTwips(&p2t); diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index 603ed604c24..f64499b78c8 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -810,13 +810,15 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, printf ("TR %p for cell %p Initial Reflow: desired=%d, MES=%d\n", this, kidFrame, kidSize.width, kidMaxElementSize.width); - // XXX the following alerts bugs in the content frames. + // the following signals bugs in the content frames. if (kidMaxElementSize.width > kidSize.width) { - printf("BUG - table cell content max element width greater than desired width \n"); + printf("WARNING - table cell content max element width %d greater than desired width %d\n", + kidMaxElementSize.width, kidSize.width); kidSize.width = kidMaxElementSize.width; } if (kidMaxElementSize.height > kidSize.height) { - printf("BUG - table cell content max element height greater than desired height \n"); + printf("Warning - table cell content max element height %d greater than desired height %d\n", + kidMaxElementSize.height, kidSize.height); kidSize.height = kidMaxElementSize.height; } @@ -1289,7 +1291,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, aReflowState.reflowState, aNextFrame, kidAvailSize); - // XXX Unfortunately we need to reflow the child several times. + // Unfortunately we need to reflow the child several times. // The first time is for the incremental reflow command. We can't pass in // a max width of NS_UNCONSTRAINEDSIZE, because the max width must match // the width of the previous reflow... diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 5e4d4607613..696bb044679 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -372,6 +372,32 @@ PRInt32 nsTableCellFrame::GetColSpan() } +void DebugCheckChildSize(nsIFrame* aChild, nsHTMLReflowMetrics& aMet, nsSize& aAvailSize) +{ + if (aMet.width > aAvailSize.width) { + nsAutoString tmp; + aChild->GetFrameName(tmp); + printf("WARNING: cell %s content has desired width %d given avail width %d\n", + tmp, aMet.width, aAvailSize.width); + } + if ((aMet.width < 0) || (aMet.width > 30000)) { + printf("WARNING: cell content %X has large width %d \n", aChild, aMet.width); + } + if ((aMet.height < 0) || (aMet.height > 30000)) { + printf("WARNING: cell content %X has large height %d \n", aChild, aMet.height); + } + if (aMet.maxElementSize) { + nscoord tmp = aMet.maxElementSize->width; + if ((tmp < 0) || (tmp > 30000)) { + printf("WARNING: cell content %X has large max element width %d \n", aChild, tmp); + } + tmp = aMet.maxElementSize->height; + if ((tmp < 0) || (tmp > 30000)) { + printf("WARNING: cell content %X has large max element height %d \n", aChild, tmp); + } + } +} + /** */ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, @@ -430,7 +456,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, if (eReflowReason_Incremental == aReflowState.reason) { - // XXX We *must* do this otherwise incremental reflow that's + // We *must* do this otherwise incremental reflow that's // passing through will not work right. nsIFrame* next; aReflowState.reflowCommand->GetNext(next); @@ -474,21 +500,13 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus); #ifdef NS_DEBUG - if (kidSize.width > availSize.width) - { - printf("WARNING: cell "); - nsAutoString tmp; - firstKid->GetFrameName(tmp); - fputs(tmp, stdout); - printf(" content returned desired width %d given avail width %d\n", - kidSize.width, availSize.width); - } + DebugCheckChildSize(firstKid, kidSize, availSize); #endif // Nav4 hack for 0 dimensioned cells. // Empty cells are assigned a width and height of 4px // see testcase "cellHeights.html" - if (eReflowReason_Initial == aReflowState.reason) + if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth) { if ((0==kidSize.width) && (0==kidSize.height)) SetContentEmpty(PR_TRUE); @@ -497,7 +515,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, } if (0==kidSize.width) { - if (eReflowReason_Initial == aReflowState.reason) + if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth) { float p2t; aPresContext.GetScaledPixelsToTwips(&p2t); diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 603ed604c24..f64499b78c8 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -810,13 +810,15 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext, printf ("TR %p for cell %p Initial Reflow: desired=%d, MES=%d\n", this, kidFrame, kidSize.width, kidMaxElementSize.width); - // XXX the following alerts bugs in the content frames. + // the following signals bugs in the content frames. if (kidMaxElementSize.width > kidSize.width) { - printf("BUG - table cell content max element width greater than desired width \n"); + printf("WARNING - table cell content max element width %d greater than desired width %d\n", + kidMaxElementSize.width, kidSize.width); kidSize.width = kidMaxElementSize.width; } if (kidMaxElementSize.height > kidSize.height) { - printf("BUG - table cell content max element height greater than desired height \n"); + printf("Warning - table cell content max element height %d greater than desired height %d\n", + kidMaxElementSize.height, kidSize.height); kidSize.height = kidMaxElementSize.height; } @@ -1289,7 +1291,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, aReflowState.reflowState, aNextFrame, kidAvailSize); - // XXX Unfortunately we need to reflow the child several times. + // Unfortunately we need to reflow the child several times. // The first time is for the incremental reflow command. We can't pass in // a max width of NS_UNCONSTRAINEDSIZE, because the max width must match // the width of the previous reflow...