From 8ca6c2fa04ff14ef09c82a0b6a1a9bdf4977affe Mon Sep 17 00:00:00 2001 From: "karnaze@netscape.com" Date: Fri, 23 Apr 1999 17:43:14 +0000 Subject: [PATCH] bug 2267 - cells with row spans too tall --- layout/html/table/src/nsTableRowGroupFrame.cpp | 11 ++++++++++- layout/tables/nsTableRowGroupFrame.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index d519305e9d7e..12f36ab66b1c 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -586,6 +586,8 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame); if (NS_FAILED(rv) || nsnull==tableFrame) return; + nscoord cellSpacingY = tableFrame->GetCellSpacingY(); + PRInt32 rowGroupHeight; for (PRInt32 counter=0; counter<2; counter++) { @@ -617,8 +619,15 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, if (gsDebug) printf("TRGF CalcRowH: cell %p has rowspan=%d\n", cellFrame, rowSpan); nscoord heightOfRowsSpanned = 0; PRInt32 i; - for ( i = 0; i < rowSpan; i++) + for (i = 0; i < rowSpan; i++) { heightOfRowsSpanned += rowHeights[rowIndex + i]; + } + // need to reduce by cell spacing, twice that if it is the top row + heightOfRowsSpanned -= cellSpacingY; + if (0 == rowIndex) { + heightOfRowsSpanned -= cellSpacingY; + } + if (gsDebug) printf("TRGF CalcRowH: heightOfRowsSpanned=%d\n", heightOfRowsSpanned); /* if the cell height fits in the rows, expand the spanning cell's height and slap it in */ diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index d519305e9d7e..12f36ab66b1c 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -586,6 +586,8 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame); if (NS_FAILED(rv) || nsnull==tableFrame) return; + nscoord cellSpacingY = tableFrame->GetCellSpacingY(); + PRInt32 rowGroupHeight; for (PRInt32 counter=0; counter<2; counter++) { @@ -617,8 +619,15 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, if (gsDebug) printf("TRGF CalcRowH: cell %p has rowspan=%d\n", cellFrame, rowSpan); nscoord heightOfRowsSpanned = 0; PRInt32 i; - for ( i = 0; i < rowSpan; i++) + for (i = 0; i < rowSpan; i++) { heightOfRowsSpanned += rowHeights[rowIndex + i]; + } + // need to reduce by cell spacing, twice that if it is the top row + heightOfRowsSpanned -= cellSpacingY; + if (0 == rowIndex) { + heightOfRowsSpanned -= cellSpacingY; + } + if (gsDebug) printf("TRGF CalcRowH: heightOfRowsSpanned=%d\n", heightOfRowsSpanned); /* if the cell height fits in the rows, expand the spanning cell's height and slap it in */