From 700d338d84c46680c601d2d34bfdf4054728aace Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Wed, 12 May 1999 23:17:40 +0000 Subject: [PATCH] Teaching window.open how to open chrome. git-svn-id: svn://10.0.0.236/trunk@31312 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/src/base/nsGlobalWindow.cpp | 2 ++ mozilla/webshell/public/nsIBrowserWindow.h | 1 + .../xpfe/appshell/src/nsWebShellWindow.cpp | 22 ++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 5564b141645..c985c1276b5 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -1459,6 +1459,8 @@ GlobalWindowImpl::Open(JSContext *cx, mChrome |= WinHasOption(options, "resizable") ? NS_CHROME_WINDOW_RESIZE_ON : 0; mChrome |= NS_CHROME_WINDOW_CLOSE_ON; + mChrome |= WinHasOption(options, "chrome") ? NS_CHROME_OPEN_AS_CHROME : 0; + mWidth = WinHasOption(options, "innerWidth") | WinHasOption(options, "width"); mHeight = WinHasOption(options, "innerHeight") | WinHasOption(options, "height"); diff --git a/mozilla/webshell/public/nsIBrowserWindow.h b/mozilla/webshell/public/nsIBrowserWindow.h index ddad85244cf..e6da9df00bb 100644 --- a/mozilla/webshell/public/nsIBrowserWindow.h +++ b/mozilla/webshell/public/nsIBrowserWindow.h @@ -46,6 +46,7 @@ struct nsRect; #define NS_CHROME_PERSONAL_TOOLBAR_ON 0x080 #define NS_CHROME_SCROLLBARS_ON 0x100 #define NS_CHROME_TITLEBAR_ON 0x200 +#define NS_CHROME_OPEN_AS_CHROME 0x400 /** * API to a "browser window". A browser window contains a toolbar, a web shell diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 79ecef7f064..7f71ee024dd 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -899,6 +899,22 @@ NS_IMETHODIMP nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible, nsIWebShell *&aNewWebShell) { + nsresult rv; + NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv); + if (NS_FAILED(rv)) + return rv; + + nsCOMPtr newWindow; + + if ((aChromeMask & NS_CHROME_OPEN_AS_CHROME) != 0) { + // Just do a nice normal create of a web shell and + // return it immediately. + appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, *getter_AddRefs(newWindow), + nsnull, nsnull, 615, 480); + newWindow->GetWebShell(aNewWebShell); // GetWebShell does the addref. + return NS_OK; + } + #ifdef XP_PC // XXX: Won't work on any other platforms yet. Sigh. // We need to create a new top level window and then enter a nested // loop. Eventually the new window will be told that it has loaded, @@ -907,7 +923,6 @@ nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible, // First push a nested event queue for event processing from netlib // onto our UI thread queue stack. - nsresult rv; NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); if (NS_FAILED(rv)) { NS_ERROR("Unable to obtain queue service."); @@ -920,11 +935,6 @@ nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible, if (NS_FAILED(rv)) return rv; - NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr newWindow; appShell->CreateTopLevelWindow(nsnull, urlObj, PR_FALSE, *getter_AddRefs(newWindow), nsnull, nsnull, 615, 480);