First part of fix for bug 309721, r+sr=jst

This commit is contained in:
bzbarsky%mit.edu 2006-04-08 03:23:37 +00:00
Родитель 210662b86f
Коммит 412c1c2920
3 изменённых файлов: 18 добавлений и 5 удалений

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

@ -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

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

@ -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);

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

@ -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<nsPIDOMWindow> win = do_GetInterface(mDocShell);
if (!win) {
// No reason to go on
return nsnull;
}
win->EnsureSizeUpToDate();
nsCOMPtr<nsIContentViewer> contentViewer;
mDocShell->GetContentViewer(getter_AddRefs(contentViewer));