Bug 445765. In getting the device context from a docshell don't go through nsIBaseWindow::GetMainWidget because that always returns the device context for the primary screen when called on toplevel docshell. r=dbaron

This commit is contained in:
Timothy Nikkel 2009-09-01 12:40:49 -04:00
parent daa82e9da9
commit 7cddfd7416

View File

@ -88,6 +88,7 @@
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "nsIImageLoadingContent.h"
#include "nsCOMPtr.h"
#ifdef MOZ_SVG
#include "nsSVGUtils.h"
@ -3151,13 +3152,13 @@ nsLayoutUtils::GetDeviceContextForScreenInfo(nsIDocShell* aDocShell)
win->EnsureSizeUpToDate();
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(docShell);
NS_ENSURE_TRUE(baseWindow, nsnull);
nsCOMPtr<nsIWidget> mainWidget;
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
if (mainWidget) {
return mainWidget->GetDeviceContext();
nsRefPtr<nsPresContext> presContext;
docShell->GetPresContext(getter_AddRefs(presContext));
if (presContext) {
nsIDeviceContext* context = presContext->DeviceContext();
if (context) {
return context;
}
}
nsCOMPtr<nsIDocShellTreeItem> curItem = do_QueryInterface(docShell);