diff --git a/xpfe/appshell/public/nsIAppShellService.idl b/xpfe/appshell/public/nsIAppShellService.idl index adf41fe388f0..9543ee9cd3ae 100644 --- a/xpfe/appshell/public/nsIAppShellService.idl +++ b/xpfe/appshell/public/nsIAppShellService.idl @@ -53,14 +53,14 @@ interface nsIAppShellService : nsISupports void CreateTopLevelWindow(in nsIWebShellWindow aParent, in nsIURI aUrl, - in boolean showWindow, + in boolean showWindow, out nsIWebShellWindow aResult, in nsIStreamObserver anObserver, in nsIXULWindowCallbacks aCallbacks, in long aInitialWidth, in long aInitialHeight); void CreateDialogWindow( in nsIWebShellWindow aParent, in nsIURI aUrl, - in boolean showWindow, + in boolean showWindow, out nsIWebShellWindow aResult, in nsIStreamObserver anObserver, in nsIXULWindowCallbacks aCallbacks, @@ -72,6 +72,7 @@ interface nsIAppShellService : nsISupports in nsIXULWindowCallbacks aCallbacks, in long aInitialWidth, in long aInitialHeight); void CloseTopLevelWindow(in nsIWebShellWindow aWindow); + void GetHiddenWindow(out nsIWebShellWindow aResult); void RegisterTopLevelWindow(in nsIWebShellWindow aWindow); void UnregisterTopLevelWindow(in nsIWebShellWindow aWindow); }; diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index 28f3243da7d4..e51f25c14e34 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -116,6 +116,7 @@ public: nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight); NS_IMETHOD CloseTopLevelWindow(nsIWebShellWindow* aWindow); + NS_IMETHOD GetHiddenWindow(nsIWebShellWindow **aWindow); NS_IMETHOD RegisterTopLevelWindow(nsIWebShellWindow* aWindow); NS_IMETHOD UnregisterTopLevelWindow(nsIWebShellWindow* aWindow); @@ -123,6 +124,14 @@ public: protected: virtual ~nsAppShellService(); + NS_IMETHOD JustCreateTopWindow(nsIWebShellWindow * aParent, + nsIURI* aUrl, + PRBool showWindow, + nsIWebShellWindow** aResult, + nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, + PRInt32 aInitialWidth, PRInt32 aInitialHeight); + void CreateHiddenWindow(); void InitializeComponent( const nsCID &aComponentCID ); void ShutdownComponent( const nsCID &aComponentCID ); typedef void (nsAppShellService::*EnumeratorMemberFunction)(const nsCID&); @@ -132,9 +141,9 @@ protected: nsISupportsArray* mWindowList; nsICmdLineService* mCmdLineService; nsIWindowMediator* mWindowMediator; + nsCOMPtr mHiddenWindow; }; - nsAppShellService::nsAppShellService() : mWindowMediator( NULL ) { NS_INIT_REFCNT(); @@ -149,8 +158,10 @@ nsAppShellService::~nsAppShellService() NS_IF_RELEASE(mAppShell); NS_IF_RELEASE(mWindowList); NS_IF_RELEASE(mCmdLineService); - if ( mWindowMediator ) - nsServiceManager::ReleaseService(kWindowMediatorCID, mWindowMediator); + if (mHiddenWindow) + mHiddenWindow->Close(); // merely releasing the ref isn't enough! + if (mWindowMediator) + nsServiceManager::ReleaseService(kWindowMediatorCID, mWindowMediator); } @@ -259,10 +270,36 @@ nsAppShellService::Initialize( nsICmdLineService *aCmdLineService ) // enable window mediation rv = nsServiceManager::GetService(kWindowMediatorCID, kIWindowMediatorIID, (nsISupports**) &mWindowMediator); + + CreateHiddenWindow(); + done: return rv; } +void nsAppShellService::CreateHiddenWindow() +{ + nsresult rv; + nsIURI* url = nsnull; + +#ifndef NECKO + rv = NS_NewURL(&url, "chrome://navigator/content/hiddenWindow.xul"); +#else + rv = NS_NewURI(&url, "chrome://navigator/content/hiddenWindow.xul"); +#endif + if (NS_SUCCEEDED(rv)) { + nsCOMPtr newWindow; + rv = JustCreateTopWindow(nsnull, url, PR_FALSE, getter_AddRefs(newWindow), + nsnull, nsnull, NS_SIZETOCONTENT, NS_SIZETOCONTENT); + if (NS_SUCCEEDED(rv)) { + mHiddenWindow = newWindow; + // Mac will want to register now, like CreateTopLevelWindow + } + NS_RELEASE(url); + } + NS_ASSERTION(NS_SUCCEEDED(rv), "HiddenWindow not created"); +} + // Apply function (Initialize/Shutdown) to each app shell component. void nsAppShellService::EnumerateComponents( EnumeratorMemberFunction function ) { @@ -484,9 +521,34 @@ nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent, PRInt32 aInitialWidth, PRInt32 aInitialHeight) { nsresult rv; + + rv = JustCreateTopWindow(aParent, aUrl, showWindow, aResult, anObserver, + aCallbacks, aInitialWidth, aInitialHeight); + + if (NS_SUCCEEDED(rv)) + // the addref resulting from this is the owning addref for this window + RegisterTopLevelWindow(*aResult); + + return rv; +} + + +/* + * Just do the window-making part of CreateTopLevelWindow + */ +NS_IMETHODIMP +nsAppShellService::JustCreateTopWindow(nsIWebShellWindow *aParent, + nsIURI* aUrl, PRBool showWindow, + nsIWebShellWindow** aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, + PRInt32 aInitialWidth, PRInt32 aInitialHeight) +{ + nsresult rv; nsWebShellWindow* window; + PRBool intrinsicallySized; *aResult = nsnull; + intrinsicallySized = PR_FALSE; window = new nsWebShellWindow(); if (nsnull == window) { rv = NS_ERROR_OUT_OF_MEMORY; @@ -500,23 +562,23 @@ nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent, aInitialHeight == NS_SIZETOCONTENT) { aInitialWidth = 1; aInitialHeight = 1; - showWindow = PR_FALSE; // Don't show until we have the intrinsic size figured out. + intrinsicallySized = PR_TRUE; window->SetIntrinsicallySized(PR_TRUE); } rv = window->Initialize((nsIWebShellWindow *) nsnull, mAppShell, aUrl, - anObserver, aCallbacks, + showWindow, anObserver, aCallbacks, aInitialWidth, aInitialHeight, widgetInitData); - if (NS_SUCCEEDED(rv)) - { + if (NS_SUCCEEDED(rv)) { + // this does the AddRef of the return value rv = window->QueryInterface(kIWebShellWindowIID, (void **) aResult); - - // the addref resulting from this is the owning addref for this window - RegisterTopLevelWindow(window); - if (showWindow) - window->Show(PR_TRUE); + + // if intrinsically sized, don't show until we have the size figured out + if (showWindow && !intrinsicallySized) + window->Show(PR_TRUE); + } } @@ -530,6 +592,18 @@ nsAppShellService::CloseTopLevelWindow(nsIWebShellWindow* aWindow) return aWindow->Close(); } +NS_IMETHODIMP +nsAppShellService::GetHiddenWindow(nsIWebShellWindow **aWindow) +{ + nsIWebShellWindow *rv; + + NS_ASSERTION(aWindow, "null param to GetHiddenWindow"); + rv = mHiddenWindow; + NS_IF_ADDREF(rv); + *aWindow = rv; + return rv ? NS_OK : NS_ERROR_FAILURE; +} + /* * Like CreateTopLevelWindow, but with dialog window borders. This * method is necessary because of the current misfortune that the window @@ -545,8 +619,10 @@ nsAppShellService::CreateDialogWindow(nsIWebShellWindow * aParent, { nsresult rv; nsWebShellWindow* window; + PRBool intrinsicallySized; *aResult = nsnull; + intrinsicallySized = PR_FALSE; window = new nsWebShellWindow(); if (nsnull == window) { rv = NS_ERROR_OUT_OF_MEMORY; @@ -560,18 +636,20 @@ nsAppShellService::CreateDialogWindow(nsIWebShellWindow * aParent, aInitialHeight == NS_SIZETOCONTENT) { aInitialWidth = 1; aInitialHeight = 1; - showWindow = PR_FALSE; // Don't show until we have the intrinsic size figured out. + intrinsicallySized = PR_TRUE; window->SetIntrinsicallySized(PR_TRUE); } rv = window->Initialize((nsIWebShellWindow *) nsnull, mAppShell, aUrl, - anObserver, aCallbacks, + showWindow, anObserver, aCallbacks, aInitialWidth, aInitialHeight, widgetInitData); if (NS_SUCCEEDED(rv)) { rv = window->QueryInterface(kIWebShellWindowIID, (void **) aResult); RegisterTopLevelWindow(window); - if (showWindow) - window->Show(PR_TRUE); + + // if intrinsically sized, don't show until we have the size figured out + if (showWindow && !intrinsicallySized) + window->Show(PR_TRUE); } } diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 037873ee3bac..855c7bc8a945 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -220,6 +220,7 @@ nsWebShellWindow::nsWebShellWindow() mContentShells = nsnull; mChromeMask = NS_CHROME_ALL_CHROME; mIntrinsicallySized = PR_FALSE; + mCreatedVisible = PR_TRUE; } @@ -310,6 +311,7 @@ nsWebShellWindow::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent, nsIAppShell* aShell, nsIURI* aUrl, + PRBool aCreatedVisible, nsIStreamObserver* anObserver, nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight, @@ -318,9 +320,11 @@ nsresult nsWebShellWindow::Initialize(nsIWebShellWindow* aParent, nsresult rv; nsIWidget *parentWidget; + + mCreatedVisible = aCreatedVisible; // XXX: need to get the default window size from prefs... - // Doesn't come from prefs... will come from CSS/XUL/RDF + // Doesn't come from prefs... will come from CSS/XUL/RDF nsRect r(0, 0, aInitialWidth, aInitialHeight); // Create top level window @@ -1247,9 +1251,9 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont window->SetIntrinsicallySized(PR_TRUE); rv = window->Initialize((nsIWebShellWindow *) nsnull, nsnull, nsnull, - nsnull, nsnull, + PR_TRUE, nsnull, nsnull, 1, 1, widgetInitData); - + if (NS_FAILED(rv)) return rv; @@ -1816,9 +1820,9 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader, ShowAppropriateChrome(); LoadContentAreas(); - // Always show the window at this point. - mWindow->Show(PR_TRUE); - mWebShell->Show(); + // Here's where we service the "show" request initially given in Initialize() + if (mCreatedVisible) + Show(PR_TRUE); return NS_OK; } @@ -2538,7 +2542,7 @@ NS_IMETHODIMP nsWebShellWindow::Init(nsIAppShell* aAppShell, nsWidgetInitData widgetInitData; widgetInitData.mBorderStyle = eBorderStyle_window; - rv = Initialize(nsnull, aAppShell, urlObj, + rv = Initialize(nsnull, aAppShell, urlObj, PR_TRUE, nsnull, nsnull, aBounds.width, aBounds.height, widgetInitData); mChromeMask = aChromeMask; if (NS_SUCCEEDED(rv)) @@ -2631,7 +2635,7 @@ NS_IMETHODIMP nsWebShellWindow::SetTitle(const PRUnichar* aTitle) if (webshellElement ) { webshellElement->GetAttribute("titlemodifier", windowTitleModifier ); - webshellElement->GetAttribute("titleseperator", windowSeparator ); + webshellElement->GetAttribute("titleseparator", windowSeparator ); } nsString title( aTitle ); diff --git a/xpfe/appshell/src/nsWebShellWindow.h b/xpfe/appshell/src/nsWebShellWindow.h index 424d9b25738b..7a3f1c4030cc 100644 --- a/xpfe/appshell/src/nsWebShellWindow.h +++ b/xpfe/appshell/src/nsWebShellWindow.h @@ -121,7 +121,7 @@ public: NS_IMETHOD ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindow** aDOMWindow); // nsWebShellWindow methods... nsresult Initialize(nsIWebShellWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl, - nsIStreamObserver* anObserver, + PRBool aCreatedVisible, nsIStreamObserver* anObserver, nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight, nsWidgetInitData& widgetInitData); @@ -283,6 +283,7 @@ protected: PRBool mLockedUntilChromeLoad; PRBool mChromeInitialized; PRUint32 mChromeMask; + PRBool mCreatedVisible; nsVoidArray mMenuDelegates; diff --git a/xpfe/browser/resources/content/navigator.xul b/xpfe/browser/resources/content/navigator.xul index 8725839bc41a..fe33846b40ac 100644 --- a/xpfe/browser/resources/content/navigator.xul +++ b/xpfe/browser/resources/content/navigator.xul @@ -28,7 +28,7 @@ Contributor(s): ______________________________________. --> [ - + @@ -297,7 +297,7 @@ Contributor(s): ______________________________________. --> onload="Startup()" onunload="Shutdown()" title="&mainWindow.title;" titlemodifier="&mainWindow.titlemodifier;" - titleseperator ="&mainWindow.titlemodifierseperator;" windowtype="navigator:browser" + titleseparator ="&mainWindow.titlemodifierseparator;" windowtype="navigator:browser" align="vertical" width="640" height="480"> @@ -358,6 +358,12 @@ Contributor(s): ______________________________________. --> + + diff --git a/xpfe/global/resources/content/MANIFEST b/xpfe/global/resources/content/MANIFEST index 93457d8b48c0..a55c5fa1c33f 100644 --- a/xpfe/global/resources/content/MANIFEST +++ b/xpfe/global/resources/content/MANIFEST @@ -1,3 +1,4 @@ +hiddenWindow.xul globalOverlay.xul globalOverlay.js tasksOverlay.xul diff --git a/xpfe/global/resources/content/Makefile.in b/xpfe/global/resources/content/Makefile.in index 02f528f44538..bf099a298b78 100644 --- a/xpfe/global/resources/content/Makefile.in +++ b/xpfe/global/resources/content/Makefile.in @@ -25,6 +25,7 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk EXPORT_RESOURCE_CONTENT = \ + $(srcdir)/hiddenWindow.xul \ $(srcdir)/globalOverlay.xul \ $(srcdir)/globalOverlay.js \ $(srcdir)/tasksOverlay.xul \ diff --git a/xpfe/global/resources/content/hiddenWindow.xul b/xpfe/global/resources/content/hiddenWindow.xul new file mode 100644 index 000000000000..af134a2428f0 --- /dev/null +++ b/xpfe/global/resources/content/hiddenWindow.xul @@ -0,0 +1,608 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // Menu for testing. + + + // Build verification sites. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // Viewer tests. + + + + + + + + + + + + + + + + + + + + // XPToolkit tests. + + + + + + + + + + + // QA tests. + + + + + + + + diff --git a/xpfe/global/resources/content/makefile.win b/xpfe/global/resources/content/makefile.win index d39aec19e937..b348b6a6f7a3 100644 --- a/xpfe/global/resources/content/makefile.win +++ b/xpfe/global/resources/content/makefile.win @@ -23,6 +23,7 @@ DISTBROWSER=$(DIST)\bin\chrome\global\content\default install:: + $(MAKE_INSTALL) hiddenWindow.xul $(DISTBROWSER) $(MAKE_INSTALL) globalOverlay.xul $(DISTBROWSER) $(MAKE_INSTALL) globalOverlay.js $(DISTBROWSER) $(MAKE_INSTALL) tasksOverlay.xul $(DISTBROWSER)