From 4bcb36a3686680b3dd4f52d403db48c1143a7a94 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Wed, 28 Jul 1999 07:03:29 +0000 Subject: [PATCH] Fixing bug 6886. window.outerWidth and window.outerHeight for (i)frames now return the dimensions of the browser window. This is the way 4.x handles these properties. --- dom/src/base/nsGlobalWindow.cpp | 65 ++++++++------------------------- 1 file changed, 15 insertions(+), 50 deletions(-) diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 5e227033693..adbea0413e6 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -916,35 +916,18 @@ GlobalWindowImpl::SetInnerHeight(PRInt32 aInnerHeight) NS_IMETHODIMP GlobalWindowImpl::GetOuterWidth(PRInt32* aOuterWidth) { - nsIBrowserWindow *mBrowser; - nsIDOMWindow* parent = nsnull; + nsIBrowserWindow *mBrowser; - GetParent(&parent); - if (parent == this) { - // We are in a top level window. Use browser window's bounds. - if (NS_OK == GetBrowserWindowInterface(mBrowser)) { - nsRect r; - mBrowser->GetWindowBounds(r); - *aOuterWidth = r.width; - NS_RELEASE(mBrowser); - } - else { - *aOuterWidth = 0; - } + if (NS_OK == GetBrowserWindowInterface(mBrowser)) { + nsRect r; + mBrowser->GetWindowBounds(r); + *aOuterWidth = r.width; + NS_RELEASE(mBrowser); } else { - // We are in an (i)frame. Use webshell bounds. - if (mWebShell) { - PRInt32 x,y,w,h; - mWebShell->GetBounds(x, y, w, h); - *aOuterWidth = w; - } - else { - *aOuterWidth = 0; - } + *aOuterWidth = 0; } - - NS_RELEASE(parent); + return NS_OK; } @@ -967,34 +950,16 @@ NS_IMETHODIMP GlobalWindowImpl::GetOuterHeight(PRInt32* aOuterHeight) { nsIBrowserWindow *mBrowser; - nsIDOMWindow* parent = nsnull; - - GetParent(&parent); - if (parent == this) { - // We are in a top level window. Use browser window's bounds. - if (NS_OK == GetBrowserWindowInterface(mBrowser)) { - nsRect r; - mBrowser->GetWindowBounds(r); - *aOuterHeight = r.height; - NS_RELEASE(mBrowser); - } - else { - *aOuterHeight = 0; - } + + if (NS_OK == GetBrowserWindowInterface(mBrowser)) { + nsRect r; + mBrowser->GetWindowBounds(r); + *aOuterHeight = r.height; + NS_RELEASE(mBrowser); } else { - // We are in an (i)frame. Use webshell bounds. - if (mWebShell) { - PRInt32 x,y,w,h; - mWebShell->GetBounds(x, y, w, h); - *aOuterHeight = h; - } - else { - *aOuterHeight = 0; - } + *aOuterHeight = 0; } - - NS_RELEASE(parent); return NS_OK; }