From 859a2e695cf6f54a3eb47c8f44b915dc540923e9 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Thu, 16 Dec 1999 00:37:03 +0000 Subject: [PATCH] Fix for bug #21703. r=karnaze, a=chofmann --- layout/html/table/src/nsTableRowGroupFrame.cpp | 18 ++++++++++-------- layout/tables/nsTableRowGroupFrame.cpp | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 2d40d577ee03..0fd47dc9301d 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -597,10 +597,12 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext, PRBool hasRowSpanningCell = PR_FALSE; PRInt32 numRows; GetRowCount(numRows, PR_FALSE); - if (numRows <= 0) return; - nscoord *rowHeights = new nscoord[numRows]; - if (!rowHeights) return; - nsCRT::memset (rowHeights, 0, numRows*sizeof(nscoord)); + nscoord* rowHeights = nsnull; + if (numRows > 0) { + rowHeights = new nscoord[numRows]; + if (!rowHeights) return; + nsCRT::memset (rowHeights, 0, numRows*sizeof(nscoord)); + } /* Step 1: get the height of the tallest cell in the row and save it for * pass 2. This height is for table cells that originate in this @@ -1538,12 +1540,12 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresConte } else { // Adjust the frames that follow... AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame, - aDesiredSize.maxElementSize, - desiredSize.height - oldKidRect.height); - + aDesiredSize.maxElementSize, + desiredSize.height - oldKidRect.height); + // Now recalculate the row heights CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState); - + // Because we don't know what changed repaint everything. // XXX We should change CalculateRowHeights() to return the bounding // rect of what changed. Or whether anything moved or changed size... diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 2d40d577ee03..0fd47dc9301d 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -597,10 +597,12 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext, PRBool hasRowSpanningCell = PR_FALSE; PRInt32 numRows; GetRowCount(numRows, PR_FALSE); - if (numRows <= 0) return; - nscoord *rowHeights = new nscoord[numRows]; - if (!rowHeights) return; - nsCRT::memset (rowHeights, 0, numRows*sizeof(nscoord)); + nscoord* rowHeights = nsnull; + if (numRows > 0) { + rowHeights = new nscoord[numRows]; + if (!rowHeights) return; + nsCRT::memset (rowHeights, 0, numRows*sizeof(nscoord)); + } /* Step 1: get the height of the tallest cell in the row and save it for * pass 2. This height is for table cells that originate in this @@ -1538,12 +1540,12 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresConte } else { // Adjust the frames that follow... AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame, - aDesiredSize.maxElementSize, - desiredSize.height - oldKidRect.height); - + aDesiredSize.maxElementSize, + desiredSize.height - oldKidRect.height); + // Now recalculate the row heights CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState); - + // Because we don't know what changed repaint everything. // XXX We should change CalculateRowHeights() to return the bounding // rect of what changed. Or whether anything moved or changed size...