diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 0b8903cc25f7..02bba1ad6e02 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -4949,3 +4949,9 @@ nsTableFrame::GetRowGroupFrameFor(nsIFrame* aFrame, const nsStyleDisplay* aDispl return (nsTableRowGroupFrame*)result; } +PRBool +nsTableFrame::IsFinalPass(const nsReflowState& aState) +{ + return (NS_UNCONSTRAINEDSIZE != aState.availableWidth) || + (NS_UNCONSTRAINEDSIZE != aState.availableHeight); +} diff --git a/layout/html/table/src/nsTableFrame.h b/layout/html/table/src/nsTableFrame.h index 1f8abd19f536..1af95160401e 100644 --- a/layout/html/table/src/nsTableFrame.h +++ b/layout/html/table/src/nsTableFrame.h @@ -402,6 +402,8 @@ public: virtual void AddColumnFrame (nsTableColFrame *aColFrame); + static PRBool IsFinalPass(const nsReflowState& aReflowState); + protected: /** protected constructor. diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index ad63c6bfbe54..8a4ca82f0cf0 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -62,7 +62,6 @@ struct RowReflowState { nscoord maxCellVertSpace; // the maximum MAX(cellheight + topMargin + bottomMargin) nsTableFrame *tableFrame; - RowReflowState(const nsHTMLReflowState& aReflowState, nsTableFrame* aTableFrame) @@ -1417,6 +1416,17 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, break; } + // check the visibility in the final pass. If it is collapse, set our desired size to 0 + if (nsTableFrame::IsFinalPass(aReflowState)) { + const nsStyleDisplay *display; + GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); + if (NS_STYLE_VISIBILITY_COLLAPSE == display->mVisible) { + aDesiredSize.width = 0; + aDesiredSize.height = 0; + } + } + + // XXX TROY #if 0 aStatus = NS_FRAME_COMPLETE; // we're never continued diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index bbe29fe4efb3..cbbcc7473678 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -643,7 +643,8 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, { const nsStyleDisplay *childDisplay; rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay)); - if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) + if ((NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) && + (NS_STYLE_VISIBILITY_COLLAPSE != childDisplay->mVisible)) { // get the height of the tallest cell in the row (excluding cells that span rows) nscoord maxCellHeight = ((nsTableRowFrame*)rowFrame)->GetTallestChild(); @@ -661,7 +662,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, } // Get the next row rowFrame->GetNextSibling(rowFrame); - } + } /* Step 2: Now account for cells that span rows. * A spanning cell's height is the sum of the heights of the rows it spans, @@ -1030,6 +1031,16 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, } } + // check the visibility in the final pass. If it is collapse, set our desired size to 0 + if (nsTableFrame::IsFinalPass(aReflowState)) { + const nsStyleDisplay *display; + GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); + if (NS_STYLE_VISIBILITY_COLLAPSE == display->mVisible) { + aDesiredSize.width = 0; + aDesiredSize.height = 0; + } + } + if (gsDebug==PR_TRUE) { if (nsnull!=aDesiredSize.maxElementSize) diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 0b8903cc25f7..02bba1ad6e02 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -4949,3 +4949,9 @@ nsTableFrame::GetRowGroupFrameFor(nsIFrame* aFrame, const nsStyleDisplay* aDispl return (nsTableRowGroupFrame*)result; } +PRBool +nsTableFrame::IsFinalPass(const nsReflowState& aState) +{ + return (NS_UNCONSTRAINEDSIZE != aState.availableWidth) || + (NS_UNCONSTRAINEDSIZE != aState.availableHeight); +} diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index 1f8abd19f536..1af95160401e 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -402,6 +402,8 @@ public: virtual void AddColumnFrame (nsTableColFrame *aColFrame); + static PRBool IsFinalPass(const nsReflowState& aReflowState); + protected: /** protected constructor. diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index ad63c6bfbe54..8a4ca82f0cf0 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -62,7 +62,6 @@ struct RowReflowState { nscoord maxCellVertSpace; // the maximum MAX(cellheight + topMargin + bottomMargin) nsTableFrame *tableFrame; - RowReflowState(const nsHTMLReflowState& aReflowState, nsTableFrame* aTableFrame) @@ -1417,6 +1416,17 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext, break; } + // check the visibility in the final pass. If it is collapse, set our desired size to 0 + if (nsTableFrame::IsFinalPass(aReflowState)) { + const nsStyleDisplay *display; + GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); + if (NS_STYLE_VISIBILITY_COLLAPSE == display->mVisible) { + aDesiredSize.width = 0; + aDesiredSize.height = 0; + } + } + + // XXX TROY #if 0 aStatus = NS_FRAME_COMPLETE; // we're never continued diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index bbe29fe4efb3..cbbcc7473678 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -643,7 +643,8 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, { const nsStyleDisplay *childDisplay; rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay)); - if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) + if ((NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) && + (NS_STYLE_VISIBILITY_COLLAPSE != childDisplay->mVisible)) { // get the height of the tallest cell in the row (excluding cells that span rows) nscoord maxCellHeight = ((nsTableRowFrame*)rowFrame)->GetTallestChild(); @@ -661,7 +662,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext, } // Get the next row rowFrame->GetNextSibling(rowFrame); - } + } /* Step 2: Now account for cells that span rows. * A spanning cell's height is the sum of the heights of the rows it spans, @@ -1030,6 +1031,16 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, } } + // check the visibility in the final pass. If it is collapse, set our desired size to 0 + if (nsTableFrame::IsFinalPass(aReflowState)) { + const nsStyleDisplay *display; + GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); + if (NS_STYLE_VISIBILITY_COLLAPSE == display->mVisible) { + aDesiredSize.width = 0; + aDesiredSize.height = 0; + } + } + if (gsDebug==PR_TRUE) { if (nsnull!=aDesiredSize.maxElementSize)