From 01a2e349a8e61dc1fc9d13f42519191a76c50cde Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Sat, 8 Apr 2006 03:23:37 +0000 Subject: [PATCH] First part of fix for bug 309721, r+sr=jst git-svn-id: svn://10.0.0.236/trunk@193914 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/public/base/nsPIDOMWindow.h | 5 +++-- mozilla/dom/src/base/nsGlobalWindow.h | 2 +- mozilla/dom/src/base/nsScreen.cpp | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mozilla/dom/public/base/nsPIDOMWindow.h b/mozilla/dom/public/base/nsPIDOMWindow.h index 2729c7b6b6f..7e0d7888296 100644 --- a/mozilla/dom/public/base/nsPIDOMWindow.h +++ b/mozilla/dom/public/base/nsPIDOMWindow.h @@ -71,8 +71,8 @@ class nsPresContext; struct nsTimeout; #define NS_PIDOMWINDOW_IID \ -{ 0xca692511, 0x8558, 0x4307, \ - { 0x84, 0xdb, 0x77, 0x28, 0xec, 0xed, 0xb1, 0xd2 } } +{ 0xad6640fb, 0x575e, 0x4bfe, \ + { 0x92, 0x92, 0xe6, 0x36, 0xfb, 0xee, 0xff, 0x3d } } class nsPIDOMWindow : public nsIDOMWindowInternal { @@ -384,6 +384,7 @@ public: virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener, PRBool aOriginalOpener) = 0; + virtual void EnsureSizeUpToDate() = 0; protected: // The nsPIDOMWindow constructor. The aOuterWindow argument should diff --git a/mozilla/dom/src/base/nsGlobalWindow.h b/mozilla/dom/src/base/nsGlobalWindow.h index 05bf5cbb5f0..9667902f378 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.h +++ b/mozilla/dom/src/base/nsGlobalWindow.h @@ -240,6 +240,7 @@ public: PRBool aClearScopeHint); virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindowInternal *aOpener, PRBool aOriginalOpener); + virtual NS_HIDDEN_(void) EnsureSizeUpToDate(); // nsIDOMViewCSS NS_DECL_NSIDOMVIEWCSS @@ -402,7 +403,6 @@ protected: const nsAString &aPopupWindowFeatures); void FlushPendingNotifications(mozFlushType aType); - void EnsureSizeUpToDate(); void EnsureReflowFlushAndPaint(); nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height); nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top); diff --git a/mozilla/dom/src/base/nsScreen.cpp b/mozilla/dom/src/base/nsScreen.cpp index 9f64555283b..9bee23bb47f 100644 --- a/mozilla/dom/src/base/nsScreen.cpp +++ b/mozilla/dom/src/base/nsScreen.cpp @@ -38,7 +38,7 @@ #include "nscore.h" #include "nsScreen.h" -#include "nsIDOMWindow.h" +#include "nsPIDOMWindow.h" #include "nsIScriptGlobalObject.h" #include "nsIDocShell.h" #include "nsIDeviceContext.h" @@ -46,7 +46,7 @@ #include "nsCOMPtr.h" #include "nsIDocumentViewer.h" #include "nsDOMClassInfo.h" - +#include "nsIInterfaceRequestorUtils.h" // // Screen class implementation @@ -201,6 +201,18 @@ nsScreen::GetDeviceContext() if(!mDocShell) return nsnull; + // Now make sure our size is up to date. That will mean that the device + // context does the right thing on multi-monitor systems when we return it to + // the caller. It will also make sure that our prescontext has been created, + // if we're supposed to have one. + nsCOMPtr win = do_GetInterface(mDocShell); + if (!win) { + // No reason to go on + return nsnull; + } + + win->EnsureSizeUpToDate(); + nsCOMPtr contentViewer; mDocShell->GetContentViewer(getter_AddRefs(contentViewer));