work in progress for table visibility=collapse

This commit is contained in:
karnaze@netscape.com
1999-02-03 23:54:32 +00:00
parent 16f20e191e
commit 43ae593e7c
8 changed files with 64 additions and 6 deletions

View File

@@ -4949,3 +4949,9 @@ nsTableFrame::GetRowGroupFrameFor(nsIFrame* aFrame, const nsStyleDisplay* aDispl
return (nsTableRowGroupFrame*)result; return (nsTableRowGroupFrame*)result;
} }
PRBool
nsTableFrame::IsFinalPass(const nsReflowState& aState)
{
return (NS_UNCONSTRAINEDSIZE != aState.availableWidth) ||
(NS_UNCONSTRAINEDSIZE != aState.availableHeight);
}

View File

@@ -402,6 +402,8 @@ public:
virtual void AddColumnFrame (nsTableColFrame *aColFrame); virtual void AddColumnFrame (nsTableColFrame *aColFrame);
static PRBool IsFinalPass(const nsReflowState& aReflowState);
protected: protected:
/** protected constructor. /** protected constructor.

View File

@@ -63,7 +63,6 @@ struct RowReflowState {
nsTableFrame *tableFrame; nsTableFrame *tableFrame;
RowReflowState(const nsHTMLReflowState& aReflowState, RowReflowState(const nsHTMLReflowState& aReflowState,
nsTableFrame* aTableFrame) nsTableFrame* aTableFrame)
: reflowState(aReflowState) : reflowState(aReflowState)
@@ -1417,6 +1416,17 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
break; 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 // XXX TROY
#if 0 #if 0
aStatus = NS_FRAME_COMPLETE; // we're never continued aStatus = NS_FRAME_COMPLETE; // we're never continued

View File

@@ -643,7 +643,8 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
{ {
const nsStyleDisplay *childDisplay; const nsStyleDisplay *childDisplay;
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)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) // get the height of the tallest cell in the row (excluding cells that span rows)
nscoord maxCellHeight = ((nsTableRowFrame*)rowFrame)->GetTallestChild(); nscoord maxCellHeight = ((nsTableRowFrame*)rowFrame)->GetTallestChild();
@@ -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 (gsDebug==PR_TRUE)
{ {
if (nsnull!=aDesiredSize.maxElementSize) if (nsnull!=aDesiredSize.maxElementSize)

View File

@@ -4949,3 +4949,9 @@ nsTableFrame::GetRowGroupFrameFor(nsIFrame* aFrame, const nsStyleDisplay* aDispl
return (nsTableRowGroupFrame*)result; return (nsTableRowGroupFrame*)result;
} }
PRBool
nsTableFrame::IsFinalPass(const nsReflowState& aState)
{
return (NS_UNCONSTRAINEDSIZE != aState.availableWidth) ||
(NS_UNCONSTRAINEDSIZE != aState.availableHeight);
}

View File

@@ -402,6 +402,8 @@ public:
virtual void AddColumnFrame (nsTableColFrame *aColFrame); virtual void AddColumnFrame (nsTableColFrame *aColFrame);
static PRBool IsFinalPass(const nsReflowState& aReflowState);
protected: protected:
/** protected constructor. /** protected constructor.

View File

@@ -63,7 +63,6 @@ struct RowReflowState {
nsTableFrame *tableFrame; nsTableFrame *tableFrame;
RowReflowState(const nsHTMLReflowState& aReflowState, RowReflowState(const nsHTMLReflowState& aReflowState,
nsTableFrame* aTableFrame) nsTableFrame* aTableFrame)
: reflowState(aReflowState) : reflowState(aReflowState)
@@ -1417,6 +1416,17 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
break; 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 // XXX TROY
#if 0 #if 0
aStatus = NS_FRAME_COMPLETE; // we're never continued aStatus = NS_FRAME_COMPLETE; // we're never continued

View File

@@ -643,7 +643,8 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
{ {
const nsStyleDisplay *childDisplay; const nsStyleDisplay *childDisplay;
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)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) // get the height of the tallest cell in the row (excluding cells that span rows)
nscoord maxCellHeight = ((nsTableRowFrame*)rowFrame)->GetTallestChild(); nscoord maxCellHeight = ((nsTableRowFrame*)rowFrame)->GetTallestChild();
@@ -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 (gsDebug==PR_TRUE)
{ {
if (nsnull!=aDesiredSize.maxElementSize) if (nsnull!=aDesiredSize.maxElementSize)