зеркало из https://github.com/mozilla/pjs.git
make visibility collapse work during incr reflows bug 77019 r= bzbarsky sr=dbaron
This commit is contained in:
Родитель
e34689287c
Коммит
21603d12f9
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTableColFrame.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -176,6 +177,15 @@ NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
aDesiredSize.width=0;
|
||||
aDesiredSize.height=0;
|
||||
const nsStyleVisibility* colVis = GetStyleVisibility();
|
||||
PRBool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
||||
if (collapseCol) {
|
||||
nsTableFrame* tableFrame = nsnull;
|
||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (tableFrame) {
|
||||
tableFrame->SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
}
|
||||
if (aDesiredSize.mComputeMEW)
|
||||
{
|
||||
aDesiredSize.mMaxElementWidth=0;
|
||||
|
|
|
@ -426,10 +426,21 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
NS_ASSERTION(nsnull!=mContent, "bad state -- null content for frame");
|
||||
nsresult rv=NS_OK;
|
||||
|
||||
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
nsTableFrame* tableFrame = nsnull;
|
||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (tableFrame) {
|
||||
tableFrame->SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
}
|
||||
// for every content child that (is a column thingy and does not already have a frame)
|
||||
// create a frame and adjust it's style
|
||||
nsIFrame* kidFrame = nsnull;
|
||||
|
||||
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
rv = IncrementalReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
|
|
|
@ -1905,7 +1905,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
GET_TWIPS_TO_PIXELS(aPresContext, p2t);
|
||||
CalcBCBorders(*aPresContext);
|
||||
}
|
||||
PRBool doCollapse = PR_FALSE; // collapsing rows, cols, etc.
|
||||
|
||||
aDesiredSize.width = aReflowState.availableWidth;
|
||||
|
||||
|
@ -2004,7 +2003,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight;
|
||||
|
||||
ReflowTable(aPresContext, aDesiredSize, aReflowState, availHeight, nextReason,
|
||||
lastChildReflowed, doCollapse, balanced, aStatus);
|
||||
lastChildReflowed, balanced, aStatus);
|
||||
reflowedChildren = PR_TRUE;
|
||||
}
|
||||
if (willInitiateSpecialReflow && NS_FRAME_IS_COMPLETE(aStatus)) {
|
||||
|
@ -2017,7 +2016,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_TRUE;
|
||||
ReflowTable(aPresContext, aDesiredSize, aReflowState, aReflowState.availableHeight,
|
||||
nextReason, lastChildReflowed, doCollapse, balanced, aStatus);
|
||||
nextReason, lastChildReflowed, balanced, aStatus);
|
||||
// restore the previous special height reflow initiator
|
||||
((nsHTMLReflowState&)aReflowState).mPercentHeightReflowInitiator = specialReflowInitiator;
|
||||
// XXX We should call SetInitiatedSpecialReflow(PR_FALSE) at some point, but it is difficult to tell when
|
||||
|
@ -2054,8 +2053,10 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
nsMargin borderPadding = GetChildAreaOffset(&aReflowState);
|
||||
SetColumnDimensions(aDesiredSize.height, borderPadding);
|
||||
if (doCollapse) {
|
||||
if (NeedToCollapseRows()) {
|
||||
AdjustForCollapsingRows(aPresContext, aDesiredSize.height);
|
||||
}
|
||||
if (NeedToCollapseColumns()) {
|
||||
AdjustForCollapsingCols(aPresContext, aDesiredSize.width);
|
||||
}
|
||||
|
||||
|
@ -2133,12 +2134,10 @@ nsTableFrame::ReflowTable(nsIPresContext* aPresContext,
|
|||
nscoord aAvailHeight,
|
||||
nsReflowReason aReason,
|
||||
nsIFrame*& aLastChildReflowed,
|
||||
PRBool& aDoCollapse,
|
||||
PRBool& aDidBalance,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
aDoCollapse = PR_FALSE;
|
||||
aDidBalance = PR_FALSE;
|
||||
aLastChildReflowed = nsnull;
|
||||
|
||||
|
@ -2165,8 +2164,6 @@ nsTableFrame::ReflowTable(nsIPresContext* aPresContext,
|
|||
|
||||
if (eReflowReason_Resize == aReflowState.reason) {
|
||||
if (!DidResizeReflow()) {
|
||||
// XXX we need to do this in other cases as well, but it needs to be made more incremental
|
||||
aDoCollapse = PR_TRUE;
|
||||
SetResizeReflow(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -2292,14 +2289,21 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|||
const nsStyleVisibility* groupVis = aRowGroupFrame->GetStyleVisibility();
|
||||
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
nsIFrame* rowFrame = aRowGroupFrame->GetFirstChild(nsnull);
|
||||
|
||||
while (nsnull != rowFrame) {
|
||||
const nsStyleDisplay* rowDisplay = rowFrame->GetStyleDisplay();
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) {
|
||||
const nsStyleVisibility* rowVis = rowFrame->GetStyleVisibility();
|
||||
PRBool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
||||
if (collapseRow) {
|
||||
SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
nsRect rowRect = rowFrame->GetRect();
|
||||
if (collapseGroup || (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible)) {
|
||||
if (collapseGroup || collapseRow) {
|
||||
aYGroupOffset += rowRect.height;
|
||||
rowRect.height = 0;
|
||||
rowFrame->SetRect(rowRect);
|
||||
|
@ -2362,6 +2366,8 @@ NS_METHOD nsTableFrame::AdjustForCollapsingRows(nsIPresContext* aPresContext,
|
|||
nscoord yGroupOffset = 0; // total offset among rows within a single row group
|
||||
nscoord yTotalOffset = 0; // total offset among all rows in all row groups
|
||||
PRInt32 rowIndex = 0;
|
||||
// reset the bit, it will be set again if row/rowgroup is collapsed
|
||||
SetNeedToCollapseRows(PR_FALSE);
|
||||
|
||||
// collapse the rows and/or row groups as necessary
|
||||
while (nsnull != groupFrame) {
|
||||
|
@ -2383,6 +2389,8 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
{
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) return NS_OK;
|
||||
// reset the bit, it will be set again if col/colgroup is collapsed
|
||||
SetNeedToCollapseColumns(PR_FALSE);
|
||||
|
||||
PRInt32 numRows = cellMap->GetRowCount();
|
||||
nsTableIterator groupIter(mColGroups, eTableDIR);
|
||||
|
@ -2396,6 +2404,9 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
const nsStyleVisibility* groupVis = groupFrame->GetStyleVisibility();
|
||||
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
nsTableIterator colIter(*groupFrame, eTableDIR);
|
||||
nsIFrame* colFrame = colIter.First();
|
||||
// iterate over the cols in the col group
|
||||
|
@ -2404,6 +2415,9 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
|
||||
const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
|
||||
PRBool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
||||
if (collapseCol) {
|
||||
SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
PRInt32 colWidth = GetColumnWidth(colX);
|
||||
if (collapseGroup || collapseCol) {
|
||||
xOffset += colWidth + cellSpacingX;
|
||||
|
|
|
@ -382,7 +382,6 @@ public:
|
|||
nscoord aAvailHeight,
|
||||
nsReflowReason aReason,
|
||||
nsIFrame*& aLastChildReflowed,
|
||||
PRBool& aDoCollapse,
|
||||
PRBool& aDidBalance,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
|
@ -789,6 +788,12 @@ public:
|
|||
PRBool NeedToCalcBCBorders() const;
|
||||
void SetNeedToCalcBCBorders(PRBool aValue);
|
||||
|
||||
PRBool NeedToCollapseRows() const;
|
||||
void SetNeedToCollapseRows(PRBool aValue);
|
||||
|
||||
PRBool NeedToCollapseColumns() const;
|
||||
void SetNeedToCollapseColumns(PRBool aValue);
|
||||
|
||||
/** Get the cell map for this table frame. It is not always mCellMap.
|
||||
* Only the firstInFlow has a legit cell map
|
||||
*/
|
||||
|
@ -930,7 +935,9 @@ protected:
|
|||
PRUint32 mInitiatedSpecialReflow:1;
|
||||
PRUint32 mNeedToCalcBCBorders:1;
|
||||
PRUint32 mLeftContBCBorder:8;
|
||||
PRUint32 : 11; // unused
|
||||
PRUint32 mNeedToCollapseRows:1; // rows that have visibility need to be collapse
|
||||
PRUint32 mNeedToCollapseColumns:1; // colums that have visibility need to be collapsed
|
||||
PRUint32 :9; // unused
|
||||
} mBits;
|
||||
|
||||
nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, and cells
|
||||
|
@ -1048,6 +1055,26 @@ inline void nsTableFrame::SetRowInserted(PRBool aValue)
|
|||
mBits.mRowInserted = (unsigned)aValue;
|
||||
}
|
||||
|
||||
inline void nsTableFrame::SetNeedToCollapseRows(PRBool aValue)
|
||||
{
|
||||
mBits.mNeedToCollapseRows = (unsigned)aValue;
|
||||
}
|
||||
|
||||
inline PRBool nsTableFrame::NeedToCollapseRows() const
|
||||
{
|
||||
return (PRBool)mBits.mNeedToCollapseRows;
|
||||
}
|
||||
|
||||
inline void nsTableFrame::SetNeedToCollapseColumns(PRBool aValue)
|
||||
{
|
||||
mBits.mNeedToCollapseColumns = (unsigned)aValue;
|
||||
}
|
||||
|
||||
inline PRBool nsTableFrame::NeedToCollapseColumns() const
|
||||
{
|
||||
return (PRBool)mBits.mNeedToCollapseColumns;
|
||||
}
|
||||
|
||||
inline nsFrameList& nsTableFrame::GetColGroups()
|
||||
{
|
||||
return NS_STATIC_CAST(nsTableFrame*, GetFirstInFlow())->mColGroups;
|
||||
|
|
|
@ -1373,6 +1373,12 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
|
|||
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (!tableFrame) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
||||
PRBool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
||||
if (collapseRow) {
|
||||
tableFrame->SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
|
||||
// see if a special height reflow needs to occur due to having a pct height
|
||||
if (!NeedSpecialReflow())
|
||||
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
||||
|
|
|
@ -1201,6 +1201,11 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
nsRowGroupReflowState state(aReflowState, tableFrame);
|
||||
PRBool haveDesiredHeight = PR_FALSE;
|
||||
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
tableFrame->SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
rv = IncrementalReflow(aPresContext, aDesiredSize, state, aStatus);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTableColFrame.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -176,6 +177,15 @@ NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
aDesiredSize.width=0;
|
||||
aDesiredSize.height=0;
|
||||
const nsStyleVisibility* colVis = GetStyleVisibility();
|
||||
PRBool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
||||
if (collapseCol) {
|
||||
nsTableFrame* tableFrame = nsnull;
|
||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (tableFrame) {
|
||||
tableFrame->SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
}
|
||||
if (aDesiredSize.mComputeMEW)
|
||||
{
|
||||
aDesiredSize.mMaxElementWidth=0;
|
||||
|
|
|
@ -426,10 +426,21 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
NS_ASSERTION(nsnull!=mContent, "bad state -- null content for frame");
|
||||
nsresult rv=NS_OK;
|
||||
|
||||
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
nsTableFrame* tableFrame = nsnull;
|
||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (tableFrame) {
|
||||
tableFrame->SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
}
|
||||
// for every content child that (is a column thingy and does not already have a frame)
|
||||
// create a frame and adjust it's style
|
||||
nsIFrame* kidFrame = nsnull;
|
||||
|
||||
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
rv = IncrementalReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
|
|
|
@ -1905,7 +1905,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
GET_TWIPS_TO_PIXELS(aPresContext, p2t);
|
||||
CalcBCBorders(*aPresContext);
|
||||
}
|
||||
PRBool doCollapse = PR_FALSE; // collapsing rows, cols, etc.
|
||||
|
||||
aDesiredSize.width = aReflowState.availableWidth;
|
||||
|
||||
|
@ -2004,7 +2003,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight;
|
||||
|
||||
ReflowTable(aPresContext, aDesiredSize, aReflowState, availHeight, nextReason,
|
||||
lastChildReflowed, doCollapse, balanced, aStatus);
|
||||
lastChildReflowed, balanced, aStatus);
|
||||
reflowedChildren = PR_TRUE;
|
||||
}
|
||||
if (willInitiateSpecialReflow && NS_FRAME_IS_COMPLETE(aStatus)) {
|
||||
|
@ -2017,7 +2016,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_TRUE;
|
||||
ReflowTable(aPresContext, aDesiredSize, aReflowState, aReflowState.availableHeight,
|
||||
nextReason, lastChildReflowed, doCollapse, balanced, aStatus);
|
||||
nextReason, lastChildReflowed, balanced, aStatus);
|
||||
// restore the previous special height reflow initiator
|
||||
((nsHTMLReflowState&)aReflowState).mPercentHeightReflowInitiator = specialReflowInitiator;
|
||||
// XXX We should call SetInitiatedSpecialReflow(PR_FALSE) at some point, but it is difficult to tell when
|
||||
|
@ -2054,8 +2053,10 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
nsMargin borderPadding = GetChildAreaOffset(&aReflowState);
|
||||
SetColumnDimensions(aDesiredSize.height, borderPadding);
|
||||
if (doCollapse) {
|
||||
if (NeedToCollapseRows()) {
|
||||
AdjustForCollapsingRows(aPresContext, aDesiredSize.height);
|
||||
}
|
||||
if (NeedToCollapseColumns()) {
|
||||
AdjustForCollapsingCols(aPresContext, aDesiredSize.width);
|
||||
}
|
||||
|
||||
|
@ -2133,12 +2134,10 @@ nsTableFrame::ReflowTable(nsIPresContext* aPresContext,
|
|||
nscoord aAvailHeight,
|
||||
nsReflowReason aReason,
|
||||
nsIFrame*& aLastChildReflowed,
|
||||
PRBool& aDoCollapse,
|
||||
PRBool& aDidBalance,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
aDoCollapse = PR_FALSE;
|
||||
aDidBalance = PR_FALSE;
|
||||
aLastChildReflowed = nsnull;
|
||||
|
||||
|
@ -2165,8 +2164,6 @@ nsTableFrame::ReflowTable(nsIPresContext* aPresContext,
|
|||
|
||||
if (eReflowReason_Resize == aReflowState.reason) {
|
||||
if (!DidResizeReflow()) {
|
||||
// XXX we need to do this in other cases as well, but it needs to be made more incremental
|
||||
aDoCollapse = PR_TRUE;
|
||||
SetResizeReflow(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -2292,14 +2289,21 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|||
const nsStyleVisibility* groupVis = aRowGroupFrame->GetStyleVisibility();
|
||||
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
nsIFrame* rowFrame = aRowGroupFrame->GetFirstChild(nsnull);
|
||||
|
||||
while (nsnull != rowFrame) {
|
||||
const nsStyleDisplay* rowDisplay = rowFrame->GetStyleDisplay();
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) {
|
||||
const nsStyleVisibility* rowVis = rowFrame->GetStyleVisibility();
|
||||
PRBool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
||||
if (collapseRow) {
|
||||
SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
nsRect rowRect = rowFrame->GetRect();
|
||||
if (collapseGroup || (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible)) {
|
||||
if (collapseGroup || collapseRow) {
|
||||
aYGroupOffset += rowRect.height;
|
||||
rowRect.height = 0;
|
||||
rowFrame->SetRect(rowRect);
|
||||
|
@ -2362,6 +2366,8 @@ NS_METHOD nsTableFrame::AdjustForCollapsingRows(nsIPresContext* aPresContext,
|
|||
nscoord yGroupOffset = 0; // total offset among rows within a single row group
|
||||
nscoord yTotalOffset = 0; // total offset among all rows in all row groups
|
||||
PRInt32 rowIndex = 0;
|
||||
// reset the bit, it will be set again if row/rowgroup is collapsed
|
||||
SetNeedToCollapseRows(PR_FALSE);
|
||||
|
||||
// collapse the rows and/or row groups as necessary
|
||||
while (nsnull != groupFrame) {
|
||||
|
@ -2383,6 +2389,8 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
{
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) return NS_OK;
|
||||
// reset the bit, it will be set again if col/colgroup is collapsed
|
||||
SetNeedToCollapseColumns(PR_FALSE);
|
||||
|
||||
PRInt32 numRows = cellMap->GetRowCount();
|
||||
nsTableIterator groupIter(mColGroups, eTableDIR);
|
||||
|
@ -2396,6 +2404,9 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
const nsStyleVisibility* groupVis = groupFrame->GetStyleVisibility();
|
||||
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
nsTableIterator colIter(*groupFrame, eTableDIR);
|
||||
nsIFrame* colFrame = colIter.First();
|
||||
// iterate over the cols in the col group
|
||||
|
@ -2404,6 +2415,9 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
|
||||
const nsStyleVisibility* colVis = colFrame->GetStyleVisibility();
|
||||
PRBool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
||||
if (collapseCol) {
|
||||
SetNeedToCollapseColumns(PR_TRUE);
|
||||
}
|
||||
PRInt32 colWidth = GetColumnWidth(colX);
|
||||
if (collapseGroup || collapseCol) {
|
||||
xOffset += colWidth + cellSpacingX;
|
||||
|
|
|
@ -382,7 +382,6 @@ public:
|
|||
nscoord aAvailHeight,
|
||||
nsReflowReason aReason,
|
||||
nsIFrame*& aLastChildReflowed,
|
||||
PRBool& aDoCollapse,
|
||||
PRBool& aDidBalance,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
|
@ -789,6 +788,12 @@ public:
|
|||
PRBool NeedToCalcBCBorders() const;
|
||||
void SetNeedToCalcBCBorders(PRBool aValue);
|
||||
|
||||
PRBool NeedToCollapseRows() const;
|
||||
void SetNeedToCollapseRows(PRBool aValue);
|
||||
|
||||
PRBool NeedToCollapseColumns() const;
|
||||
void SetNeedToCollapseColumns(PRBool aValue);
|
||||
|
||||
/** Get the cell map for this table frame. It is not always mCellMap.
|
||||
* Only the firstInFlow has a legit cell map
|
||||
*/
|
||||
|
@ -930,7 +935,9 @@ protected:
|
|||
PRUint32 mInitiatedSpecialReflow:1;
|
||||
PRUint32 mNeedToCalcBCBorders:1;
|
||||
PRUint32 mLeftContBCBorder:8;
|
||||
PRUint32 : 11; // unused
|
||||
PRUint32 mNeedToCollapseRows:1; // rows that have visibility need to be collapse
|
||||
PRUint32 mNeedToCollapseColumns:1; // colums that have visibility need to be collapsed
|
||||
PRUint32 :9; // unused
|
||||
} mBits;
|
||||
|
||||
nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, and cells
|
||||
|
@ -1048,6 +1055,26 @@ inline void nsTableFrame::SetRowInserted(PRBool aValue)
|
|||
mBits.mRowInserted = (unsigned)aValue;
|
||||
}
|
||||
|
||||
inline void nsTableFrame::SetNeedToCollapseRows(PRBool aValue)
|
||||
{
|
||||
mBits.mNeedToCollapseRows = (unsigned)aValue;
|
||||
}
|
||||
|
||||
inline PRBool nsTableFrame::NeedToCollapseRows() const
|
||||
{
|
||||
return (PRBool)mBits.mNeedToCollapseRows;
|
||||
}
|
||||
|
||||
inline void nsTableFrame::SetNeedToCollapseColumns(PRBool aValue)
|
||||
{
|
||||
mBits.mNeedToCollapseColumns = (unsigned)aValue;
|
||||
}
|
||||
|
||||
inline PRBool nsTableFrame::NeedToCollapseColumns() const
|
||||
{
|
||||
return (PRBool)mBits.mNeedToCollapseColumns;
|
||||
}
|
||||
|
||||
inline nsFrameList& nsTableFrame::GetColGroups()
|
||||
{
|
||||
return NS_STATIC_CAST(nsTableFrame*, GetFirstInFlow())->mColGroups;
|
||||
|
|
|
@ -1373,6 +1373,12 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
|
|||
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (!tableFrame) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
||||
PRBool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
||||
if (collapseRow) {
|
||||
tableFrame->SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
|
||||
// see if a special height reflow needs to occur due to having a pct height
|
||||
if (!NeedSpecialReflow())
|
||||
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
||||
|
|
|
@ -1201,6 +1201,11 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
|
|||
|
||||
nsRowGroupReflowState state(aReflowState, tableFrame);
|
||||
PRBool haveDesiredHeight = PR_FALSE;
|
||||
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
||||
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||
if (collapseGroup) {
|
||||
tableFrame->SetNeedToCollapseRows(PR_TRUE);
|
||||
}
|
||||
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
rv = IncrementalReflow(aPresContext, aDesiredSize, state, aStatus);
|
||||
|
|
Загрузка…
Ссылка в новой задаче