bug 141021 - skip row reflow optimization of cell when the cell hasn't had a pass2 reflow. sr=waterson, r=bernd.

This commit is contained in:
karnaze%netscape.com 2002-05-09 14:44:02 +00:00
parent c6a7cce9eb
commit bb4247183f
7 changed files with 62 additions and 0 deletions

View File

@ -84,6 +84,7 @@ nsTableCellFrame::nsTableCellFrame()
SetNeedSpecialReflow(PR_FALSE);
SetHadSpecialReflow(PR_FALSE);
SetHasPctOverHeight(PR_FALSE);
SetNeedPass2Reflow(PR_TRUE);
#ifdef DEBUG_TABLE_REFLOW_TIMING
mTimer = new nsReflowTimer(this);
@ -1130,6 +1131,14 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) {
SetNeedPass2Reflow(PR_TRUE);
}
else if ((eReflowReason_Initial == aReflowState.reason) ||
(eReflowReason_Resize == aReflowState.reason)) {
SetNeedPass2Reflow(PR_FALSE);
}
return NS_OK;
}

View File

@ -55,6 +55,7 @@ class nsHTMLValue;
#define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000
#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000
#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000
#define NS_TABLE_CELL_NEED_PASS2_REFLOW 0x08000000
/**
* nsTableCellFrame
@ -259,6 +260,9 @@ public:
PRBool HasPctOverHeight();
void SetHasPctOverHeight(PRBool aValue);
PRBool NeedPass2Reflow() const;
void SetNeedPass2Reflow(PRBool aValue);
nscoord GetLastBlockHeight();
void SetLastBlockHeight(nscoord aValue);
@ -420,6 +424,21 @@ inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue)
}
}
inline PRBool nsTableCellFrame::NeedPass2Reflow() const
{
return (mState & NS_TABLE_CELL_NEED_PASS2_REFLOW) ==
NS_TABLE_CELL_NEED_PASS2_REFLOW;
}
inline void nsTableCellFrame::SetNeedPass2Reflow(PRBool aValue)
{
if (aValue) {
mState |= NS_TABLE_CELL_NEED_PASS2_REFLOW;
} else {
mState &= ~NS_TABLE_CELL_NEED_PASS2_REFLOW;
}
}
inline nscoord nsTableCellFrame::GetLastBlockHeight()
{
return (nscoord)mBits.mLastBlockHeight;

View File

@ -987,6 +987,8 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
(cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) ||
(eReflowReason_StyleChange == aReflowState.reason) ||
isPaginated ||
(cellFrame->NeedPass2Reflow() &&
NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) ||
(aReflowState.mFlags.mSpecialHeightReflow && cellFrame->NeedSpecialReflow()) ||
(!aReflowState.mFlags.mSpecialHeightReflow && cellFrame->HadSpecialReflow()) ||
HasPctHeight() ||

View File

@ -88,3 +88,5 @@ file:///s|/mozilla/layout/html/tests/table/bugs/bug99923.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug99948.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug97138.html
file:///s|/mozilla/layout/html/tests/table/bugs/bug101674.html
# bug 141021 below does not fail as a local file
http://bugzilla.mozilla.org/attachment.cgi?id=81602&action=view

View File

@ -84,6 +84,7 @@ nsTableCellFrame::nsTableCellFrame()
SetNeedSpecialReflow(PR_FALSE);
SetHadSpecialReflow(PR_FALSE);
SetHasPctOverHeight(PR_FALSE);
SetNeedPass2Reflow(PR_TRUE);
#ifdef DEBUG_TABLE_REFLOW_TIMING
mTimer = new nsReflowTimer(this);
@ -1130,6 +1131,14 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) {
SetNeedPass2Reflow(PR_TRUE);
}
else if ((eReflowReason_Initial == aReflowState.reason) ||
(eReflowReason_Resize == aReflowState.reason)) {
SetNeedPass2Reflow(PR_FALSE);
}
return NS_OK;
}

View File

@ -55,6 +55,7 @@ class nsHTMLValue;
#define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000
#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000
#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000
#define NS_TABLE_CELL_NEED_PASS2_REFLOW 0x08000000
/**
* nsTableCellFrame
@ -259,6 +260,9 @@ public:
PRBool HasPctOverHeight();
void SetHasPctOverHeight(PRBool aValue);
PRBool NeedPass2Reflow() const;
void SetNeedPass2Reflow(PRBool aValue);
nscoord GetLastBlockHeight();
void SetLastBlockHeight(nscoord aValue);
@ -420,6 +424,21 @@ inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue)
}
}
inline PRBool nsTableCellFrame::NeedPass2Reflow() const
{
return (mState & NS_TABLE_CELL_NEED_PASS2_REFLOW) ==
NS_TABLE_CELL_NEED_PASS2_REFLOW;
}
inline void nsTableCellFrame::SetNeedPass2Reflow(PRBool aValue)
{
if (aValue) {
mState |= NS_TABLE_CELL_NEED_PASS2_REFLOW;
} else {
mState &= ~NS_TABLE_CELL_NEED_PASS2_REFLOW;
}
}
inline nscoord nsTableCellFrame::GetLastBlockHeight()
{
return (nscoord)mBits.mLastBlockHeight;

View File

@ -987,6 +987,8 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
(cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) ||
(eReflowReason_StyleChange == aReflowState.reason) ||
isPaginated ||
(cellFrame->NeedPass2Reflow() &&
NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) ||
(aReflowState.mFlags.mSpecialHeightReflow && cellFrame->NeedSpecialReflow()) ||
(!aReflowState.mFlags.mSpecialHeightReflow && cellFrame->HadSpecialReflow()) ||
HasPctHeight() ||