Avoid exponential growth of special height reflows. (Bug 438509) r=dholbert sr=roc a=blocking1.9.1+

This commit is contained in:
L. David Baron 2008-11-25 13:27:53 -08:00
Родитель 26fbbb6f7a
Коммит 991d20f152
2 изменённых файлов: 15 добавлений и 3 удалений

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

@ -405,10 +405,13 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext)
// If we're the descendant of a table cell that performs special height
// reflows and we could be the child that requires them, always set
// the vertical resize in case this is the first pass before the
// special height reflow.
// special height reflow. However, don't do this if it actually is
// the special height reflow, since in that case it will already be
// set correctly above if we need it set.
if (!mFlags.mVResize && mCBReflowState &&
(IS_TABLE_CELL(mCBReflowState->frame->GetType()) ||
mCBReflowState->mFlags.mHeightDependsOnAncestorCell) &&
!mCBReflowState->mFlags.mSpecialHeightReflow &&
dependsOnCBHeight) {
mFlags.mVResize = PR_TRUE;
mFlags.mHeightDependsOnAncestorCell = PR_TRUE;

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

@ -1880,7 +1880,16 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
PRBool haveDesiredHeight = PR_FALSE;
SetHaveReflowedColGroups(PR_FALSE);
if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE ||
// If we have a constrained computed height that is either
// different, or something inside us is different, or we're being
// reflowed at a different size, we could need to undo the effects
// of a previous special height reflow in order to distribute
// heights correctly again.
if ((aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE &&
(aReflowState.ComputedHeight() +
aReflowState.mComputedBorderPadding.TopBottom() != GetSize().height ||
NS_SUBTREE_DIRTY(this) ||
aReflowState.mFlags.mHResize)) ||
// Also check mVResize, to handle the first Reflow preceding a
// special height Reflow, when we've already had a special height
// Reflow (where mComputedHeight would not be
@ -1905,7 +1914,7 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
if (NS_SUBTREE_DIRTY(this) ||
aReflowState.ShouldReflowAllKids() ||
IsGeometryDirty() ||
needToInitiateSpecialReflow) {
(needToInitiateSpecialReflow && aReflowState.mFlags.mVResize)) {
// see if an extra reflow will be necessary in pagination mode when there is a specified table height
if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight)) {
nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState);