Bug 422294 - Crash [@ nsHTMLContainerFrame::CreateViewForFrame] on print preview, r+sr=roc

This commit is contained in:
Olli Pettay 2009-01-15 16:24:40 +02:00
Родитель 1b4b1e1181
Коммит 2f8964c6c5
1 изменённых файлов: 21 добавлений и 21 удалений

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

@ -1864,6 +1864,27 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
documentIsTopLevel = PR_TRUE;
}
// Here we decide whether we need scrollbars and
// what the parent will be of the widget
// How this logic presently works: Print Preview is always as-is (as far
// as I can tell; not sure how it would work in other cases); only the root
// is not eIFrame or eFrame. The child documents get a parent widget from
// logic in nsFrameFrame. In any case, a child widget is created for the root
// view of the document.
PRBool canCreateScrollbars = PR_FALSE;
nsIView* parentView;
// the top nsPrintObject's widget will always have scrollbars
if (frame) {
nsIView* view = frame->GetView();
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
view = view->GetFirstChild();
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
parentView = view;
} else {
canCreateScrollbars = PR_TRUE;
parentView = nsnull;
}
// create the PresContext
aPO->mPresContext = new nsPresContext(aPO->mDocument,
mIsCreatingPrintPreview ?
@ -1907,27 +1928,6 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
PR_PL(("In DV::ReflowPrintObject PO: %p (%9s) Setting w,h to %d,%d\n", aPO,
gFrameTypesStr[aPO->mFrameType], adjSize.width, adjSize.height));
// Here we decide whether we need scrollbars and
// what the parent will be of the widget
// How this logic presently works: Print Preview is always as-is (as far
// as I can tell; not sure how it would work in other cases); only the root
// is not eIFrame or eFrame. The child documents get a parent widget from
// logic in nsFrameFrame. In any case, a child widget is created for the root
// view of the document.
PRBool canCreateScrollbars = PR_FALSE;
nsIView* parentView;
// the top nsPrintObject's widget will always have scrollbars
if (frame) {
nsIView* view = frame->GetView();
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
view = view->GetFirstChild();
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
parentView = view;
} else {
canCreateScrollbars = PR_TRUE;
parentView = nsnull;
}
// Create a child window of the parent that is our "root view/window"
nsRect tbounds = nsRect(nsPoint(0, 0), adjSize);
nsIView* rootView = aPO->mViewManager->CreateView(tbounds, parentView);