mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-07 13:24:12 +00:00
Protect against sizeToContent being called on windows with no content a bit.
Bug 293781, r+sr=roc, a=asa
This commit is contained in:
parent
620102c0b8
commit
689b3ce693
@ -2901,6 +2901,11 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
|
||||
|
||||
// so how big is it?
|
||||
nsRect shellArea = presContext->GetVisibleArea();
|
||||
if (shellArea.width == NS_UNCONSTRAINEDSIZE ||
|
||||
shellArea.height == NS_UNCONSTRAINEDSIZE) {
|
||||
// Protect against bogus returns here
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
pixelScale = presContext->TwipsToPixels();
|
||||
width = PRInt32((float)shellArea.width*pixelScale);
|
||||
height = PRInt32((float)shellArea.height*pixelScale);
|
||||
|
@ -2958,14 +2958,21 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
|
||||
if (mCaret)
|
||||
mCaret->EraseCaret();
|
||||
|
||||
// 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,
|
||||
// ignore them altogether.
|
||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||
|
||||
if (!rootFrame &&
|
||||
(aWidth == NS_UNCONSTRAINEDSIZE || aHeight == NS_UNCONSTRAINEDSIZE)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (mPresContext) {
|
||||
nsRect r(0, 0, aWidth, aHeight);
|
||||
mPresContext->SetVisibleArea(r);
|
||||
}
|
||||
|
||||
// If we don't have a root frame yet, that means we haven't had our initial
|
||||
// reflow...
|
||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
// Kick off a top-down reflow
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
|
Loading…
Reference in New Issue
Block a user