зеркало из https://github.com/mozilla/gecko-dev.git
Don't let the pres context's visible area get permanently set to an unconstrained height when we call ResizeReflow with an unconstrained height during SizeToContent. b=371508 r+sr=roc a=blocking1.9+
This commit is contained in:
Родитель
f51b08f359
Коммит
f7a428516e
|
@ -3084,11 +3084,10 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
|
||||||
|
|
||||||
// so how big is it?
|
// so how big is it?
|
||||||
nsRect shellArea = presContext->GetVisibleArea();
|
nsRect shellArea = presContext->GetVisibleArea();
|
||||||
if (shellArea.width == NS_UNCONSTRAINEDSIZE ||
|
// Protect against bogus returns here
|
||||||
shellArea.height == NS_UNCONSTRAINEDSIZE) {
|
NS_ENSURE_TRUE(shellArea.width != NS_UNCONSTRAINEDSIZE &&
|
||||||
// Protect against bogus returns here
|
shellArea.height != NS_UNCONSTRAINEDSIZE,
|
||||||
return NS_ERROR_FAILURE;
|
NS_ERROR_FAILURE);
|
||||||
}
|
|
||||||
width = presContext->AppUnitsToDevPixels(shellArea.width);
|
width = presContext->AppUnitsToDevPixels(shellArea.width);
|
||||||
height = presContext->AppUnitsToDevPixels(shellArea.height);
|
height = presContext->AppUnitsToDevPixels(shellArea.height);
|
||||||
|
|
||||||
|
|
|
@ -2489,14 +2489,17 @@ NS_IMETHODIMP
|
||||||
PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
|
PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(!mIsReflowing, "Shouldn't be in reflow here!");
|
NS_PRECONDITION(!mIsReflowing, "Shouldn't be in reflow here!");
|
||||||
|
NS_PRECONDITION(aWidth != NS_UNCONSTRAINEDSIZE,
|
||||||
|
"shouldn't use unconstrained widths anymore");
|
||||||
|
|
||||||
// If we don't have a root frame yet, that means we haven't had our initial
|
// If we don't have a root frame yet, that means we haven't had our initial
|
||||||
// reflow... If that's the case, and aWidth or aHeight is unconstrained,
|
// reflow... If that's the case, and aWidth or aHeight is unconstrained,
|
||||||
// ignore them altogether.
|
// ignore them altogether.
|
||||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||||
|
|
||||||
if (!rootFrame &&
|
if (!rootFrame && aHeight == NS_UNCONSTRAINEDSIZE) {
|
||||||
(aWidth == NS_UNCONSTRAINEDSIZE || aHeight == NS_UNCONSTRAINEDSIZE)) {
|
// We can't do the work needed for SizeToContent without a root
|
||||||
|
// frame, and we want to return before setting the visible area.
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2542,6 +2545,11 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
|
||||||
batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
|
batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aHeight == NS_UNCONSTRAINEDSIZE) {
|
||||||
|
mPresContext->SetVisibleArea(
|
||||||
|
nsRect(0, 0, aWidth, rootFrame->GetRect().height));
|
||||||
|
}
|
||||||
|
|
||||||
if (!mIsDestroying) {
|
if (!mIsDestroying) {
|
||||||
CreateResizeEventTimer();
|
CreateResizeEventTimer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||||
// Reflow the main content first so that the placeholders of the
|
// Reflow the main content first so that the placeholders of the
|
||||||
// fixed-position frames will be in the right places on an initial
|
// fixed-position frames will be in the right places on an initial
|
||||||
// reflow.
|
// reflow.
|
||||||
nsRect kidRect(0,0,aReflowState.availableWidth,aReflowState.availableHeight);
|
nscoord kidHeight = 0;
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
@ -284,10 +284,11 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||||
kidReflowState.SetComputedHeight(aReflowState.availableHeight);
|
kidReflowState.SetComputedHeight(aReflowState.availableHeight);
|
||||||
rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
||||||
0, 0, 0, aStatus);
|
0, 0, 0, aStatus);
|
||||||
kidRect.width = kidDesiredSize.width;
|
kidHeight = kidDesiredSize.height;
|
||||||
kidRect.height = kidDesiredSize.height;
|
|
||||||
|
|
||||||
FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
|
FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
kidHeight = mFrames.FirstChild()->GetSize().height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +301,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||||
// return our child's intrinsic size.
|
// return our child's intrinsic size.
|
||||||
aDesiredSize.height = aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE
|
aDesiredSize.height = aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE
|
||||||
? aReflowState.availableHeight
|
? aReflowState.availableHeight
|
||||||
: kidRect.height;
|
: kidHeight;
|
||||||
|
|
||||||
// Make a copy of the reflow state and change the computed width and height
|
// Make a copy of the reflow state and change the computed width and height
|
||||||
// to reflect the available space for the fixed items
|
// to reflect the available space for the fixed items
|
||||||
|
|
Загрузка…
Ссылка в новой задаче