More nested row group work.

This commit is contained in:
hyatt%netscape.com 1999-06-14 08:22:47 +00:00
parent 5853a4243b
commit 815e81f837
6 changed files with 66 additions and 32 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -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 */

View File

@ -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);
}

View File

@ -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,

View File

@ -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 */