bug 2220; changed wording of some warnings.

This commit is contained in:
karnaze@netscape.com
1999-03-13 12:49:37 +00:00
parent f48b0908b9
commit a4fc5af33c
4 changed files with 72 additions and 32 deletions

View File

@@ -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, NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
@@ -430,7 +456,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) 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. // passing through will not work right.
nsIFrame* next; nsIFrame* next;
aReflowState.reflowCommand->GetNext(next); aReflowState.reflowCommand->GetNext(next);
@@ -474,21 +500,13 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus); ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus);
#ifdef NS_DEBUG #ifdef NS_DEBUG
if (kidSize.width > availSize.width) DebugCheckChildSize(firstKid, kidSize, availSize);
{
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);
}
#endif #endif
// Nav4 hack for 0 dimensioned cells. // Nav4 hack for 0 dimensioned cells.
// Empty cells are assigned a width and height of 4px // Empty cells are assigned a width and height of 4px
// see testcase "cellHeights.html" // see testcase "cellHeights.html"
if (eReflowReason_Initial == aReflowState.reason) if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth)
{ {
if ((0==kidSize.width) && (0==kidSize.height)) if ((0==kidSize.width) && (0==kidSize.height))
SetContentEmpty(PR_TRUE); SetContentEmpty(PR_TRUE);
@@ -497,7 +515,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
} }
if (0==kidSize.width) if (0==kidSize.width)
{ {
if (eReflowReason_Initial == aReflowState.reason) if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth)
{ {
float p2t; float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t); aPresContext.GetScaledPixelsToTwips(&p2t);

View File

@@ -810,13 +810,15 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext,
printf ("TR %p for cell %p Initial Reflow: desired=%d, MES=%d\n", printf ("TR %p for cell %p Initial Reflow: desired=%d, MES=%d\n",
this, kidFrame, kidSize.width, kidMaxElementSize.width); 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) { 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; kidSize.width = kidMaxElementSize.width;
} }
if (kidMaxElementSize.height > kidSize.height) { 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; kidSize.height = kidMaxElementSize.height;
} }
@@ -1289,7 +1291,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
aReflowState.reflowState, aReflowState.reflowState,
aNextFrame, kidAvailSize); 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 // 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 // a max width of NS_UNCONSTRAINEDSIZE, because the max width must match
// the width of the previous reflow... // the width of the previous reflow...

View File

@@ -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, NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
@@ -430,7 +456,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) 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. // passing through will not work right.
nsIFrame* next; nsIFrame* next;
aReflowState.reflowCommand->GetNext(next); aReflowState.reflowCommand->GetNext(next);
@@ -474,21 +500,13 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus); ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus);
#ifdef NS_DEBUG #ifdef NS_DEBUG
if (kidSize.width > availSize.width) DebugCheckChildSize(firstKid, kidSize, availSize);
{
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);
}
#endif #endif
// Nav4 hack for 0 dimensioned cells. // Nav4 hack for 0 dimensioned cells.
// Empty cells are assigned a width and height of 4px // Empty cells are assigned a width and height of 4px
// see testcase "cellHeights.html" // see testcase "cellHeights.html"
if (eReflowReason_Initial == aReflowState.reason) if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth)
{ {
if ((0==kidSize.width) && (0==kidSize.height)) if ((0==kidSize.width) && (0==kidSize.height))
SetContentEmpty(PR_TRUE); SetContentEmpty(PR_TRUE);
@@ -497,7 +515,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
} }
if (0==kidSize.width) if (0==kidSize.width)
{ {
if (eReflowReason_Initial == aReflowState.reason) if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth)
{ {
float p2t; float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t); aPresContext.GetScaledPixelsToTwips(&p2t);

View File

@@ -810,13 +810,15 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext,
printf ("TR %p for cell %p Initial Reflow: desired=%d, MES=%d\n", printf ("TR %p for cell %p Initial Reflow: desired=%d, MES=%d\n",
this, kidFrame, kidSize.width, kidMaxElementSize.width); 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) { 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; kidSize.width = kidMaxElementSize.width;
} }
if (kidMaxElementSize.height > kidSize.height) { 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; kidSize.height = kidMaxElementSize.height;
} }
@@ -1289,7 +1291,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
aReflowState.reflowState, aReflowState.reflowState,
aNextFrame, kidAvailSize); 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 // 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 // a max width of NS_UNCONSTRAINEDSIZE, because the max width must match
// the width of the previous reflow... // the width of the previous reflow...