Stop reflowing the viewport with constrained height. (Bug 467881) r+sr=roc a1.9.0.8=dveditz
git-svn-id: svn://10.0.0.236/trunk@256292 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -6200,12 +6200,7 @@ PresShell::DoReflow(nsIFrame* target)
|
||||
|
||||
// Don't pass size directly to the reflow state, since a
|
||||
// constrained height implies page/column breaking.
|
||||
// Exception: the root frame always uses a constrained reflow
|
||||
nsSize reflowSize;
|
||||
if (target != rootFrame)
|
||||
reflowSize = nsSize(size.width, NS_UNCONSTRAINEDSIZE);
|
||||
else
|
||||
reflowSize = size;
|
||||
nsSize reflowSize(size.width, NS_UNCONSTRAINEDSIZE);
|
||||
nsHTMLReflowState reflowState(mPresContext, target, rcx, reflowSize);
|
||||
|
||||
// fix the computed height
|
||||
|
||||
@@ -261,14 +261,10 @@ void
|
||||
nsHTMLReflowState::SetComputedHeight(nscoord aComputedHeight)
|
||||
{
|
||||
NS_ASSERTION(frame, "Must have a frame!");
|
||||
// It'd be nice to assert that |frame| is not in reflow, but this fails for
|
||||
// two reasons:
|
||||
// It'd be nice to assert that |frame| is not in reflow, but this fails
|
||||
// because:
|
||||
//
|
||||
// 1) Viewport frames reset the computed height on a copy of their reflow
|
||||
// state when reflowing fixed-pos kids. In that case we actually don't
|
||||
// want to mess with the resize flags, because comparing the frame's rect
|
||||
// to the munged computed width is pointless.
|
||||
// 2) nsFrame::BoxReflow creates a reflow state for its parent. This reflow
|
||||
// nsFrame::BoxReflow creates a reflow state for its parent. This reflow
|
||||
// state is not used to reflow the parent, but just as a parent for the
|
||||
// frame's own reflow state. So given a nsBoxFrame inside some non-XUL
|
||||
// (like a text control, for example), we'll end up creating a reflow
|
||||
@@ -277,9 +273,7 @@ nsHTMLReflowState::SetComputedHeight(nscoord aComputedHeight)
|
||||
NS_PRECONDITION(aComputedHeight >= 0, "Invalid computed height");
|
||||
if (mComputedHeight != aComputedHeight) {
|
||||
mComputedHeight = aComputedHeight;
|
||||
if (frame->GetType() != nsGkAtoms::viewportFrame) { // Or check GetParent()?
|
||||
InitResizeFlags(frame->PresContext());
|
||||
}
|
||||
InitResizeFlags(frame->PresContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -468,6 +468,14 @@ public:
|
||||
// This method doesn't apply min/max computed heights to the value passed in.
|
||||
void SetComputedHeight(nscoord aComputedHeight);
|
||||
|
||||
void SetComputedHeightWithoutResettingResizeFlags(nscoord aComputedHeight) {
|
||||
// Viewport frames reset the computed height on a copy of their reflow
|
||||
// state when reflowing fixed-pos kids. In that case we actually don't
|
||||
// want to mess with the resize flags, because comparing the frame's rect
|
||||
// to the munged computed width is pointless.
|
||||
mComputedHeight = aComputedHeight;
|
||||
}
|
||||
|
||||
void SetTruncated(const nsHTMLReflowMetrics& aMetrics, nsReflowStatus* aStatus) const;
|
||||
|
||||
PRBool WillReflowAgainForClearance() const {
|
||||
|
||||
@@ -234,9 +234,8 @@ nsPoint
|
||||
aReflowState->SetComputedWidth(aReflowState->ComputedWidth() -
|
||||
scrollbars.LeftRight());
|
||||
aReflowState->availableWidth -= scrollbars.LeftRight();
|
||||
aReflowState->SetComputedHeight(aReflowState->ComputedHeight() -
|
||||
scrollbars.TopBottom());
|
||||
// XXX why don't we also adjust "aReflowState->availableHeight"?
|
||||
aReflowState->SetComputedHeightWithoutResettingResizeFlags(
|
||||
aReflowState->ComputedHeight() - scrollbars.TopBottom());
|
||||
return nsPoint(scrollbars.left, scrollbars.top);
|
||||
}
|
||||
return nsPoint(0, 0);
|
||||
@@ -281,7 +280,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
kidFrame, availableSpace);
|
||||
|
||||
// Reflow the frame
|
||||
kidReflowState.SetComputedHeight(aReflowState.availableHeight);
|
||||
kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
|
||||
rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
||||
0, 0, 0, aStatus);
|
||||
kidHeight = kidDesiredSize.height;
|
||||
@@ -299,8 +298,8 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
aDesiredSize.width = aReflowState.availableWidth;
|
||||
// Being flowed initially at an unconstrained height means we should
|
||||
// return our child's intrinsic size.
|
||||
aDesiredSize.height = aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE
|
||||
? aReflowState.availableHeight
|
||||
aDesiredSize.height = aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE
|
||||
? aReflowState.ComputedHeight()
|
||||
: kidHeight;
|
||||
|
||||
// Make a copy of the reflow state and change the computed width and height
|
||||
|
||||
Reference in New Issue
Block a user