bug 325292 - place the needtocollapse flag on the first inflow so that works in pagination mode r/sr=roc

This commit is contained in:
Bernd 2009-06-21 18:34:03 +02:00
Родитель 17845292a3
Коммит faf99f05b9
5 изменённых файлов: 43 добавлений и 39 удалений

Просмотреть файл

@ -0,0 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html class="reftest-print">
<style>
#second {border-bottom:green 5px solid}
</style>
<body>
<title>visibility collapse + columns + pagination</title>
<table cellspacing="0" style="page-break-after:always" id="first">
<col><col style="visibility:collapse"><col>
<tr><td>cell1</td><td>Dont'show</td><td>cell2</td></tr></table>
<table cellspacing="0" id="second">
<col><col style="visibility:collapse"><col>
<tr><td>cell3</td><td>Dont'show</td><td>cell4</td></tr>
</table>
</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html class="reftest-print">
<title>visibility collapse + columns + pagination</title>
<style>
table {border-bottom:green 5px solid}
</style>
<body>
<table cellspacing="0">
<col><col style="visibility:collapse"><col>
<tr style="page-break-after:always"><td>cell1</td><td>Dont'show</td><td>cell2</td></tr>
<tr><td>cell3</td><td>Dont'show</td><td>cell4</td></tr>
</table>
</body>
</html>

Просмотреть файл

@ -359,6 +359,7 @@ fails == 315920-5.html 315920-5-ref.html # bug 229915 ???
== 323656-4.html 323656-4-ref.html
== 323656-5.svg 323656-5-ref.svg
== 323656-6.html 323656-6-ref.html
== 325292-1.html 325292-1-ref.html
== 325486-1.html 325486-1-ref.html
== 328111-1.html 328111-1-ref.html
random == 328829-1.xhtml 328829-1-ref.xhtml # bug 369046 (intermittent)

Просмотреть файл

@ -2173,14 +2173,14 @@ nsTableFrame::AdjustForCollapsingRowsCols(nsHTMLReflowMetrics& aDesiredSize,
// reset the bit, it will be set again if row/rowgroup or col/colgroup are
// collapsed
SetNeedToCollapse(PR_FALSE);
CheckCollapsedColumns();
// collapse the rows and/or row groups as necessary
// Get the ordered children
RowGroupArray rowGroups;
OrderRowGroups(rowGroups);
nscoord width = GetCollapsedWidth(aBorderPadding);
nsTableFrame* firstInFlow = static_cast<nsTableFrame*> (GetFirstInFlow());
nscoord width = firstInFlow->GetCollapsedWidth(aBorderPadding);
nscoord rgWidth = width - 2 * GetCellSpacingX();
nsRect overflowArea(0, 0, 0, 0);
// Walk the list of children
@ -2199,39 +2199,11 @@ nsTableFrame::AdjustForCollapsingRowsCols(nsHTMLReflowMetrics& aDesiredSize,
nsSize(aDesiredSize.width, aDesiredSize.height));
}
void
nsTableFrame::CheckCollapsedColumns()
{
nsTableFrame* tableFrame = static_cast<nsTableFrame*>(GetFirstInFlow());
if (!tableFrame)
return;
// loop over colgroups
for (nsIFrame* groupFrame = mColGroups.FirstChild(); groupFrame;
groupFrame = groupFrame->GetNextSibling()) {
const nsStyleVisibility* groupVis = groupFrame->GetStyleVisibility();
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
tableFrame->SetNeedToCollapse(PR_TRUE);
return;
}
}
//loop over columns
PRInt32 numCols = mColFrames.Length();
for (int colX = 0; colX < numCols; colX++) {
nsTableColFrame* colFrame = tableFrame->GetColFrame(colX);
const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
PRBool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE ==
colVis->mVisible);
if (collapseCol) {
tableFrame->SetNeedToCollapse(PR_TRUE);
return;
}
}
}
nscoord
nsTableFrame::GetCollapsedWidth(nsMargin aBorderPadding)
{
NS_ASSERTION(!GetPrevInFlow(), "GetCollapsedWidth called on next in flow");
nscoord cellSpacingX = GetCellSpacingX();
nscoord width = cellSpacingX;
width += aBorderPadding.left + aBorderPadding.right;
@ -2253,6 +2225,9 @@ nsTableFrame::GetCollapsedWidth(nsMargin aBorderPadding)
if (ColumnHasCellSpacingBefore(colX))
width += cellSpacingX;
}
else {
SetNeedToCollapse(PR_TRUE);
}
}
}
}

Просмотреть файл

@ -608,9 +608,6 @@ protected:
void AdjustForCollapsingRowsCols(nsHTMLReflowMetrics& aDesiredSize,
nsMargin aBorderPadding);
/** check if columns or colgroups are collapsed */
void CheckCollapsedColumns();
nsITableLayoutStrategy* LayoutStrategy() const {
return static_cast<nsTableFrame*>(GetFirstInFlow())->
mTableLayoutStrategy;
@ -914,12 +911,12 @@ inline void nsTableFrame::SetRowInserted(PRBool aValue)
inline void nsTableFrame::SetNeedToCollapse(PRBool aValue)
{
mBits.mNeedToCollapse = (unsigned)aValue;
static_cast<nsTableFrame*>(GetFirstInFlow())->mBits.mNeedToCollapse = (unsigned)aValue;
}
inline PRBool nsTableFrame::NeedToCollapse() const
{
return (PRBool)mBits.mNeedToCollapse;
return (PRBool) static_cast<nsTableFrame*>(GetFirstInFlow())->mBits.mNeedToCollapse;
}
inline void nsTableFrame::SetHasZeroColSpans(PRBool aValue)