From ebc6d89a67172f2833f639c462eb1f8fd6c23d3e Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Mon, 26 Oct 1998 18:42:22 +0000 Subject: [PATCH] fixed bug 1180 (mozilla.org) and all tables that have nonsense colspans git-svn-id: svn://10.0.0.236/trunk@13459 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/table/src/nsTableFrame.cpp | 8 +++--- .../layout/html/table/src/nsTableRowFrame.cpp | 26 +++++++++---------- mozilla/layout/tables/nsTableFrame.cpp | 8 +++--- mozilla/layout/tables/nsTableRowFrame.cpp | 26 +++++++++---------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index f33bbd2e27e..d2b44318b31 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -570,7 +570,7 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame * NS_PRECONDITION (nsnull!=aCell, "bad cell arg"); nsCellMap *cellMap = GetCellMap(); NS_PRECONDITION (nsnull!=cellMap, "bad call, cellMap not yet allocated."); - PRInt32 colCount = mCellMap->GetColCount(); + PRInt32 colCount = GetColCount(); NS_PRECONDITION (0<=aColIndex && aColIndexGetColCount(); for (PRInt32 colIndex=0; colIndexGetCellFrameAt(rowIndex, colIndex); if (nsnull!=cellFrame) { PRInt32 colSpan = cellFrame->GetColSpan(); - if (0==rowIndex) + if (0==minColSpan) minColSpan = colSpan; else minColSpan = PR_MIN(minColSpan, colSpan); @@ -2813,7 +2813,7 @@ void nsTableFrame::SetTableWidth(nsIPresContext& aPresContext) printf ("SetTableWidth with cellSpacing = %d ", cellSpacing); PRInt32 tableWidth = cellSpacing; - PRInt32 numCols = mCellMap->GetColCount(); + PRInt32 numCols = GetColCount(); for (PRInt32 colIndex = 0; colIndexGetCellSpacing(); PRInt32 cellColSpan=1; // must be defined here so it's set properly for non-cell kids - if (PR_TRUE==gsDebug) printf("%p: RR\n", this); + if (PR_TRUE==gsDebug) printf("Row %p: Resize Reflow\n", this); // Reflow each of our existing cell frames for (nsIFrame* kidFrame = mFirstChild; nsnull != kidFrame; ) { @@ -481,12 +481,12 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, aReflowState.x += aReflowState.tableFrame->GetColumnWidth(colIndex); aReflowState.x += cellSpacing; if (PR_TRUE==gsDebug) - printf(" in loop, aReflowState.x set to %d from cellSpacing %d and col width\n", + printf(" Row: in loop, aReflowState.x set to %d from cellSpacing %d and col width\n", aReflowState.x, aReflowState.tableFrame->GetColumnWidth(colIndex), cellSpacing); } } aReflowState.x += cellSpacing; - if (PR_TRUE==gsDebug) printf(" past loop, aReflowState.x set to %d\n", aReflowState.x); + if (PR_TRUE==gsDebug) printf(" Row: past loop, aReflowState.x set to %d\n", aReflowState.x); // at this point, we know the column widths. // so we get the avail width from the known column widths @@ -501,10 +501,10 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, availWidth += cellSpacing; } if (PR_TRUE==gsDebug) - printf(" in loop, availWidth set to %d from colIndex %d width %d and cellSpacing\n", + printf(" Row: in loop, availWidth set to %d from colIndex %d width %d and cellSpacing\n", availWidth, cellColIndex, aReflowState.tableFrame->GetColumnWidth(cellColIndex+numColSpan), cellSpacing); } - if (PR_TRUE==gsDebug) printf(" availWidth for this cell is %d\n", availWidth); + if (PR_TRUE==gsDebug) printf(" Row: availWidth for this cell is %d\n", availWidth); prevColIndex = cellColIndex + (cellColSpan-1); // remember the rightmost column this cell spans into nsHTMLReflowMetrics desiredSize(pKidMaxElementSize); @@ -524,10 +524,10 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, kidAvailSize, eReflowReason_Resize); - if (gsDebug) printf ("%p RR: avail=%d\n", this, availWidth); + if (gsDebug) printf ("Row %p RR: avail=%d\n", this, availWidth); nsReflowStatus status; rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, status); - if (gsDebug) printf ("%p RR: desired=%d\n", this, desiredSize.width); + if (gsDebug) printf ("Row %p RR: desired=%d\n", this, desiredSize.width); #ifdef NS_DEBUG if (desiredSize.width > availWidth) { @@ -540,12 +540,12 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, if (gsDebug) { if (nsnull!=pKidMaxElementSize) - printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n", + printf("Row: reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n", NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete", desiredSize.width, desiredSize.height, pKidMaxElementSize->width, pKidMaxElementSize->height); else - printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n", + printf("Row: reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n", NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete", desiredSize.width, desiredSize.height); } @@ -594,14 +594,14 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, PlaceChild(aPresContext, aReflowState, kidFrame, kidRect, aDesiredSize.maxElementSize, pKidMaxElementSize); - if (PR_TRUE==gsDebug) printf(" past PlaceChild, aReflowState.x set to %d\n", aReflowState.x); + if (PR_TRUE==gsDebug) printf("Row: past PlaceChild, aReflowState.x set to %d\n", aReflowState.x); } else {// it's an unknown frame type, give it a generic reflow and ignore the results nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, nsSize(0,0), eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); - if (PR_TRUE==gsDebug) printf("\nTIF : Reflow Pass 2 of unknown frame %p of type %d with reason=%d\n", + if (PR_TRUE==gsDebug) printf("\nRow: Resize Reflow of unknown frame %p of type %d with reason=%d\n", kidFrame, kidDisplay->mDisplay, eReflowReason_Resize); ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, aStatus); } @@ -622,14 +622,14 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, aDesiredSize.height = aReflowState.maxCellVertSpace; if (gsDebug) - printf("rr -- row %p width = %d from maxSize %d\n", + printf("Row: RR -- row %p width = %d from maxSize %d\n", this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); if (aDesiredSize.width > aReflowState.reflowState.maxSize.width) { if (gsDebug) { - printf ("%p error case, desired width = %d, maxSize=%d\n", + printf ("Row %p error case, desired width = %d, maxSize=%d\n", this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); fflush (stdout); } diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index f33bbd2e27e..d2b44318b31 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -570,7 +570,7 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame * NS_PRECONDITION (nsnull!=aCell, "bad cell arg"); nsCellMap *cellMap = GetCellMap(); NS_PRECONDITION (nsnull!=cellMap, "bad call, cellMap not yet allocated."); - PRInt32 colCount = mCellMap->GetColCount(); + PRInt32 colCount = GetColCount(); NS_PRECONDITION (0<=aColIndex && aColIndexGetColCount(); for (PRInt32 colIndex=0; colIndexGetCellFrameAt(rowIndex, colIndex); if (nsnull!=cellFrame) { PRInt32 colSpan = cellFrame->GetColSpan(); - if (0==rowIndex) + if (0==minColSpan) minColSpan = colSpan; else minColSpan = PR_MIN(minColSpan, colSpan); @@ -2813,7 +2813,7 @@ void nsTableFrame::SetTableWidth(nsIPresContext& aPresContext) printf ("SetTableWidth with cellSpacing = %d ", cellSpacing); PRInt32 tableWidth = cellSpacing; - PRInt32 numCols = mCellMap->GetColCount(); + PRInt32 numCols = GetColCount(); for (PRInt32 colIndex = 0; colIndexGetCellSpacing(); PRInt32 cellColSpan=1; // must be defined here so it's set properly for non-cell kids - if (PR_TRUE==gsDebug) printf("%p: RR\n", this); + if (PR_TRUE==gsDebug) printf("Row %p: Resize Reflow\n", this); // Reflow each of our existing cell frames for (nsIFrame* kidFrame = mFirstChild; nsnull != kidFrame; ) { @@ -481,12 +481,12 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, aReflowState.x += aReflowState.tableFrame->GetColumnWidth(colIndex); aReflowState.x += cellSpacing; if (PR_TRUE==gsDebug) - printf(" in loop, aReflowState.x set to %d from cellSpacing %d and col width\n", + printf(" Row: in loop, aReflowState.x set to %d from cellSpacing %d and col width\n", aReflowState.x, aReflowState.tableFrame->GetColumnWidth(colIndex), cellSpacing); } } aReflowState.x += cellSpacing; - if (PR_TRUE==gsDebug) printf(" past loop, aReflowState.x set to %d\n", aReflowState.x); + if (PR_TRUE==gsDebug) printf(" Row: past loop, aReflowState.x set to %d\n", aReflowState.x); // at this point, we know the column widths. // so we get the avail width from the known column widths @@ -501,10 +501,10 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, availWidth += cellSpacing; } if (PR_TRUE==gsDebug) - printf(" in loop, availWidth set to %d from colIndex %d width %d and cellSpacing\n", + printf(" Row: in loop, availWidth set to %d from colIndex %d width %d and cellSpacing\n", availWidth, cellColIndex, aReflowState.tableFrame->GetColumnWidth(cellColIndex+numColSpan), cellSpacing); } - if (PR_TRUE==gsDebug) printf(" availWidth for this cell is %d\n", availWidth); + if (PR_TRUE==gsDebug) printf(" Row: availWidth for this cell is %d\n", availWidth); prevColIndex = cellColIndex + (cellColSpan-1); // remember the rightmost column this cell spans into nsHTMLReflowMetrics desiredSize(pKidMaxElementSize); @@ -524,10 +524,10 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, kidAvailSize, eReflowReason_Resize); - if (gsDebug) printf ("%p RR: avail=%d\n", this, availWidth); + if (gsDebug) printf ("Row %p RR: avail=%d\n", this, availWidth); nsReflowStatus status; rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, status); - if (gsDebug) printf ("%p RR: desired=%d\n", this, desiredSize.width); + if (gsDebug) printf ("Row %p RR: desired=%d\n", this, desiredSize.width); #ifdef NS_DEBUG if (desiredSize.width > availWidth) { @@ -540,12 +540,12 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, if (gsDebug) { if (nsnull!=pKidMaxElementSize) - printf("reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n", + printf("Row: reflow of cell returned result = %s with desired=%d,%d, min = %d,%d\n", NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete", desiredSize.width, desiredSize.height, pKidMaxElementSize->width, pKidMaxElementSize->height); else - printf("reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n", + printf("Row: reflow of cell returned result = %s with desired=%d,%d, min = nsnull\n", NS_FRAME_IS_COMPLETE(status)?"complete":"NOT complete", desiredSize.width, desiredSize.height); } @@ -594,14 +594,14 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, PlaceChild(aPresContext, aReflowState, kidFrame, kidRect, aDesiredSize.maxElementSize, pKidMaxElementSize); - if (PR_TRUE==gsDebug) printf(" past PlaceChild, aReflowState.x set to %d\n", aReflowState.x); + if (PR_TRUE==gsDebug) printf("Row: past PlaceChild, aReflowState.x set to %d\n", aReflowState.x); } else {// it's an unknown frame type, give it a generic reflow and ignore the results nsHTMLReflowState kidReflowState(aPresContext, kidFrame, aReflowState.reflowState, nsSize(0,0), eReflowReason_Resize); nsHTMLReflowMetrics desiredSize(nsnull); - if (PR_TRUE==gsDebug) printf("\nTIF : Reflow Pass 2 of unknown frame %p of type %d with reason=%d\n", + if (PR_TRUE==gsDebug) printf("\nRow: Resize Reflow of unknown frame %p of type %d with reason=%d\n", kidFrame, kidDisplay->mDisplay, eReflowReason_Resize); ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, aStatus); } @@ -622,14 +622,14 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext, aDesiredSize.height = aReflowState.maxCellVertSpace; if (gsDebug) - printf("rr -- row %p width = %d from maxSize %d\n", + printf("Row: RR -- row %p width = %d from maxSize %d\n", this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); if (aDesiredSize.width > aReflowState.reflowState.maxSize.width) { if (gsDebug) { - printf ("%p error case, desired width = %d, maxSize=%d\n", + printf ("Row %p error case, desired width = %d, maxSize=%d\n", this, aDesiredSize.width, aReflowState.reflowState.maxSize.width); fflush (stdout); }