Bug 503791. Make sure that the device context has a widget so that it can determine what screen it is on. r=dbaron

This commit is contained in:
Timothy Nikkel 2009-08-17 20:21:07 -07:00
parent c50a2c3b1f
commit 84ffcd3b7a

View File

@ -2401,10 +2401,15 @@ DocumentViewerImpl::CreateDeviceContext(nsIView* aContainerView)
nsIWidget* widget = nsnull;
if (aContainerView) {
widget = aContainerView->GetNearestWidget(nsnull);
if (widget) {
widget = widget->GetTopLevelWidget();
}
}
// The device context needs a widget to be able to determine the screen it is on.
if (!widget) {
widget = mParentWidget;
}
if (widget) {
widget = widget->GetTopLevelWidget();
}
mDeviceContext->Init(widget);
return NS_OK;
}