From 77e6145552cce870723a684d8e565cc633f8209d Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Tue, 20 Apr 1999 01:50:03 +0000 Subject: [PATCH] Added a method to webshell so that a root container can find out when new webshells are added to its hierarchy. git-svn-id: svn://10.0.0.236/trunk@28203 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 12 ++++++++++++ mozilla/webshell/public/nsIWebShell.h | 4 +++- mozilla/webshell/src/nsWebShell.cpp | 12 ++++++++++++ mozilla/webshell/tests/viewer/nsBrowserWindow.cpp | 8 ++++++++ mozilla/webshell/tests/viewer/nsBrowserWindow.h | 1 + mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp | 7 +++++++ mozilla/webshell/tests/viewer/nsXPBaseWindow.h | 1 + 7 files changed, 44 insertions(+), 1 deletion(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 82743ac53e4..1bb88bd6edb 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -241,6 +241,8 @@ public: PRBool aVisible, nsIWebShell *&aNewWebShell); NS_IMETHOD CanCreateNewWebShell(PRBool& aResult); + NS_IMETHOD ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult); + NS_IMETHOD SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, nsIWebShell** aNewShell); @@ -1903,6 +1905,16 @@ nsWebShell::CanCreateNewWebShell(PRBool& aResult) return NS_OK; } +NS_IMETHODIMP +nsWebShell::ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult) +{ + aResult = PR_FALSE; + if (nsnull != mContainer) { + return mContainer->ChildShellAdded(aChildShell, frameNode, aResult); + } + return NS_OK; +} + NS_IMETHODIMP nsWebShell::SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h index 730897f25a8..8372d4552f6 100644 --- a/mozilla/webshell/public/nsIWebShell.h +++ b/mozilla/webshell/public/nsIWebShell.h @@ -34,6 +34,7 @@ class nsIDocumentLoaderObserver; class nsIWebShell; class nsIWebShellContainer; class nsIPref; +class nsIContent; // Interface ID for nsIWebShell #define NS_IWEB_SHELL_IID \ @@ -102,8 +103,9 @@ public: NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult) = 0; - + NS_IMETHOD ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult) = 0; + /** * Notify the WebShellContainer that a contained webshell is * offering focus (for example if it finshed tabbing through its diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 82743ac53e4..1bb88bd6edb 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -241,6 +241,8 @@ public: PRBool aVisible, nsIWebShell *&aNewWebShell); NS_IMETHOD CanCreateNewWebShell(PRBool& aResult); + NS_IMETHOD ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult); + NS_IMETHOD SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, nsIWebShell** aNewShell); @@ -1903,6 +1905,16 @@ nsWebShell::CanCreateNewWebShell(PRBool& aResult) return NS_OK; } +NS_IMETHODIMP +nsWebShell::ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult) +{ + aResult = PR_FALSE; + if (nsnull != mContainer) { + return mContainer->ChildShellAdded(aChildShell, frameNode, aResult); + } + return NS_OK; +} + NS_IMETHODIMP nsWebShell::SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index d4798bdb174..4c470186d0f 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -1750,6 +1750,14 @@ nsBrowserWindow::CanCreateNewWebShell(PRBool& aResult) return NS_OK; } +NS_IMETHODIMP +nsBrowserWindow::ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult) +{ + aResult = PR_FALSE; // We don't ever care about handling this. + return NS_OK; +} + + NS_IMETHODIMP nsBrowserWindow::SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.h b/mozilla/webshell/tests/viewer/nsBrowserWindow.h index 1a579642b6f..64fc68c04b9 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.h +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.h @@ -107,6 +107,7 @@ public: PRBool aVisible, nsIWebShell *&aNewWebShell); NS_IMETHOD CanCreateNewWebShell(PRBool& aResult); + NS_IMETHOD ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult); NS_IMETHOD SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, nsIWebShell** aNewShell); diff --git a/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp b/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp index 683928cb30e..50ac4116865 100644 --- a/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp @@ -568,6 +568,13 @@ nsXPBaseWindow::CanCreateNewWebShell(PRBool& aResult) return NS_OK; } +NS_IMETHODIMP +nsXPBaseWindow::ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult) +{ + aResult = PR_FALSE; + return NS_OK; +} + NS_IMETHODIMP nsXPBaseWindow::SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, diff --git a/mozilla/webshell/tests/viewer/nsXPBaseWindow.h b/mozilla/webshell/tests/viewer/nsXPBaseWindow.h index 3e11ccd4244..a0b716f1d93 100644 --- a/mozilla/webshell/tests/viewer/nsXPBaseWindow.h +++ b/mozilla/webshell/tests/viewer/nsXPBaseWindow.h @@ -98,6 +98,7 @@ public: PRBool aVisible, nsIWebShell *&aNewWebShell); NS_IMETHOD CanCreateNewWebShell(PRBool& aResult); + NS_IMETHOD ChildShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode, PRBool& aResult); NS_IMETHOD SetNewWebShellInfo(const nsString& aName, const nsString& anURL, nsIWebShell* aOpenerShell, PRUint32 aChromeMask, nsIWebShell** aNewShell);