From e2c320e27d76be01e81a300585ae28bd2b7a5596 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Mon, 14 Jun 1999 08:22:47 +0000 Subject: [PATCH] More nested row group work. git-svn-id: svn://10.0.0.236/trunk@35131 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/table/src/nsTableFrame.cpp | 18 ++----------- .../html/table/src/nsTableRowGroupFrame.cpp | 25 +++++++++++++++++++ .../html/table/src/nsTableRowGroupFrame.h | 6 +++++ mozilla/layout/tables/nsTableFrame.cpp | 18 ++----------- .../layout/tables/nsTableRowGroupFrame.cpp | 25 +++++++++++++++++++ mozilla/layout/tables/nsTableRowGroupFrame.h | 6 +++++ 6 files changed, 66 insertions(+), 32 deletions(-) diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index d35872870db..6a76a2de85d 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -4236,22 +4236,8 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext, const nsStyleDisplay *rowGroupDisplay; rowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowGroupDisplay)); if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay)) - { // the rows in rowGroupFrame need to be expanded by rowHeightDelta[i] - // and the rowgroup itself needs to be expanded by SUM(row height deltas) - nsIFrame * rowFrame=nsnull; - rv = rowGroupFrame->FirstChild(nsnull, &rowFrame); - while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame)) - { - const nsStyleDisplay *rowDisplay; - rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay)); - if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) - { // the row needs to be expanded by the proportion this row contributed to the original height - nsRect rowRect; - rowFrame->GetRect(rowRect); - sumOfRowHeights += rowRect.height; - } - rowFrame->GetNextSibling(&rowFrame); - } + { + ((nsTableRowGroupFrame*)rowGroupFrame)->GetHeightOfRows(sumOfRowHeights); } rowGroupFrame->GetNextSibling(&rowGroupFrame); } diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 1bf004e4c03..561492ecd9a 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -1294,6 +1294,31 @@ PRBool nsTableRowGroupFrame::NoRowsFollow() return result; } +NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult) +{ + // the rows in rowGroupFrame need to be expanded by rowHeightDelta[i] + // and the rowgroup itself needs to be expanded by SUM(row height deltas) + nsIFrame * rowFrame=nsnull; + nsresult rv = FirstChild(nsnull, &rowFrame); + while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame)) + { + const nsStyleDisplay *rowDisplay; + rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay)); + if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) + { + nsRect rowRect; + rowFrame->GetRect(rowRect); + aResult += rowRect.height; + } + else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay) + { + ((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aResult); + } + rowFrame->GetNextSibling(&rowFrame); + } + return NS_OK; +} + // since we know we're doing an append here, we can optimize NS_METHOD nsTableRowGroupFrame::IR_RowAppended(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h index 31290a8b805..b8c97d50b43 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h @@ -123,6 +123,12 @@ public: */ nsresult InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame); + + /** + * Get the total height of all the row rects + */ + NS_METHOD GetHeightOfRows(nscoord& aResult); + protected: /** implement abstract method on nsHTMLContainerFrame */ diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index d35872870db..6a76a2de85d 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -4236,22 +4236,8 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext, const nsStyleDisplay *rowGroupDisplay; rowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowGroupDisplay)); if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay)) - { // the rows in rowGroupFrame need to be expanded by rowHeightDelta[i] - // and the rowgroup itself needs to be expanded by SUM(row height deltas) - nsIFrame * rowFrame=nsnull; - rv = rowGroupFrame->FirstChild(nsnull, &rowFrame); - while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame)) - { - const nsStyleDisplay *rowDisplay; - rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay)); - if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) - { // the row needs to be expanded by the proportion this row contributed to the original height - nsRect rowRect; - rowFrame->GetRect(rowRect); - sumOfRowHeights += rowRect.height; - } - rowFrame->GetNextSibling(&rowFrame); - } + { + ((nsTableRowGroupFrame*)rowGroupFrame)->GetHeightOfRows(sumOfRowHeights); } rowGroupFrame->GetNextSibling(&rowGroupFrame); } diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 1bf004e4c03..561492ecd9a 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -1294,6 +1294,31 @@ PRBool nsTableRowGroupFrame::NoRowsFollow() return result; } +NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult) +{ + // the rows in rowGroupFrame need to be expanded by rowHeightDelta[i] + // and the rowgroup itself needs to be expanded by SUM(row height deltas) + nsIFrame * rowFrame=nsnull; + nsresult rv = FirstChild(nsnull, &rowFrame); + while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame)) + { + const nsStyleDisplay *rowDisplay; + rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay)); + if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) + { + nsRect rowRect; + rowFrame->GetRect(rowRect); + aResult += rowRect.height; + } + else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay) + { + ((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aResult); + } + rowFrame->GetNextSibling(&rowFrame); + } + return NS_OK; +} + // since we know we're doing an append here, we can optimize NS_METHOD nsTableRowGroupFrame::IR_RowAppended(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h index 31290a8b805..b8c97d50b43 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.h +++ b/mozilla/layout/tables/nsTableRowGroupFrame.h @@ -123,6 +123,12 @@ public: */ nsresult InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame); + + /** + * Get the total height of all the row rects + */ + NS_METHOD GetHeightOfRows(nscoord& aResult); + protected: /** implement abstract method on nsHTMLContainerFrame */