From 085f789265886906a2d91993a32736ba48ac2c5f 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. --- docshell/base/nsWebShell.cpp | 12 ++++++++++++ webshell/public/nsIWebShell.h | 4 +++- webshell/src/nsWebShell.cpp | 12 ++++++++++++ webshell/tests/viewer/nsBrowserWindow.cpp | 8 ++++++++ webshell/tests/viewer/nsBrowserWindow.h | 1 + webshell/tests/viewer/nsXPBaseWindow.cpp | 7 +++++++ webshell/tests/viewer/nsXPBaseWindow.h | 1 + 7 files changed, 44 insertions(+), 1 deletion(-) diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 82743ac53e41..1bb88bd6edbb 100644 --- a/docshell/base/nsWebShell.cpp +++ b/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/webshell/public/nsIWebShell.h b/webshell/public/nsIWebShell.h index 730897f25a8a..8372d4552f6f 100644 --- a/webshell/public/nsIWebShell.h +++ b/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/webshell/src/nsWebShell.cpp b/webshell/src/nsWebShell.cpp index 82743ac53e41..1bb88bd6edbb 100644 --- a/webshell/src/nsWebShell.cpp +++ b/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/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index d4798bdb1746..4c470186d0f4 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/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/webshell/tests/viewer/nsBrowserWindow.h b/webshell/tests/viewer/nsBrowserWindow.h index 1a579642b6f9..64fc68c04b9d 100644 --- a/webshell/tests/viewer/nsBrowserWindow.h +++ b/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/webshell/tests/viewer/nsXPBaseWindow.cpp b/webshell/tests/viewer/nsXPBaseWindow.cpp index 683928cb30e4..50ac4116865d 100644 --- a/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/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/webshell/tests/viewer/nsXPBaseWindow.h b/webshell/tests/viewer/nsXPBaseWindow.h index 3e11ccd42445..a0b716f1d93e 100644 --- a/webshell/tests/viewer/nsXPBaseWindow.h +++ b/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);