From e272c87dda297b857d6a111cc8dff50e5544bd8e Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Mon, 3 Jan 2005 22:51:17 +0000 Subject: [PATCH] Remove the long-deprecated nsIWebShell interface. Bug 273319, r=biesi, sr=jst. git-svn-id: svn://10.0.0.236/trunk@167223 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsFrameLoader.cpp | 12 +- mozilla/docshell/base/nsWebShell.cpp | 33 +--- mozilla/docshell/base/nsWebShell.h | 21 +-- mozilla/dom/src/base/nsGlobalWindow.cpp | 1 - mozilla/dom/src/base/nsHistory.cpp | 1 - mozilla/dom/src/base/nsLocation.cpp | 1 - .../browser/photon/src/EmbedPrivate.cpp | 1 - .../browser/webBrowser/nsWebBrowser.cpp | 4 +- .../extensions/wallet/src/nsWalletService.cpp | 1 - .../xmlterm/base/mozXMLTermStream.cpp | 1 + .../xmlterm/base/mozXMLTermStream.h | 1 - .../public/nsICharsetDetectionAdaptor.h | 6 +- mozilla/layout/base/nsCSSFrameConstructor.cpp | 1 - mozilla/layout/base/nsDocumentViewer.cpp | 1 - mozilla/layout/base/nsIDocumentViewerPrint.h | 1 - mozilla/layout/generic/nsFrameSetFrame.h | 1 - mozilla/layout/generic/nsHTMLParts.h | 1 - mozilla/layout/generic/nsObjectFrame.cpp | 1 - .../mathml/base/src/nsMathMLmactionFrame.cpp | 1 - mozilla/layout/printing/nsPrintEngine.cpp | 137 ++++++++------- mozilla/layout/printing/nsPrintEngine.h | 6 +- mozilla/layout/printing/nsPrintObject.cpp | 6 +- mozilla/layout/printing/nsPrintObject.h | 4 +- .../base/public/nsIMsgMessageService.idl | 10 +- mozilla/mailnews/base/src/nsMessenger.cpp | 7 +- .../mailnews/base/src/nsMsgPrintEngine.cpp | 27 +-- mozilla/mailnews/base/src/nsMsgWindow.cpp | 2 - .../base/util/nsMsgIncomingServer.cpp | 5 +- .../mailnews/base/util/nsMsgMailNewsUrl.cpp | 1 - .../compose/src/nsMsgComposeService.cpp | 26 +-- mozilla/mailnews/compose/src/nsMsgSend.cpp | 1 - mozilla/mailnews/news/src/nsNewsFolder.cpp | 10 +- .../htmlparser/robot/test/RobotMain.cpp | 7 +- .../startup/src/nsCommandLineServiceMac.cpp | 1 - mozilla/webshell/public/Makefile.in | 1 - mozilla/webshell/public/nsIWebShell.h | 116 ------------- .../webshell/tests/viewer/nsBrowserWindow.cpp | 153 +---------------- .../webshell/tests/viewer/nsBrowserWindow.h | 19 +-- .../webshell/tests/viewer/nsWebCrawler.cpp | 86 ++++------ mozilla/webshell/tests/viewer/nsWebCrawler.h | 2 +- .../webshell/tests/viewer/nsXPBaseWindow.cpp | 159 ++---------------- .../webshell/tests/viewer/nsXPBaseWindow.h | 18 +- .../tests/viewer/public/nsIXPBaseWindow.h | 4 +- mozilla/widget/public/nsIMenu.h | 4 +- mozilla/widget/public/nsIMenuBar.h | 1 - mozilla/widget/public/nsIMenuItem.h | 4 +- mozilla/widget/public/nsIMenuListener.h | 2 +- mozilla/widget/src/cocoa/nsMenuBarX.cpp | 46 +++-- mozilla/widget/src/cocoa/nsMenuBarX.h | 12 +- mozilla/widget/src/cocoa/nsMenuItemX.cpp | 12 +- mozilla/widget/src/cocoa/nsMenuItemX.h | 6 +- mozilla/widget/src/cocoa/nsMenuX.cpp | 62 +++---- mozilla/widget/src/cocoa/nsMenuX.h | 8 +- mozilla/widget/src/mac/nsMenu.cpp | 68 ++++---- mozilla/widget/src/mac/nsMenu.h | 8 +- mozilla/widget/src/mac/nsMenuBar.cpp | 43 +++-- mozilla/widget/src/mac/nsMenuBar.h | 12 +- mozilla/widget/src/mac/nsMenuBarX.cpp | 49 +++--- mozilla/widget/src/mac/nsMenuBarX.h | 14 +- mozilla/widget/src/mac/nsMenuItem.cpp | 12 +- mozilla/widget/src/mac/nsMenuItem.h | 6 +- mozilla/widget/src/mac/nsMenuItemX.cpp | 8 +- mozilla/widget/src/mac/nsMenuItemX.h | 6 +- mozilla/widget/src/mac/nsMenuX.cpp | 62 +++---- mozilla/widget/src/mac/nsMenuX.h | 8 +- mozilla/xpcom/tests/SizeTest06.cpp | 84 +-------- .../xpfe/appshell/public/nsIWebShellWindow.h | 11 +- .../xpfe/appshell/src/nsWebShellWindow.cpp | 102 ++++------- mozilla/xpfe/appshell/src/nsWebShellWindow.h | 13 +- .../xpfe/appshell/src/nsWindowMediator.cpp | 1 - .../xpfe/browser/src/nsBrowserInstance.cpp | 1 - .../startup/src/nsCommandLineServiceMac.cpp | 1 - 72 files changed, 438 insertions(+), 1126 deletions(-) delete mode 100644 mozilla/webshell/public/nsIWebShell.h diff --git a/mozilla/content/base/src/nsFrameLoader.cpp b/mozilla/content/base/src/nsFrameLoader.cpp index faa28927fb8..d7a86cc3a35 100644 --- a/mozilla/content/base/src/nsFrameLoader.cpp +++ b/mozilla/content/base/src/nsFrameLoader.cpp @@ -55,7 +55,6 @@ #include "nsIDocShellTreeOwner.h" #include "nsIDocShellLoadInfo.h" #include "nsIBaseWindow.h" -#include "nsIWebShell.h" #include "nsContentUtils.h" #include "nsUnicharUtils.h" #include "nsIScriptGlobalObject.h" @@ -502,6 +501,8 @@ nsFrameLoader::EnsureDocShell() parentAsNode->AddChild(docShellAsItem); if (isContent) { + // XXXbz why is this in content code, exactly? We should handle + // this some other way..... nsCOMPtr parentTreeOwner; parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner)); @@ -514,15 +515,6 @@ nsFrameLoader::EnsureDocShell() } } - // connect the container... - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - nsCOMPtr outerContainer = - do_QueryInterface(parentAsWebNav); - - if (outerContainer) { - webShell->SetContainer(outerContainer); - } - // Make sure all shells have links back to the content element // in the nearest enclosing chrome shell. nsCOMPtr chromeEventHandler; diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 96c51fb4421..037e86961db 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -38,7 +38,6 @@ * ***** END LICENSE BLOCK ***** */ #include "nsDocShell.h" -#include "nsIWebShell.h" #include "nsWebShell.h" #include "nsIWebBrowserChrome.h" #include "nsIInterfaceRequestor.h" @@ -191,7 +190,6 @@ nsWebShell::~nsWebShell() mContentViewer=nsnull; mDeviceContext=nsnull; - NS_IF_RELEASE(mContainer); if (mScriptGlobal) { mScriptGlobal->SetDocShell(nsnull); @@ -247,9 +245,7 @@ NS_IMPL_ADDREF_INHERITED(nsWebShell, nsDocShell) NS_IMPL_RELEASE_INHERITED(nsWebShell, nsDocShell) NS_INTERFACE_MAP_BEGIN(nsWebShell) - NS_INTERFACE_MAP_ENTRY(nsIWebShell) NS_INTERFACE_MAP_ENTRY(nsIWebShellServices) - NS_INTERFACE_MAP_ENTRY(nsIWebShellContainer) NS_INTERFACE_MAP_ENTRY(nsILinkHandler) NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands) NS_INTERFACE_MAP_END_INHERITING(nsDocShell) @@ -272,24 +268,6 @@ nsWebShell::GetInterface(const nsIID &aIID, void** aInstancePtr) return nsDocShell::GetInterface(aIID, aInstancePtr); } -NS_IMETHODIMP -nsWebShell::SetContainer(nsIWebShellContainer* aContainer) -{ - NS_IF_RELEASE(mContainer); - mContainer = aContainer; - NS_IF_ADDREF(mContainer); - - return NS_OK; -} - -NS_IMETHODIMP -nsWebShell::GetContainer(nsIWebShellContainer*& aResult) -{ - aResult = mContainer; - NS_IF_ADDREF(mContainer); - return NS_OK; -} - nsEventStatus PR_CALLBACK nsWebShell::HandleEvent(nsGUIEvent *aEvent) { @@ -687,7 +665,7 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress, // someone is so very very rude as to bring this window down // during this load handler. // - nsCOMPtr kungFuDeathGrip(this); + nsCOMPtr kungFuDeathGrip(this); nsDocShell::EndPageLoad(aProgress, channel, aStatus); // Test if this is the top frame or a subframe @@ -1141,15 +1119,6 @@ NS_IMETHODIMP nsWebShell::Create() return nsDocShell::Create(); } -NS_IMETHODIMP nsWebShell::Destroy() -{ - nsDocShell::Destroy(); - - NS_IF_RELEASE(mContainer); - - return NS_OK; -} - #ifdef DEBUG unsigned long nsWebShell::gNumberOfWebShells = 0; #endif diff --git a/mozilla/docshell/base/nsWebShell.h b/mozilla/docshell/base/nsWebShell.h index 529f4bd5bbe..293a661d887 100644 --- a/mozilla/docshell/base/nsWebShell.h +++ b/mozilla/docshell/base/nsWebShell.h @@ -40,7 +40,6 @@ #include "nsError.h" #include "nsIWebShellServices.h" -#include "nsIWebShell.h" #include "nsILinkHandler.h" #include "nsIClipboardCommands.h" #include "nsDocShell.h" @@ -62,9 +61,11 @@ typedef enum { #define NS_ERROR_WEBSHELL_REQUEST_REJECTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GENERAL,1001) +// Class ID for webshell +#define NS_WEB_SHELL_CID \ + { 0xa6cf9059, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} + class nsWebShell : public nsDocShell, - public nsIWebShell, - public nsIWebShellContainer, public nsIWebShellServices, public nsILinkHandler, public nsIClipboardCommands @@ -80,16 +81,6 @@ public: NS_DECL_NSICLIPBOARDCOMMANDS NS_DECL_NSIWEBSHELLSERVICES - // nsIWebShell - NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer); - NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult); - - // nsIWebShellContainer::GetContainer overrides an - // nsIDocumentLoader method, so redeclare and forward - NS_IMETHOD GetContainer(nsISupports** aContainer) { - return nsDocLoader::GetContainer(aContainer); - } - // nsILinkHandler NS_IMETHOD OnLinkClick(nsIContent* aContent, nsLinkVerb aVerb, @@ -112,7 +103,6 @@ public: NS_IMETHOD GetLinkState(nsIURI* aLinkURI, nsLinkState& aState); NS_IMETHOD Create(); - NS_IMETHOD Destroy(); // nsWebShell nsresult GetEventQueue(nsIEventQueue **aQueue); @@ -124,7 +114,6 @@ public: friend struct OnLinkClickEvent; protected: - // void GetRootWebShellEvenIfChrome(nsIWebShell** aResult); void InitFrameData(); // helpers for executing commands @@ -143,8 +132,6 @@ protected: PRThread *mThread; - nsIWebShellContainer* mContainer; - eCharsetReloadState mCharsetReloadState; nsISupports* mHistoryState; // Weak reference. Session history owns this. diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index aabb8310c80..c8efc956ac5 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -117,7 +117,6 @@ #include "nsIWebBrowser.h" #include "nsIWebBrowserChrome.h" #include "nsIWebBrowserFind.h" // For window.find() -#include "nsIWebShell.h" #include "nsIWindowMediator.h" // For window.find() #include "nsIComputedDOMStyle.h" #include "nsIEntropyCollector.h" diff --git a/mozilla/dom/src/base/nsHistory.cpp b/mozilla/dom/src/base/nsHistory.cpp index 8b84d920920..24e24b41a6e 100644 --- a/mozilla/dom/src/base/nsHistory.cpp +++ b/mozilla/dom/src/base/nsHistory.cpp @@ -46,7 +46,6 @@ #include "nsIDocument.h" #include "nsIPresShell.h" #include "nsPresContext.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" #include "nsIWebNavigation.h" diff --git a/mozilla/dom/src/base/nsLocation.cpp b/mozilla/dom/src/base/nsLocation.cpp index 991c6bbbd8b..65616cf0165 100644 --- a/mozilla/dom/src/base/nsLocation.cpp +++ b/mozilla/dom/src/base/nsLocation.cpp @@ -40,7 +40,6 @@ #include "nsGlobalWindow.h" #include "nsIScriptSecurityManager.h" #include "nsIScriptContext.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIDocShellLoadInfo.h" #include "nsIWebNavigation.h" diff --git a/mozilla/embedding/browser/photon/src/EmbedPrivate.cpp b/mozilla/embedding/browser/photon/src/EmbedPrivate.cpp index cf1c1d6c107..62a170eb401 100644 --- a/mozilla/embedding/browser/photon/src/EmbedPrivate.cpp +++ b/mozilla/embedding/browser/photon/src/EmbedPrivate.cpp @@ -522,7 +522,6 @@ EmbedPrivate::Paste() clipboard->Paste(); } -#include void EmbedPrivate::SelectAll() { diff --git a/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp b/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp index f432a3b3222..cf0819d9542 100644 --- a/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp +++ b/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp @@ -55,7 +55,6 @@ #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIWebBrowserChrome.h" -#include "nsIWebShell.h" #include "nsPIDOMWindow.h" #include "nsIFocusController.h" #include "nsIDOMWindowInternal.h" @@ -92,7 +91,6 @@ #include "nsIEventSink.h" #endif -static NS_DEFINE_CID(kWebShellCID, NS_WEB_SHELL_CID); static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID); static NS_DEFINE_CID(kChildCID, NS_CHILD_CID); static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -1128,7 +1126,7 @@ NS_IMETHODIMP nsWebBrowser::Create() nsnull, nsnull, nsnull, &widgetInit); } - nsCOMPtr docShell(do_CreateInstance(kWebShellCID)); + nsCOMPtr docShell(do_CreateInstance("@mozilla.org/webshell;1")); NS_ENSURE_SUCCESS(SetDocShell(docShell), NS_ERROR_FAILURE); // get the system default window background colour diff --git a/mozilla/extensions/wallet/src/nsWalletService.cpp b/mozilla/extensions/wallet/src/nsWalletService.cpp index 167f86f1abf..642fca63945 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.cpp +++ b/mozilla/extensions/wallet/src/nsWalletService.cpp @@ -50,7 +50,6 @@ #include "nsIDocument.h" #include "nsIDocumentLoader.h" #include "nsCURILoader.h" -#include "nsIWebShell.h" #include "nsIDOMHTMLInputElement.h" #include "nsIFormControl.h" #include "nsIDocShell.h" diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp b/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp index 4854777e80a..062a34aaa62 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp +++ b/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp @@ -52,6 +52,7 @@ #include "nsIDocumentViewer.h" #include "nsPresContext.h" #include "nsIPresShell.h" +#include "nsIContentViewerContainer.h" #include "nsIViewManager.h" #include "nsIScrollableView.h" diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermStream.h b/mozilla/extensions/xmlterm/base/mozXMLTermStream.h index 088ba7ca9cc..6bf50a74922 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermStream.h +++ b/mozilla/extensions/xmlterm/base/mozXMLTermStream.h @@ -60,7 +60,6 @@ #include "nsNetUtil.h" #include "nsIIOService.h" -#include "nsIWebShell.h" #include "nsIPresShell.h" #include "nsIScriptContext.h" diff --git a/mozilla/intl/chardet/public/nsICharsetDetectionAdaptor.h b/mozilla/intl/chardet/public/nsICharsetDetectionAdaptor.h index 52a7307e0fd..80ecc4854c4 100644 --- a/mozilla/intl/chardet/public/nsICharsetDetectionAdaptor.h +++ b/mozilla/intl/chardet/public/nsICharsetDetectionAdaptor.h @@ -49,10 +49,10 @@ class nsIParser; /* This interface is defined to be serverd as an Adaptor between - nsIWebShell, nsICharsetDetector and nsIParserFilter + nsIWebShellServices, nsICharsetDetector and nsIParserFilter It make the nsICharsetDetector implementation independent from the - nsIParserFilter and nsIWebShell + nsIParserFilter and nsIWebShellServices */ class nsICharsetDetectionAdaptor : public nsISupports { @@ -60,7 +60,7 @@ public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHARSETDETECTIONADAPTOR_IID) /* Initialize it by setup the nsICharsetDetector and the - nsIWebShell + nsIWebShellServices */ NS_IMETHOD Init(nsIWebShellServices* aWebShell, nsICharsetDetector *aDetector, nsIDocument* aDocument, nsIParser* aParser, diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index e1ed7f915f1..f26ad3859ec 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -66,7 +66,6 @@ #include "nsStyleConsts.h" #include "nsTableOuterFrame.h" #include "nsIDOMXULElement.h" -#include "nsIWebShell.h" #include "nsHTMLContainerFrame.h" #include "nsINameSpaceManager.h" #include "nsLayoutAtoms.h" diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 11609dae95f..cfc8ba4df2b 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -180,7 +180,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset #include "nsINodeInfo.h" #include "nsIDocument.h" #include "nsHTMLAtoms.h" -#include "nsIWebShell.h" //focus #include "nsIDOMEventReceiver.h" diff --git a/mozilla/layout/base/nsIDocumentViewerPrint.h b/mozilla/layout/base/nsIDocumentViewerPrint.h index a568ede9a8c..8e40ef8c303 100644 --- a/mozilla/layout/base/nsIDocumentViewerPrint.h +++ b/mozilla/layout/base/nsIDocumentViewerPrint.h @@ -47,7 +47,6 @@ class nsIPresShell; class nsIDocument; class nsStyleSet; class nsIContent; -class nsIWebShell; // {D0B7F354-D575-43fd-903D-5AA35A193EDA} #define NS_IDOCUMENT_VIEWER_PRINT_IID \ diff --git a/mozilla/layout/generic/nsFrameSetFrame.h b/mozilla/layout/generic/nsFrameSetFrame.h index 92b438044ba..d42a3bea3f9 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.h +++ b/mozilla/layout/generic/nsFrameSetFrame.h @@ -52,7 +52,6 @@ struct nsRect; struct nsHTMLReflowState; struct nsSize; class nsIAtom; -class nsIWebShell; class nsHTMLFramesetBorderFrame; struct nsGUIEvent; class nsHTMLFramesetFrame; diff --git a/mozilla/layout/generic/nsHTMLParts.h b/mozilla/layout/generic/nsHTMLParts.h index be29ae46813..8e7be2c4a19 100644 --- a/mozilla/layout/generic/nsHTMLParts.h +++ b/mozilla/layout/generic/nsHTMLParts.h @@ -54,7 +54,6 @@ class nsPresContext; class nsITextContent; class nsIURI; class nsString; -class nsIWebShell; class nsIPresShell; class nsIChannel; diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index e169d2b0e77..2f07b98c640 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -66,7 +66,6 @@ #ifdef OJI #include "nsIJVMPluginTagInfo.h" #endif -#include "nsIWebShell.h" #include "nsINameSpaceManager.h" #include "nsIEventListener.h" #include "nsIScrollableView.h" diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp index ce54e497397..7d996e331fe 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -48,7 +48,6 @@ #include "nsCSSRendering.h" #include "prprf.h" // For PR_snprintf() -#include "nsIWebShell.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeOwner.h" #include "nsIWebBrowserChrome.h" diff --git a/mozilla/layout/printing/nsPrintEngine.cpp b/mozilla/layout/printing/nsPrintEngine.cpp index 73d2018a629..ddf91b7992a 100644 --- a/mozilla/layout/printing/nsPrintEngine.cpp +++ b/mozilla/layout/printing/nsPrintEngine.cpp @@ -104,7 +104,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsINodeInfo.h" #include "nsIDocument.h" #include "nsHTMLAtoms.h" -#include "nsIWebShell.h" // Focus #include "nsIDOMEventReceiver.h" @@ -410,7 +409,7 @@ nsPrintEngine::GetNewPresentation(nsCOMPtr& aShell, // Start at "1" and skip the FrameSet document itself for (PRInt32 i=1;imPrintObject->mKids[i]; - nsCOMPtr domWin(do_GetInterface(po->mWebShell)); + nsCOMPtr domWin(do_GetInterface(po->mDocShell)); if (domWin.get() == mPrt->mCurrentFocusWin.get()) { prtObjToDisplay = po; break; @@ -423,7 +422,7 @@ nsPrintEngine::GetNewPresentation(nsCOMPtr& aShell, // Start at "1" and skip the FrameSet document itself for (PRInt32 i=1;imPrintObject->mKids[i]; - nsCOMPtr domWin(do_GetInterface(po->mWebShell)); + nsCOMPtr domWin(do_GetInterface(po->mDocShell)); if (domWin.get() == mPrt->mCurrentFocusWin.get()) { nscoord width; nscoord height; @@ -543,7 +542,7 @@ static void DumpViews(nsIDocShell* aDocShell, FILE* out); static void DumpLayoutData(char* aTitleStr, char* aURLStr, nsPresContext* aPresContext, nsIDeviceContext * aDC, nsIFrame * aRootFrame, - nsIWebShell * aWebShell, FILE* aFD); + nsIDocShell * aDocShell, FILE* aFD); #endif //--------------------------------------------------------------------------------- @@ -628,7 +627,7 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings, // Check to see if there is a "regular" selection PRBool isSelection = IsThereARangeSelection(mPrt->mCurrentFocusWin); - // Create a list for storing the WebShells that need to be printed + // Create a list for storing the DocShells that need to be printed if (mPrt->mPrintDocList == nsnull) { mPrt->mPrintDocList = new nsVoidArray(); if (mPrt->mPrintDocList == nsnull) { @@ -640,8 +639,8 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings, mPrt->mPrintDocList->Clear(); } - // Get the webshell for this documentviewer - nsCOMPtr webContainer(do_QueryInterface(mContainer)); + // Get the docshell for this documentviewer + nsCOMPtr webContainer(do_QueryInterface(mContainer)); // Add Root Doc to Tree and List mPrt->mPrintObject = new nsPrintObject(); @@ -666,8 +665,8 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings, MapContentToWebShells(mPrt->mPrintObject, mPrt->mPrintObject); // Get whether the doc contains a frameset - // Also, check to see if the currently focus webshell - // is a child of this webshell + // Also, check to see if the currently focus docshell + // is a child of this docshell mPrt->mIsIFrameSelected = IsThereAnIFrameSelected(webContainer, mPrt->mCurrentFocusWin, mPrt->mIsParentAFrameSet); CheckForHiddenFrameSetFrames(); @@ -1093,7 +1092,7 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings, // Check to see if there is a "regular" selection PRBool isSelection = IsThereARangeSelection(mPrt->mCurrentFocusWin); - // Create a list for storing the WebShells that need to be printed + // Create a list for storing the DocShells that need to be printed if (!mPrt->mPrintDocList) { mPrt->mPrintDocList = new nsVoidArray(); if (!mPrt->mPrintDocList) { @@ -1106,8 +1105,8 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings, mPrt->mPrintDocList->Clear(); } - // Get the webshell for this documentviewer - nsCOMPtr webContainer(do_QueryInterface(mContainer)); + // Get the docshell for this documentviewer + nsCOMPtr webContainer(do_QueryInterface(mContainer)); // Add Root Doc to Tree and List mPrt->mPrintObject = new nsPrintObject(); @@ -1130,8 +1129,8 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings, MapContentToWebShells(mPrt->mPrintObject, mPrt->mPrintObject); // Get whether the doc contains a frameset - // Also, check to see if the currently focus webshell - // is a child of this webshell + // Also, check to see if the currently focus docshell + // is a child of this docshell mPrt->mIsIFrameSelected = IsThereAnIFrameSelected(webContainer, mPrt->mCurrentFocusWin, mPrt->mIsParentAFrameSet); CheckForHiddenFrameSetFrames(); @@ -1260,7 +1259,7 @@ nsPrintEngine::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) NS_IMETHODIMP nsPrintEngine::GetIsFramesetDocument(PRBool *aIsFramesetDocument) { - nsCOMPtr webContainer(do_QueryInterface(mContainer)); + nsCOMPtr webContainer(do_QueryInterface(mContainer)); *aIsFramesetDocument = IsParentAFrameSet(webContainer); return NS_OK; } @@ -1272,14 +1271,14 @@ nsPrintEngine::GetIsIFrameSelected(PRBool *aIsIFrameSelected) { *aIsIFrameSelected = PR_FALSE; - // Get the webshell for this documentviewer - nsCOMPtr webContainer(do_QueryInterface(mContainer)); + // Get the docshell for this documentviewer + nsCOMPtr webContainer(do_QueryInterface(mContainer)); // Get the currently focused window nsCOMPtr currentFocusWin = FindFocusedDOMWindow(); if (currentFocusWin && webContainer) { // Get whether the doc contains a frameset - // Also, check to see if the currently focus webshell - // is a child of this webshell + // Also, check to see if the currently focus docshell + // is a child of this docshell PRPackedBool isParentFrameSet; *aIsIFrameSelected = IsThereAnIFrameSelected(webContainer, currentFocusWin, isParentFrameSet); } @@ -1711,14 +1710,12 @@ nsPrintEngine::IsThereARangeSelection(nsIDOMWindow* aDOMWin) //--------------------------------------------------------------------- PRBool -nsPrintEngine::IsParentAFrameSet(nsIWebShell * aParent) +nsPrintEngine::IsParentAFrameSet(nsIDocShell * aParent) { NS_ASSERTION(aParent, "Pointer is null!"); - nsCOMPtr docShell(do_QueryInterface(aParent)); - NS_ASSERTION(docShell, "nsIDocShell can't be null"); nsCOMPtr shell; - docShell->GetPresShell(getter_AddRefs(shell)); + aParent->GetPresShell(getter_AddRefs(shell)); NS_ASSERTION(shell, "shell can't be null"); // See if if the incoming doc is the root document @@ -1788,10 +1785,10 @@ nsPrintEngine::BuildDocTree(nsIDocShellTreeNode * aParentNode, if (viewer) { nsCOMPtr viewerFile(do_QueryInterface(viewer)); if (viewerFile) { - nsCOMPtr childWebShell(do_QueryInterface(child)); + nsCOMPtr childDocShell(do_QueryInterface(child)); nsCOMPtr childNode(do_QueryInterface(child)); nsPrintObject * po = new nsPrintObject(); - if (NS_FAILED(po->Init(childWebShell))) { + if (NS_FAILED(po->Init(childDocShell))) { NS_ASSERTION(0, "Failed initializing the Print Object"); } po->mParent = aPO; @@ -1930,10 +1927,10 @@ nsPrintEngine::MapContentForPO(nsPrintObject* aRootObject, nsIPresShell *presShell = subDoc->GetShellAt(0); nsCOMPtr container = subDoc->GetContainer(); - nsCOMPtr webShell(do_QueryInterface(container)); + nsCOMPtr docShell(do_QueryInterface(container)); - if (presShell && webShell) { - nsPrintObject * po = FindPrintObjectByWS(aRootObject, webShell); + if (presShell && docShell) { + nsPrintObject * po = FindPrintObjectByDS(aRootObject, docShell); NS_ASSERTION(po, "PO can't be null!"); if (po) { @@ -1977,20 +1974,20 @@ nsPrintEngine::MapContentForPO(nsPrintObject* aRootObject, } //--------------------------------------------------------------------- -// Recursively finds a nsPrintObject that has the aWebShell -nsPrintObject * nsPrintEngine::FindPrintObjectByWS(nsPrintObject* aPO, nsIWebShell * aWebShell) +// Recursively finds a nsPrintObject that has the aDocShell +nsPrintObject * nsPrintEngine::FindPrintObjectByDS(nsPrintObject* aPO, nsIDocShell * aDocShell) { NS_ASSERTION(aPO, "Pointer is null!"); - NS_ASSERTION(aWebShell, "Pointer is null!"); + NS_ASSERTION(aDocShell, "Pointer is null!"); - if (aPO->mWebShell == aWebShell) { + if (aPO->mDocShell == aDocShell) { return aPO; } PRInt32 cnt = aPO->mKids.Count(); for (PRInt32 i=0;imKids.ElementAt(i); NS_ASSERTION(kid, "nsPrintObject can't be null!"); - nsPrintObject* po = FindPrintObjectByWS(kid, aWebShell); + nsPrintObject* po = FindPrintObjectByDS(kid, aDocShell); if (po != nsnull) { return po; } @@ -2000,11 +1997,11 @@ nsPrintObject * nsPrintEngine::FindPrintObjectByWS(nsPrintObject* aPO, nsIWebShe //--------------------------------------------------------------------- PRBool -nsPrintEngine::IsThereAnIFrameSelected(nsIWebShell* aWebShell, +nsPrintEngine::IsThereAnIFrameSelected(nsIDocShell* aDocShell, nsIDOMWindow* aDOMWin, PRPackedBool& aIsParentFrameSet) { - aIsParentFrameSet = IsParentAFrameSet(aWebShell); + aIsParentFrameSet = IsParentAFrameSet(aDocShell); PRBool iFrameIsSelected = PR_FALSE; if (mPrt && mPrt->mPrintObject) { nsPrintObject* po = FindPrintObjectByDOMWin(mPrt->mPrintObject, aDOMWin); @@ -2013,12 +2010,12 @@ nsPrintEngine::IsThereAnIFrameSelected(nsIWebShell* aWebShell, // First, check to see if we are a frameset if (!aIsParentFrameSet) { // Check to see if there is a currenlt focused frame - // if so, it means the selected frame is either the main webshell + // if so, it means the selected frame is either the main docshell // or an IFRAME if (aDOMWin) { - // Get the main webshell's DOMWin to see if it matches + // Get the main docshell's DOMWin to see if it matches // the frame that is selected - nsCOMPtr domWin = do_GetInterface(aWebShell); + nsCOMPtr domWin = do_GetInterface(aDocShell); if (domWin != aDOMWin) { iFrameIsSelected = PR_TRUE; // we have a selected IFRAME } @@ -2464,9 +2461,9 @@ nsPrintEngine::SetupToPrintContent(nsIDeviceContext* aDContext, CHECK_RUNTIME_ERROR_CONDITION(nsIDebugObject::PRT_RUNTIME_BEGINDOC, rv, NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(rv, rv); - // This will print the webshell document + // This will print the docshell document // when it completes asynchronously in the DonePrintingPages method - // it will check to see if there are more webshells to be printed and + // it will check to see if there are more docshells to be printed and // then PrintDocContent will be called again. if (mIsDoingPrinting) { @@ -2717,7 +2714,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink) mPresContext->CompatibilityMode()); if (!containerIsSet) { - nsCOMPtr supps(do_QueryInterface(aPO->mWebShell)); + nsCOMPtr supps(do_QueryInterface(aPO->mDocShell)); aPO->mPresContext->SetContainer(supps); } @@ -2729,8 +2726,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink) presShell->CaptureHistoryState(getter_AddRefs(layoutState), PR_TRUE); // set it on the new pres shell - nsCOMPtr docShell(do_QueryInterface(aPO->mWebShell)); - docShell->SetLayoutHistoryState(layoutState); + aPO->mDocShell->SetLayoutHistoryState(layoutState); // turn off animated GIFs if (aPO->mPresContext) { @@ -3010,7 +3006,7 @@ nsPrintEngine::CalcNumPrintableDocsAndPages(PRInt32& aNumDocs, PRInt32& aNumPage //----------------------------------------------------------------- //------------------------------------------------------- -// Called for each WebShell that needs to be printed +// Called for each DocShell that needs to be printed PRBool nsPrintEngine::PrintDocContent(nsPrintObject* aPO, nsresult& aStatus) { @@ -3085,19 +3081,19 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO, PRBool aDoSyncPrinting, PRBool& aDon PR_PL(("**************************** %s ****************************\n", gFrameTypesStr[aPO->mFrameType])); PR_PL(("****** In DV::DoPrint PO: %p aDoSyncPrinting: %s \n", aPO, PRT_YESNO(aDoSyncPrinting))); - nsIWebShell* webShell = aPO->mWebShell.get(); + nsIDocShell* docShell = aPO->mDocShell; nsIPresShell* poPresShell = aPO->mPresShell; nsPresContext* poPresContext = aPO->mPresContext; nsIView* poRootView = aPO->mRootView; - NS_ASSERTION(webShell, "The WebShell can't be NULL!"); + NS_ASSERTION(docShell, "The DocShell can't be NULL!"); NS_ASSERTION(poPresContext, "PrintObject has not been reflowed"); if (mPrt->mPrintProgressParams) { SetDocAndURLIntoProgress(aPO, mPrt->mPrintProgressParams); } - if (webShell != nsnull) { + if (docShell) { PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages; nsresult rv; @@ -3248,7 +3244,7 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO, PRBool aDoSyncPrinting, PRBool& aDon char * docStr; char * urlStr; GetDocTitleAndURL(aPO, docStr, urlStr); - DumpLayoutData(docStr, urlStr, poPresContext, mPrt->mPrintDocDC, rootFrame, webShell, nsnull); + DumpLayoutData(docStr, urlStr, poPresContext, mPrt->mPrintDocDC, rootFrame, docShell, nsnull); if (docStr) nsMemory::Free(docStr); if (urlStr) nsMemory::Free(urlStr); } @@ -3383,7 +3379,7 @@ nsPrintEngine::SetDocAndURLIntoProgress(nsPrintObject* aPO, NS_ASSERTION(aPO, "Must have vaild nsPrintObject"); NS_ASSERTION(aParams, "Must have vaild nsIPrintProgressParams"); - if (!aPO || !aPO->mWebShell || !aParams) { + if (!aPO || !aPO->mDocShell || !aParams) { return; } const PRUint32 kTitleLength = 64; @@ -3990,22 +3986,22 @@ nsPrintEngine::IsWindowsInOurSubTree(nsIDOMWindow * aDOMWindow) { PRBool found = PR_FALSE; - // now check to make sure it is in "our" tree of webshells + // now check to make sure it is in "our" tree of docshells nsCOMPtr scriptObj(do_QueryInterface(aDOMWindow)); if (scriptObj) { nsCOMPtr docShellAsItem = do_QueryInterface(scriptObj->GetDocShell()); if (docShellAsItem) { - // get this DocViewer webshell - nsCOMPtr thisDVWebShell(do_QueryInterface(mContainer)); + // get this DocViewer docshell + nsCOMPtr thisDVDocShell(do_QueryInterface(mContainer)); while (!found) { nsCOMPtr docShellParent; docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent)); - nsCOMPtr parentWebshell(do_QueryInterface(docShellParent)); - if (parentWebshell) { - if (parentWebshell == thisDVWebShell) { + nsCOMPtr parentDocshell(do_QueryInterface(docShellParent)); + if (parentDocshell) { + if (parentDocshell == thisDVDocShell) { found = PR_TRUE; break; } @@ -4145,7 +4141,7 @@ nsPrintEngine::FindPrintObjectByDOMWin(nsPrintObject* aPO, return nsnull; } - nsCOMPtr domWin(do_GetInterface(aPO->mWebShell)); + nsCOMPtr domWin(do_GetInterface(aPO->mDocShell)); if (domWin && domWin == aDOMWin) { return aPO; } @@ -4251,7 +4247,7 @@ nsPrintEngine::EnablePOsForPrinting() // // XXX this is sort of a hack right here to make the page // not try to reposition itself when printing selection - nsCOMPtr domWin = do_GetInterface(po->mWebShell); + nsCOMPtr domWin = do_GetInterface(po->mDocShell); if (!IsThereARangeSelection(domWin)) { printRangeType = nsIPrintSettings::kRangeAllPages; mPrt->mPrintSettings->SetPrintRange(printRangeType); @@ -4265,7 +4261,7 @@ nsPrintEngine::EnablePOsForPrinting() for (PRInt32 i=0;imPrintDocList->Count();i++) { nsPrintObject* po = (nsPrintObject*)mPrt->mPrintDocList->ElementAt(i); NS_ASSERTION(po, "nsPrintObject can't be null!"); - nsCOMPtr domWin = do_GetInterface(po->mWebShell); + nsCOMPtr domWin = do_GetInterface(po->mDocShell); if (IsThereARangeSelection(domWin)) { mPrt->mCurrentFocusWin = domWin; SetPrintPO(po, PR_TRUE); @@ -4298,7 +4294,7 @@ nsPrintEngine::EnablePOsForPrinting() // // XXX this is sort of a hack right here to make the page // not try to reposition itself when printing selection - nsCOMPtr domWin = do_GetInterface(po->mWebShell); + nsCOMPtr domWin = do_GetInterface(po->mDocShell); if (!IsThereARangeSelection(domWin)) { printRangeType = nsIPrintSettings::kRangeAllPages; mPrt->mPrintSettings->SetPrintRange(printRangeType); @@ -4790,7 +4786,7 @@ void DumpLayoutData(char* aTitleStr, nsPresContext* aPresContext, nsIDeviceContext * aDC, nsIFrame * aRootFrame, - nsIWebShell * aWebShell, + nsIDocShekk * aDocShell, FILE* aFD = nsnull) { if (!kPrintingLogMod || kPrintingLogMod->level != DUMP_LAYOUT_LEVEL) return; @@ -4806,7 +4802,7 @@ void DumpLayoutData(char* aTitleStr, #endif NS_ASSERTION(aRootFrame, "Pointer is null!"); - NS_ASSERTION(aWebShell, "Pointer is null!"); + NS_ASSERTION(aDocShell, "Pointer is null!"); // Dump all the frames and view to a a file char filename[256]; @@ -4829,10 +4825,9 @@ void DumpLayoutData(char* aTitleStr, } else { printf("View is null!\n"); } - nsCOMPtr docShell(do_QueryInterface(aWebShell)); - if (docShell) { + if (aDocShell) { fprintf(fd, "--------------- All Views ----------------\n"); - DumpViews(docShell, fd); + DumpViews(aDocShell, fd); fprintf(fd, "---------------------------------------\n\n"); } if (aFD == nsnull) { @@ -4850,7 +4845,7 @@ static void DumpPrintObjectsList(nsVoidArray * aDocList) const char types[][3] = {"DC", "FR", "IF", "FS"}; PR_PL(("Doc List\n***************************************************\n")); - PR_PL(("T P A H PO WebShell Seq Page Root Page# Rect\n")); + PR_PL(("T P A H PO DocShell Seq Page Root Page# Rect\n")); PRInt32 cnt = aDocList->Count(); for (PRInt32 i=0;iElementAt(i); @@ -4868,7 +4863,7 @@ static void DumpPrintObjectsList(nsVoidArray * aDocList) } PR_PL(("%s %d %d %d %p %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType], - po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mWebShell.get(), po->mSeqFrame, + po->IsPrintable(), po->mPrintAsIs, po->mHasBeenPrinted, po, po->mDocShell.get(), po->mSeqFrame, po->mPageFrame, rootFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height)); } } @@ -4884,14 +4879,14 @@ static void DumpPrintObjectsTree(nsPrintObject * aPO, int aLevel, FILE* aFD) const char types[][3] = {"DC", "FR", "IF", "FS"}; if (aLevel == 0) { fprintf(fd, "DocTree\n***************************************************\n"); - fprintf(fd, "T PO WebShell Seq Page Page# Rect\n"); + fprintf(fd, "T PO DocShell Seq Page Page# Rect\n"); } PRInt32 cnt = aPO->mKids.Count(); for (PRInt32 i=0;imKids.ElementAt(i); NS_ASSERTION(po, "nsPrintObject can't be null!"); for (PRInt32 k=0;kmFrameType], po, po->mWebShell.get(), po->mSeqFrame, + fprintf(fd, "%s %p %p %p %p %d %d,%d,%d,%d\n", types[po->mFrameType], po, po->mDocShell.get(), po->mSeqFrame, po->mPageFrame, po->mPageNum, po->mRect.x, po->mRect.y, po->mRect.width, po->mRect.height); } } @@ -4942,7 +4937,7 @@ static void DumpPrintObjectsTreeLayout(nsPrintObject * aPO, fd = fopen("tree_layout.txt", "w"); fprintf(fd, "DocTree\n***************************************************\n"); fprintf(fd, "***************************************************\n"); - fprintf(fd, "T PO WebShell Seq Page Page# Rect\n"); + fprintf(fd, "T PO DocShell Seq Page Page# Rect\n"); } else { fd = aFD; } @@ -4952,13 +4947,13 @@ static void DumpPrintObjectsTreeLayout(nsPrintObject * aPO, rootFrame = aPO->mPresShell->FrameManager()->GetRootFrame(); } for (PRInt32 k=0;kmFrameType], aPO, aPO->mWebShell.get(), aPO->mSeqFrame, + fprintf(fd, "%s %p %p %p %p %d %d,%d,%d,%d\n", types[aPO->mFrameType], aPO, aPO->mDocShell.get(), aPO->mSeqFrame, aPO->mPageFrame, aPO->mPageNum, aPO->mRect.x, aPO->mRect.y, aPO->mRect.width, aPO->mRect.height); if (aPO->IsPrintable()) { char * docStr; char * urlStr; GetDocTitleAndURL(aPO, docStr, urlStr); - DumpLayoutData(docStr, urlStr, aPO->mPresContext, aDC, rootFrame, aPO->mWebShell, fd); + DumpLayoutData(docStr, urlStr, aPO->mPresContext, aDC, rootFrame, aPO->mDocShell, fd); if (docStr) nsMemory::Free(docStr); if (urlStr) nsMemory::Free(urlStr); } diff --git a/mozilla/layout/printing/nsPrintEngine.h b/mozilla/layout/printing/nsPrintEngine.h index e92029352ab..3bce380da05 100644 --- a/mozilla/layout/printing/nsPrintEngine.h +++ b/mozilla/layout/printing/nsPrintEngine.h @@ -179,7 +179,7 @@ public: nsresult ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink); nsresult CalcPageFrameLocation(nsIPresShell * aPresShell, nsPrintObject* aPO); - nsPrintObject * FindPrintObjectByWS(nsPrintObject* aPO, nsIWebShell * aWebShell); + nsPrintObject * FindPrintObjectByDS(nsPrintObject* aPO, nsIDocShell * aDocShell); void MapContentForPO(nsPrintObject* aRootObject, nsIPresShell* aPresShell, nsIContent* aContent); @@ -215,8 +215,8 @@ public: PRUint32 aDelay); PRBool IsWindowsInOurSubTree(nsIDOMWindow * aDOMWindow); - PRBool IsParentAFrameSet(nsIWebShell * aParent); - PRBool IsThereAnIFrameSelected(nsIWebShell* aWebShell, + PRBool IsParentAFrameSet(nsIDocShell * aParent); + PRBool IsThereAnIFrameSelected(nsIDocShell* aDocShell, nsIDOMWindow* aDOMWin, PRPackedBool& aIsParentFrameSet); diff --git a/mozilla/layout/printing/nsPrintObject.cpp b/mozilla/layout/printing/nsPrintObject.cpp index cd8ef56de21..4b6599908b1 100644 --- a/mozilla/layout/printing/nsPrintObject.cpp +++ b/mozilla/layout/printing/nsPrintObject.cpp @@ -80,11 +80,9 @@ nsPrintObject::~nsPrintObject() //------------------------------------------------------------------ // Resets PO by destroying the presentation nsresult -nsPrintObject::Init(nsIWebShell* aWebShell) +nsPrintObject::Init(nsIDocShell* aDocShell) { - mWebShell = aWebShell; - - mDocShell = do_QueryInterface(mWebShell); + mDocShell = aDocShell; NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); mDocShell->GetPresShell(getter_AddRefs(mDisplayPresShell)); diff --git a/mozilla/layout/printing/nsPrintObject.h b/mozilla/layout/printing/nsPrintObject.h index 5d21bed8353..c21c5de99b8 100644 --- a/mozilla/layout/printing/nsPrintObject.h +++ b/mozilla/layout/printing/nsPrintObject.h @@ -45,7 +45,6 @@ #include "nsIPresShell.h" #include "nsStyleSet.h" #include "nsIViewManager.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIDocument.h" #include "nsIWidget.h" @@ -67,13 +66,12 @@ public: ~nsPrintObject(); // non-virtual // Methods - nsresult Init(nsIWebShell* aWebShell); + nsresult Init(nsIDocShell* aDocShell); PRBool IsPrintable() { return !mDontPrint; } void DestroyPresentation(); // Data Members - nsCOMPtr mWebShell; nsCOMPtr mDocShell; nsCOMPtr mDisplayPresShell; nsCOMPtr mDisplayPresContext; diff --git a/mozilla/mailnews/base/public/nsIMsgMessageService.idl b/mozilla/mailnews/base/public/nsIMsgMessageService.idl index 36945383331..a9ba891a0a7 100644 --- a/mozilla/mailnews/base/public/nsIMsgMessageService.idl +++ b/mozilla/mailnews/base/public/nsIMsgMessageService.idl @@ -84,8 +84,9 @@ interface nsIMsgMessageService : nsISupports { ///////////////////////////////////////////////////////////////////// // DisplayMessage: When you want a message displayed.... // aMessageURI is a uri representing the message to display. - // aDisplayConsumer is (for now) a nsIWebshell which we'll use to load - // the message into. + // aDisplayConsumer is (for now) an nsIDocShell which we'll use to load + // the message into. + // XXXbz Should it be an nsIWebNavigation or something? // aCharsetOverride (optional) character set over ride to force the message to // use. // @@ -142,8 +143,9 @@ interface nsIMsgMessageService : nsISupports { // DisplayMessageForPrinting: When you want a message displayed in a // format that is suitable for printing.... // aMessageURI is a uri representing the message to display. - // aDisplayConsumer is (for now) a nsIWebshell which we'll use to load - // the message into. + // aDisplayConsumer is (for now) a nsIDocShell which we'll use to load + // the message into. + // XXXbz should it be an nsIWebNavigation? /////////////////////////////////////////////////////////////////// void DisplayMessageForPrinting(in string aMessageURI, in nsISupports aDisplayConsumer, diff --git a/mozilla/mailnews/base/src/nsMessenger.cpp b/mozilla/mailnews/base/src/nsMessenger.cpp index b9a4fec8952..8bd563ba68b 100644 --- a/mozilla/mailnews/base/src/nsMessenger.cpp +++ b/mozilla/mailnews/base/src/nsMessenger.cpp @@ -79,7 +79,6 @@ #include "nsLayoutCID.h" #include "nsIMarkupDocumentViewer.h" #include "nsIContentViewer.h" -#include "nsIWebShell.h" // embedding #include "nsIWebBrowserPrint.h" @@ -569,8 +568,7 @@ nsMessenger::OpenURL(const char *aURL) if (NS_SUCCEEDED(rv) && messageService) { - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - messageService->DisplayMessage(aURL, webShell, mMsgWindow, nsnull, nsnull, nsnull); + messageService->DisplayMessage(aURL, mDocShell, mMsgWindow, nsnull, nsnull, nsnull); mLastDisplayURI = aURL; // remember the last uri we displayed.... } //If it's not something we know about, then just load the url. @@ -1518,8 +1516,7 @@ NS_IMETHODIMP nsMessenger::SetDocumentCharset(const char *characterSet) if (NS_SUCCEEDED(rv) && messageService) { - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - messageService->DisplayMessage(mLastDisplayURI.get(), webShell, mMsgWindow, nsnull, characterSet, nsnull); + messageService->DisplayMessage(mLastDisplayURI.get(), mDocShell, mMsgWindow, nsnull, characterSet, nsnull); } } diff --git a/mozilla/mailnews/base/src/nsMsgPrintEngine.cpp b/mozilla/mailnews/base/src/nsMsgPrintEngine.cpp index f06a3255d68..26007daad8d 100644 --- a/mozilla/mailnews/base/src/nsMsgPrintEngine.cpp +++ b/mozilla/mailnews/base/src/nsMsgPrintEngine.cpp @@ -48,7 +48,6 @@ #include "nsEscape.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIDOMDocument.h" #include "nsIDOMWindowInternal.h" @@ -66,9 +65,8 @@ #include "nsMsgPrintEngine.h" #include "nsMsgBaseCID.h" #include "nsIDocumentLoader.h" -#include "nsIWebShellWindow.h" #include "nsIWidget.h" -#include "nsIWebShellWindow.h" +#include "nsIXULWindow.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" @@ -314,25 +312,15 @@ nsMsgPrintEngine::ShowWindow(PRBool aShow) NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr webShell = + nsCOMPtr treeItem = do_QueryInterface(globalScript->GetDocShell(), &rv); NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr webShellContainer; - rv = webShell->GetContainer(*getter_AddRefs(webShellContainer)); + nsCOMPtr treeOwner; + rv = treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); NS_ENSURE_SUCCESS(rv,rv); - if (webShellContainer) { - nsCOMPtr webShellWindow = do_QueryInterface(webShellContainer, &rv); - NS_ENSURE_SUCCESS(rv,rv); - - nsCOMPtr treeItem(do_QueryInterface(webShell, &rv)); - NS_ENSURE_SUCCESS(rv,rv); - - nsCOMPtr treeOwner; - rv = treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); - NS_ENSURE_SUCCESS(rv,rv); - + if (treeOwner) { // disable (enable) the window nsCOMPtr baseWindow; baseWindow = do_QueryInterface(treeOwner, &rv); @@ -342,7 +330,7 @@ nsMsgPrintEngine::ShowWindow(PRBool aShow) NS_ENSURE_SUCCESS(rv,rv); // hide or show the window - rv = webShellWindow->Show(aShow); + baseWindow->SetVisibility(aShow); } return rv; } @@ -561,8 +549,7 @@ nsMsgPrintEngine::FireThatLoadOperation(nsString *uri) if (NS_SUCCEEDED(rv) && messageService) { - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - rv = messageService->DisplayMessageForPrinting(tString, webShell, nsnull, nsnull, nsnull); + rv = messageService->DisplayMessageForPrinting(tString, mDocShell, nsnull, nsnull, nsnull); } //If it's not something we know about, then just load try loading it directly. else diff --git a/mozilla/mailnews/base/src/nsMsgWindow.cpp b/mozilla/mailnews/base/src/nsMsgWindow.cpp index b1ccf7c35c1..8f57c228202 100644 --- a/mozilla/mailnews/base/src/nsMsgWindow.cpp +++ b/mozilla/mailnews/base/src/nsMsgWindow.cpp @@ -66,8 +66,6 @@ #include "nsMsgI18N.h" #include "nsIWebNavigation.h" #include "nsISupportsObsolete.h" -// XXX Remove -#include "nsIWebShell.h" // used to dispatch urls to default protocol handlers #include "nsCExternalHandlerService.h" diff --git a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp index 3ba09ca0ae7..febee1336c0 100644 --- a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp @@ -62,7 +62,6 @@ #include "nsIMsgMailSession.h" #include "nsIPrefService.h" #include "nsIDocShell.h" -#include "nsIWebShell.h" #include "nsIWebShellWindow.h" #include "nsIAuthPrompt.h" #include "nsIObserverService.h" @@ -866,9 +865,7 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell)); if (NS_FAILED(rv)) return rv; - nsCOMPtr webShell(do_QueryInterface(docShell, &rv)); - if (NS_FAILED(rv)) return rv; - dialog = do_GetInterface(webShell, &rv); + dialog = do_GetInterface(docShell, &rv); if (NS_FAILED(rv)) return rv; } else diff --git a/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp b/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp index 55207383442..bf8ab0deb4f 100644 --- a/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp +++ b/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp @@ -44,7 +44,6 @@ #include "nsReadableUtils.h" #include "nsIDocumentLoader.h" #include "nsILoadGroup.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIWebProgress.h" #include "nsIWebProgressListener.h" diff --git a/mozilla/mailnews/compose/src/nsMsgComposeService.cpp b/mozilla/mailnews/compose/src/nsMsgComposeService.cpp index c5b228727c0..59b6a3aedbd 100644 --- a/mozilla/mailnews/compose/src/nsMsgComposeService.cpp +++ b/mozilla/mailnews/compose/src/nsMsgComposeService.cpp @@ -63,8 +63,6 @@ #include "nsIDocShell.h" #include "nsIScriptGlobalObject.h" -#include "nsIWebShell.h" -#include "nsIWebShellWindow.h" #include "nsIDOMDocument.h" #include "nsIDOMElement.h" #include "nsIXULWindow.h" @@ -78,6 +76,8 @@ #include "nsMsgBaseCID.h" #include "nsIMsgAccountManager.h" +#include "nsIInterfaceRequestorUtils.h" + #ifdef MSGCOMP_TRACE_PERFORMANCE #include "prlog.h" #include "nsIMsgHdr.h" @@ -826,14 +826,14 @@ nsresult nsMsgComposeService::ShowCachedComposeWindow(nsIDOMWindowInternal *aCom nsIDocShell *docShell = globalScript->GetDocShell(); - nsCOMPtr webShell = do_QueryInterface(docShell, &rv); + nsCOMPtr treeItem = do_QueryInterface(docShell, &rv); NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr webShellContainer; - rv = webShell->GetContainer(*getter_AddRefs(webShellContainer)); + nsCOMPtr treeOwner; + rv = treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); NS_ENSURE_SUCCESS(rv,rv); - if (webShellContainer) { + if (treeOwner) { // the window need to be sticky before we hide it. nsCOMPtr contentViewer; @@ -844,16 +844,6 @@ nsresult nsMsgComposeService::ShowCachedComposeWindow(nsIDOMWindowInternal *aCom NS_ENSURE_SUCCESS(rv,rv); // disable (enable) the cached window - nsCOMPtr webShellWindow = do_QueryInterface(webShellContainer, &rv); - NS_ENSURE_SUCCESS(rv,rv); - - nsCOMPtr treeItem(do_QueryInterface(docShell, &rv)); - NS_ENSURE_SUCCESS(rv,rv); - - nsCOMPtr treeOwner; - rv = treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); - NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr baseWindow; baseWindow = do_QueryInterface(treeOwner, &rv); NS_ENSURE_SUCCESS(rv,rv); @@ -861,7 +851,7 @@ nsresult nsMsgComposeService::ShowCachedComposeWindow(nsIDOMWindowInternal *aCom baseWindow->SetEnabled(aShow); NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr xulWindow = do_QueryInterface(webShellWindow, &rv); + nsCOMPtr xulWindow = do_GetInterface(treeOwner, &rv); NS_ENSURE_SUCCESS(rv,rv); nsCOMPtr windowMediator = @@ -875,7 +865,7 @@ nsresult nsMsgComposeService::ShowCachedComposeWindow(nsIDOMWindowInternal *aCom } // hide (show) the cached window - rv = webShellWindow->Show(aShow); + rv = baseWindow->SetVisibility(aShow); NS_ENSURE_SUCCESS(rv,rv); // if hiding, remove the window from the mediator, diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index a1e68953fa7..97629b8bf78 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -86,7 +86,6 @@ #include "nsIMsgStatusFeedback.h" #include "nsIMsgMailSession.h" #include "nsTextFormatter.h" -#include "nsIWebShell.h" #include "nsIPrompt.h" #include "nsMailHeaders.h" #include "nsIDocShell.h" diff --git a/mozilla/mailnews/news/src/nsNewsFolder.cpp b/mozilla/mailnews/news/src/nsNewsFolder.cpp index 5eea0606131..6b6688036e2 100644 --- a/mozilla/mailnews/news/src/nsNewsFolder.cpp +++ b/mozilla/mailnews/news/src/nsNewsFolder.cpp @@ -73,7 +73,6 @@ #include "nsIMsgWindow.h" #include "nsIDocShell.h" -#include "nsIWebShell.h" #include "nsIPrompt.h" #include "nsIWindowWatcher.h" @@ -1383,10 +1382,7 @@ nsMsgNewsFolder::GetGroupPasswordWithUI(const PRUnichar * aPromptMessage, const rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell)); if (NS_FAILED(rv)) return rv; - nsCOMPtr webShell(do_QueryInterface(docShell, &rv)); - if (NS_FAILED(rv)) return rv; - - dialog = do_GetInterface(webShell, &rv); + dialog = do_GetInterface(docShell, &rv); if (NS_FAILED(rv)) return rv; } else @@ -1454,9 +1450,7 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const nsCOMPtr docShell; rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell)); if (NS_FAILED(rv)) return rv; - nsCOMPtr webShell(do_QueryInterface(docShell, &rv)); - if (NS_FAILED(rv)) return rv; - dialog = do_GetInterface(webShell, &rv); + dialog = do_GetInterface(docShell, &rv); if (NS_FAILED(rv)) return rv; } else diff --git a/mozilla/parser/htmlparser/robot/test/RobotMain.cpp b/mozilla/parser/htmlparser/robot/test/RobotMain.cpp index 785054b568d..5d752359225 100644 --- a/mozilla/parser/htmlparser/robot/test/RobotMain.cpp +++ b/mozilla/parser/htmlparser/robot/test/RobotMain.cpp @@ -1,9 +1,12 @@ #include "nsXPCOM.h" #include "nsVoidArray.h" #include "nsString.h" -class nsIWebShell; +class nsIDocShell; -extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebShell * ww); +//XXXbz is this even used? There is no DebugRobot() with this +//signature in the tree! + +extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIDocShell * ww); int main(int argc, char **argv) { diff --git a/mozilla/toolkit/components/startup/src/nsCommandLineServiceMac.cpp b/mozilla/toolkit/components/startup/src/nsCommandLineServiceMac.cpp index f322e7791fe..078663a9a74 100644 --- a/mozilla/toolkit/components/startup/src/nsCommandLineServiceMac.cpp +++ b/mozilla/toolkit/components/startup/src/nsCommandLineServiceMac.cpp @@ -54,7 +54,6 @@ #include "nsIServiceManager.h" #include "nsNetCID.h" #include "nsIWebShellWindow.h" -#include "nsIWebShell.h" #include "nsIDOMWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" diff --git a/mozilla/webshell/public/Makefile.in b/mozilla/webshell/public/Makefile.in index 3263f6f22f5..ec935626317 100644 --- a/mozilla/webshell/public/Makefile.in +++ b/mozilla/webshell/public/Makefile.in @@ -63,7 +63,6 @@ XPIDLSRCS = \ EXPORTS = \ nsILinkHandler.h \ - nsIWebShell.h \ nsIWebShellServices.h \ $(NULL) diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h deleted file mode 100644 index 593b575bee6..00000000000 --- a/mozilla/webshell/public/nsIWebShell.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsIWebShell_h___ -#define nsIWebShell_h___ - -#include "nsIContentViewerContainer.h" - -class nsIDocumentLoader; -class nsIURI; - -// Interface ID for nsIWebShell -// e1c77239-eb80-42bb-8b94-54b49fe1b25b -#define NS_IWEB_SHELL_IID \ - { 0xe1c77239, 0xeb80, 0x42bb,{0x8b, 0x94, 0x54, 0xb4, 0x9f, 0xe1, 0xb2, 0x5b}} - -// Interface ID for nsIWebShellContainer -#define NS_IWEB_SHELL_CONTAINER_IID \ - { 0xa6cf905a, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} - -// Class ID for an implementation of nsIWebShell -#define NS_WEB_SHELL_CID \ - { 0xa6cf9059, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}} - -//---------------------------------------------------------------------- - -typedef enum { - nsLoadURL, - nsLoadHistory, - nsLoadLink, - nsLoadRefresh -} nsLoadType; - -// Container for web shell's -class nsIWebShellContainer : public nsISupports { -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWEB_SHELL_CONTAINER_IID) - -}; - -//---------------------------------------------------------------------- - -/** - * The web shell is a container for implementations of nsIContentViewer. - * It is a content-viewer-container and also knows how to delegate certain - * behavior to an nsIWebShellContainer. - * - * Web shells can be arranged in a tree. - * - * Web shells are also nsIWebShellContainer's because they can contain - * other web shells. - */ -class nsIWebShell : public nsISupports { -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWEB_SHELL_IID) - - /** - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!! - * - * THIS INTERFACE IS DEPRECATED. DO NOT ADD STUFF OR CODE TO IT!!!! - */ - - // XXXbz there is no need for this interface anymore... Callers can either - // just get the parent treeitem, or when they want the container of the root - // docshell can get the treeowner and GetInterface nsIXULWindow to get what - // GetContainer currently returns... - - // XXXbz oh, and the Show() method on nsIWebShellWindow is just redundant - // with SetVisibility on nsIBaseWindow.... Mailnews uses this interface for - // that stuff, but it doesn't have to. - - /** - * Set the nsIWebShellContainer for the WebShell. - */ - NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer) = 0; - - /** - * Return the current nsIWebShellContainer. - */ - NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult) = 0; -}; - -#endif /* nsIWebShell_h___ */ diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index 9916460b8c5..60f97e7d92a 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -75,6 +75,7 @@ #include "nsIDocumentViewer.h" #include "nsIContentViewer.h" #include "nsIContentViewerFile.h" +#include "nsIContentViewerContainer.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIDocument.h" @@ -800,13 +801,6 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID) case VIEW_SOURCE: { -// PRInt32 theIndex; -// nsCOMPtr webShell(do_QueryInterface(mDocShell)); -// webShell->GetHistoryIndex(theIndex); -// nsXPIDLString theURL; -// webShell->GetURL(theIndex, getter_Copies(theURL)); -// nsAutoString theString(theURL); -// mApp->ViewSource(theString); //XXX Find out how the string is allocated, and perhaps delete it... } break; @@ -1278,7 +1272,7 @@ nsBrowserWindow::~nsBrowserWindow() } } -NS_IMPL_ISUPPORTS4(nsBrowserWindow, nsIBaseWindow, nsIInterfaceRequestor, nsIProgressEventSink, nsIWebShellContainer) +NS_IMPL_ISUPPORTS3(nsBrowserWindow, nsIBaseWindow, nsIInterfaceRequestor, nsIProgressEventSink) nsresult nsBrowserWindow::GetInterface(const nsIID& aIID, @@ -1352,8 +1346,6 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell, mDocShell = do_GetInterface(mWebBrowser); mDocShell->SetAllowPlugins(aAllowPlugins); - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - webShell->SetContainer((nsIWebShellContainer*) this); webBrowserWin->SetVisibility(PR_TRUE); if (nsIWebBrowserChrome::CHROME_MENUBAR & aChromeMask) { @@ -1424,8 +1416,6 @@ nsnull, r.x, r.y, r.width, r.height); webBrowserWin->Create(); mDocShell = do_GetInterface(mWebBrowser); mDocShell->SetAllowPlugins(aAllowPlugins); - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - webShell->SetContainer((nsIWebShellContainer*) this); webBrowserWin->SetVisibility(PR_TRUE); if (nsIWebBrowserChrome::CHROME_MENUBAR & aChromeMask) { rv = CreateMenuBar(r.width); @@ -1837,20 +1827,16 @@ nsBrowserWindow::GetChrome(PRUint32& aChromeMaskResult) } NS_IMETHODIMP -nsBrowserWindow::GetWebShell(nsIWebShell*& aResult) +nsBrowserWindow::GetDocShell(nsIDocShell*& aResult) { - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - aResult = webShell; - NS_IF_ADDREF(aResult); + NS_IF_ADDREF(aResult = mDocShell); return NS_OK; } NS_IMETHODIMP -nsBrowserWindow::GetContentWebShell(nsIWebShell **aResult) +nsBrowserWindow::GetContentDocShell(nsIDocShell **aResult) { - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - *aResult = webShell; - NS_IF_ADDREF(*aResult); + NS_IF_ADDREF(*aResult = mDocShell); return NS_OK; } @@ -1867,133 +1853,6 @@ nsBrowserWindow::ShowMenuBar(PRBool aShow) return NS_OK; } -NS_IMETHODIMP -nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, - nsLoadType aReason) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsBrowserWindow::ProgressLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, - PRInt32 aProgress, - PRInt32 aProgressMax) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, - nsresult aStatus) -{ - return NS_OK; -} - - -NS_IMETHODIMP -nsBrowserWindow::NewWebShell(PRUint32 aChromeMask, - PRBool aVisible, - nsIWebShell*& aNewWebShell) -{ - nsresult rv = NS_OK; - - if (mWebCrawler) { - if (mWebCrawler->Crawling() || mWebCrawler->LoadingURLList()) { - // Do not fly javascript popups when we are crawling - aNewWebShell = nsnull; - return NS_ERROR_NOT_IMPLEMENTED; - } - } - - // Create new window. By default, the refcnt will be 1 because of - // the registration of the browser window in gBrowsers. - nsNativeBrowserWindow* browser; - NS_NEWXPCOM(browser, nsNativeBrowserWindow); - - if (nsnull != browser) - { - nsRect bounds; - GetContentBounds(bounds); - - browser->SetApp(mApp); - - // Assume no controls for now - rv = browser->Init(mAppShell, bounds, aChromeMask, mAllowPlugins); - if (NS_OK == rv) - { - // Default is to startup hidden - if (aVisible) { - browser->SetVisibility(PR_TRUE); - } - nsIWebShell *shell; - rv = browser->GetWebShell(shell); - aNewWebShell = shell; - } - else - { - browser->Destroy(); - } - } - else - rv = NS_ERROR_OUT_OF_MEMORY; - - return rv; -} - - -NS_IMETHODIMP -nsBrowserWindow::ContentShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsBrowserWindow::FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult) -{ - PRInt32 i, n = gBrowsers ? gBrowsers->Count() : 0; - - aResult = nsnull; - nsString aNameStr(aName); - - for (i = 0; i < n; i++) { - nsBrowserWindow* bw = (nsBrowserWindow*) gBrowsers->ElementAt(i); - nsCOMPtr webShell; - - if (NS_OK == bw->GetWebShell(*getter_AddRefs(webShell))) { - nsXPIDLString name; - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - if (NS_OK == docShellAsItem->GetName(getter_Copies(name))) { - if (aNameStr.Equals(name)) { - aResult = webShell; - NS_ADDREF(aResult); - return NS_OK; - } - } - - nsCOMPtr docShellAsNode(do_QueryInterface(mDocShell)); - - nsCOMPtr result; - if (NS_OK == docShellAsNode->FindChildWithName(aName, PR_TRUE, PR_FALSE, nsnull, - getter_AddRefs(result))) { - if (result) { - CallQueryInterface(result, &aResult); - return NS_OK; - } - } - } - } - return NS_OK; -} - - //---------------------------------------- NS_IMETHODIMP diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.h b/mozilla/webshell/tests/viewer/nsBrowserWindow.h index 681404d1bd2..54caca39f4a 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.h +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.h @@ -53,7 +53,6 @@ #include "nsIWebBrowser.h" #include "nsIStreamListener.h" #include "nsIProgressEventSink.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsString.h" #include "nsVoidArray.h" @@ -87,8 +86,7 @@ class nsIContent; */ class nsBrowserWindow : public nsIBaseWindow, public nsIInterfaceRequestor, - public nsIProgressEventSink, - public nsIWebShellContainer + public nsIProgressEventSink { friend class nsWebBrowserChrome; @@ -124,23 +122,12 @@ public: NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult); NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax); NS_IMETHOD ShowMenuBar(PRBool aShow); - NS_IMETHOD GetWebShell(nsIWebShell*& aResult); - NS_IMETHOD GetContentWebShell(nsIWebShell **aResult); + NS_IMETHOD GetDocShell(nsIDocShell*& aResult); + NS_IMETHOD GetContentDocShell(nsIDocShell **aResult); // nsIProgressEventSink NS_DECL_NSIPROGRESSEVENTSINK - // nsIWebShellContainer - NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason); - NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); - NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); - NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus); - NS_IMETHOD NewWebShell(PRUint32 aChromeMask, - PRBool aVisible, - nsIWebShell *&aNewWebShell); - NS_IMETHOD ContentShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode); - NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult); - // nsBrowserWindow void SetWebCrawler(nsWebCrawler* aWebCrawler); virtual nsresult CreateMenuBar(PRInt32 aWidth) = 0; diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index 579cfe3d4b8..5eb6277061a 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -46,7 +46,6 @@ #include "nsCOMPtr.h" #include "nsWebCrawler.h" #include "nsViewerApp.h" -#include "nsIWebShell.h" #include "nsIContentViewer.h" #include "nsIDocumentViewer.h" #include "nsIDocument.h" @@ -235,18 +234,17 @@ void nsWebCrawler::DumpRegressionData() { #ifdef NS_DEBUG - nsCOMPtr webshell; - mBrowser->GetWebShell(*getter_AddRefs(webshell)); - if (! webshell) + nsCOMPtr docshell; + mBrowser->GetDocShell(*getter_AddRefs(docshell)); + if (! docshell) return; if (mOutputDir.Length() > 0) { - nsIPresShell* shell = GetPresShell(webshell); + nsCOMPtr shell = GetPresShell(docshell); if (!shell) return; if ( mPrinterTestType > 0 ) { nsCOMPtr viewer; - nsCOMPtr docShell(do_QueryInterface(webshell)); - docShell->GetContentViewer(getter_AddRefs(viewer)); + docshell->GetContentViewer(getter_AddRefs(viewer)); if (viewer){ nsCOMPtr viewerFile = do_QueryInterface(viewer); @@ -321,7 +319,6 @@ nsWebCrawler::DumpRegressionData() } } } - NS_RELEASE(shell); } #endif } @@ -334,11 +331,10 @@ nsWebCrawler::LoadNextURLCallback(nsITimer *aTimer, void *aClosure) // if we are doing printing regression tests, check to see // if we can print (a previous job is not printing) if (self->mPrinterTestType > 0) { - nsCOMPtr webshell; - self->mBrowser->GetWebShell(*getter_AddRefs(webshell)); - if (webshell){ + nsCOMPtr docShell; + self->mBrowser->GetDocShell(*getter_AddRefs(docShell)); + if (docShell){ nsCOMPtr viewer; - nsCOMPtr docShell(do_QueryInterface(webshell)); docShell->GetContentViewer(getter_AddRefs(viewer)); if (viewer){ nsCOMPtr viewerFile = do_QueryInterface(viewer); @@ -377,9 +373,8 @@ nsWebCrawler::OnStateChange(nsIWebProgress* aWebProgress, { // Make sure that we're being notified for _our_ shell, and not some // subshell that's been created e.g. for an IFRAME. - nsCOMPtr shell; - mBrowser->GetWebShell(*getter_AddRefs(shell)); - nsCOMPtr docShell = do_QueryInterface(shell); + nsCOMPtr docShell; + mBrowser->GetDocShell(*getter_AddRefs(docShell)); if (docShell) { nsCOMPtr progress = do_GetInterface(docShell); if (aWebProgress != progress) @@ -433,7 +428,7 @@ nsWebCrawler::OnStateChange(nsIWebProgress* aWebProgress, printf("+++ %s: done loading (%lld msec)\n", spec.get(), delta); // Make sure the document bits make it to the screen at least once - nsCOMPtr shell = dont_AddRef(GetPresShell()); + nsCOMPtr shell = GetPresShell(); if (shell) { // Force the presentation shell to update the display shell->FlushPendingNotifications(Flush_Display); @@ -614,9 +609,8 @@ void nsWebCrawler::Start() { // Enable observing each URL load... - nsCOMPtr shell; - mBrowser->GetWebShell(*getter_AddRefs(shell)); - nsCOMPtr docShell(do_QueryInterface(shell)); + nsCOMPtr docShell; + mBrowser->GetDocShell(*getter_AddRefs(docShell)); if (docShell) { nsCOMPtr progress(do_GetInterface(docShell)); if (progress) { @@ -812,10 +806,9 @@ nsWebCrawler::FindURLsIn(nsIDocument* aDocument, nsIContent* aNode) void nsWebCrawler::FindMoreURLs() { - nsCOMPtr shell; - mBrowser->GetWebShell(*getter_AddRefs(shell)); + nsCOMPtr docShell; + mBrowser->GetDocShell(*getter_AddRefs(docShell)); - nsCOMPtr docShell(do_QueryInterface(shell)); if (docShell) { nsCOMPtr cv; docShell->GetContentViewer(getter_AddRefs(cv)); @@ -860,8 +853,6 @@ nsWebCrawler::LoadNextURL(PRBool aQueueLoad) if (nsnull != url) { if (OkToLoad(*url)) { RecordLoadedURL(*url); - nsIWebShell* webShell; - mBrowser->GetWebShell(webShell); if (aQueueLoad) { // Call stop to cancel any pending URL Refreshes... /// webShell->Stop(); @@ -870,10 +861,11 @@ nsWebCrawler::LoadNextURL(PRBool aQueueLoad) else { mCurrentURL = *url; mStartLoad = PR_Now(); - nsCOMPtr webNav(do_QueryInterface(webShell)); + nsCOMPtr docShell; + mBrowser->GetDocShell(*getter_AddRefs(docShell)); + nsCOMPtr webNav(do_QueryInterface(docShell)); webNav->LoadURI(url->get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull); } - NS_RELEASE(webShell); if (mMaxPages > 0) { --mMaxPages; @@ -893,35 +885,16 @@ nsWebCrawler::LoadNextURL(PRBool aQueueLoad) } -nsIPresShell* -nsWebCrawler::GetPresShell(nsIWebShell* aWebShell) +already_AddRefed +nsWebCrawler::GetPresShell(nsIDocShell* aDocShell) { - nsIWebShell* webShell = aWebShell; - if (webShell) { - NS_ADDREF(webShell); - } - else { - mBrowser->GetWebShell(webShell); - } nsIPresShell* shell = nsnull; - nsCOMPtr docShell(do_QueryInterface(webShell)); - if (nsnull != webShell) { - nsIContentViewer* cv = nsnull; - docShell->GetContentViewer(&cv); - if (nsnull != cv) { - nsIDocumentViewer* docv = nsnull; - cv->QueryInterface(NS_GET_IID(nsIDocumentViewer), (void**) &docv); - if (nsnull != docv) { - nsCOMPtr cx; - docv->GetPresContext(getter_AddRefs(cx)); - if (nsnull != cx) { - NS_IF_ADDREF(shell = cx->GetPresShell()); - } - NS_RELEASE(docv); - } - NS_RELEASE(cv); - } - NS_RELEASE(webShell); + nsCOMPtr docShell(aDocShell); + if (!docShell) { + mBrowser->GetDocShell(*getter_AddRefs(docShell)); + } + if (docShell) { + docShell->GetPresShell(&shell); } return shell; } @@ -1103,14 +1076,13 @@ LoadEvent::DeleteMe(LoadEvent* e) void nsWebCrawler::GoToQueuedURL(const nsString& aURL) { - nsIWebShell* webShell; - mBrowser->GetWebShell(webShell); - nsCOMPtr webNav(do_QueryInterface(webShell)); + nsCOMPtr docShell; + mBrowser->GetDocShell(*getter_AddRefs(docShell)); + nsCOMPtr webNav(do_QueryInterface(docShell)); if (webNav) { mCurrentURL = aURL; mStartLoad = PR_Now(); webNav->LoadURI(aURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull); - NS_RELEASE(webShell); } mQueuedLoadURLs--; diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.h b/mozilla/webshell/tests/viewer/nsWebCrawler.h index d017123eda5..6655f05b9d2 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.h +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.h @@ -165,7 +165,7 @@ protected: /** generate an output name from a URL */ FILE* GetOutputFile(nsIURI *aURL, nsString& aOutputName); - nsIPresShell* GetPresShell(nsIWebShell* aWebShell = nsnull); + already_AddRefed GetPresShell(nsIDocShell* aDocShell = nsnull); void PerformRegressionTest(const nsString& aOutputName); diff --git a/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp b/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp index d7316a344b1..61007def181 100644 --- a/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsXPBaseWindow.cpp @@ -80,15 +80,12 @@ //#include "nsUnitConversion.h" //#include "nsIDeviceContext.h" -static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID); static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID); static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID); -static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID); static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); @@ -132,11 +129,6 @@ nsresult nsXPBaseWindow::QueryInterface(const nsIID& aIID, NS_ADDREF_THIS(); return NS_OK; } - if (aIID.Equals(kIWebShellContainerIID)) { - *aInstancePtrResult = (void*) ((nsIWebShellContainer*)this); - NS_ADDREF_THIS(); - return NS_OK; - } if (aIID.Equals(kIDOMMouseListenerIID)) { NS_ADDREF_THIS(); // Increase reference count for caller *aInstancePtrResult = (void *)((nsIDOMMouseListener*)this); @@ -222,18 +214,16 @@ nsresult nsXPBaseWindow::Init(nsXPBaseWindowType aType, mWindow->GetBounds(r); // Create web shell - rv = CallCreateInstance(kWebShellCID, &mWebShell); + rv = CallCreateInstance("@mozilla.org/webshell;1", &mDocShell); if (NS_FAILED(rv)) { return rv; } r.x = r.y = 0; - nsCOMPtr docShell(do_QueryInterface(mWebShell)); - docShell->SetAllowPlugins(aAllowPlugins); - nsCOMPtr docShellWin(do_QueryInterface(mWebShell)); + mDocShell->SetAllowPlugins(aAllowPlugins); + nsCOMPtr docShellWin(do_QueryInterface(mDocShell)); rv = docShellWin->InitWindow(nsnull, mWindow, r.x, r.y, r.width, r.height); docShellWin->Create(); - mWebShell->SetContainer((nsIWebShellContainer*) this); docShellWin->SetVisibility(PR_TRUE); // Now lay it all out @@ -270,8 +260,8 @@ void nsXPBaseWindow::ForceRefresh() void nsXPBaseWindow::Layout(PRInt32 aWidth, PRInt32 aHeight) { nsRect rr(0, 0, aWidth, aHeight); - nsCOMPtr webShellWin(do_QueryInterface(mWebShell)); - webShellWin->SetPositionAndSize(rr.x, rr.y, rr.width, rr.height, PR_FALSE); + nsCOMPtr docShellWin(do_QueryInterface(mDocShell)); + docShellWin->SetPositionAndSize(rr.x, rr.y, rr.width, rr.height, PR_FALSE); } //---------------------------------------------------------------------- @@ -326,10 +316,10 @@ NS_IMETHODIMP nsXPBaseWindow::Close() mWindowListener->Destroy(this); } - if (nsnull != mWebShell) { - nsCOMPtr webShellWin(do_QueryInterface(mWebShell)); + if (mDocShell) { + nsCOMPtr webShellWin(do_QueryInterface(mDocShell)); webShellWin->Destroy(); - NS_RELEASE(mWebShell); + NS_RELEASE(mDocShell); } if (nsnull != mWindow) { @@ -342,10 +332,9 @@ NS_IMETHODIMP nsXPBaseWindow::Close() //---------------------------------------------------------------------- -NS_IMETHODIMP nsXPBaseWindow::GetWebShell(nsIWebShell*& aResult) +NS_IMETHODIMP nsXPBaseWindow::GetDocShell(nsIDocShell*& aResult) { - aResult = mWebShell; - NS_IF_ADDREF(mWebShell); + NS_IF_ADDREF(aResult = mDocShell); return NS_OK; } @@ -369,92 +358,11 @@ NS_IMETHODIMP nsXPBaseWindow::GetTitle(const PRUnichar** aResult) //--------------------------------------------------------------- NS_IMETHODIMP nsXPBaseWindow::LoadURL(const nsString& aURL) { - nsCOMPtr webNav(do_QueryInterface(mWebShell)); + nsCOMPtr webNav(do_QueryInterface(mDocShell)); webNav->LoadURI(aURL.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull); return NS_OK; } -//--------------------------------------------------------------- -NS_IMETHODIMP nsXPBaseWindow::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) -{ - return NS_OK; -} - -//----------------------------------------------------------------- -NS_IMETHODIMP nsXPBaseWindow::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) -{ - return NS_OK; -} - -//----------------------------------------------------------------- -NS_IMETHODIMP nsXPBaseWindow::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax) -{ - return NS_OK; -} - -//----------------------------------------------------------------- -NS_IMETHODIMP nsXPBaseWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus) -{ - // Find the Root Conent Node for this Window - nsIPresShell* shell; - GetPresShell(shell); - if (nsnull != shell) { - nsIDocument *doc = shell->GetDocument(); - if (doc) { - NS_IF_ADDREF(mContentRoot = doc->GetRootContent()); - mDocIsLoaded = PR_TRUE; - if (nsnull != mWindowListener) { - mWindowListener->Initialize(this); - } - } - NS_RELEASE(shell); - } - - return NS_OK; -} - -//----------------------------------------------------------------- - -NS_IMETHODIMP -nsXPBaseWindow::FindWebShellWithName(const PRUnichar* aName, - nsIWebShell*& aResult) -{ - aResult = nsnull; - - nsString aNameStr(aName); - - nsCOMPtr webShell; - GetWebShell(*getter_AddRefs(webShell)); - nsCOMPtr docShellAsItem(do_QueryInterface(webShell)); - if (webShell) { - nsXPIDLString name; - if (NS_SUCCEEDED(docShellAsItem->GetName(getter_Copies(name)))) { - if (aNameStr.Equals(name)) { - aResult = webShell; - NS_ADDREF(aResult); - return NS_OK; - } - } - - nsCOMPtr docShellAsNode(do_QueryInterface(webShell)); - nsCOMPtr result; - if (NS_OK == docShellAsNode->FindChildWithName(aName, PR_TRUE, PR_FALSE, - nsnull, getter_AddRefs(result))) { - if (result) { - CallQueryInterface(result, &aResult); - return NS_OK; - } - } - } - - return NS_OK; -} - -NS_IMETHODIMP nsXPBaseWindow::FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken) -{ - return NS_OK; -} - //----------------------------------------------------------------- NS_IMETHODIMP nsXPBaseWindow::AddEventListener(nsIDOMNode * aNode) { @@ -518,56 +426,15 @@ NS_IMETHODIMP nsXPBaseWindow::GetDocument(nsIDOMHTMLDocument *& aDocument) return NS_OK; } -//----------------------------------------------------------------- -NS_IMETHODIMP nsXPBaseWindow::NewWebShell(PRUint32 aChromeMask, - PRBool aVisible, - nsIWebShell*& aNewWebShell) -{ - nsresult rv = NS_OK; - - // Create new window. By default, the refcnt will be 1 because of - // the registration of the browser window in gBrowsers. - nsXPBaseWindow* dialogWindow; - NS_NEWXPCOM(dialogWindow, nsXPBaseWindow); - - if (nsnull != dialogWindow) { - nsRect bounds; - GetBounds(bounds); - - rv = dialogWindow->Init(mWindowType, mAppShell, mDialogURL, mTitle, bounds, aChromeMask, mAllowPlugins); - if (NS_OK == rv) { - if (aVisible) { - dialogWindow->SetVisible(PR_TRUE); - } - nsIWebShell *shell; - rv = dialogWindow->GetWebShell(shell); - aNewWebShell = shell; - } else { - dialogWindow->Close(); - } - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - - return rv; -} - -NS_IMETHODIMP -nsXPBaseWindow::ContentShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode) -{ - return NS_OK; -} - //---------------------------------------------------------------------- NS_IMETHODIMP nsXPBaseWindow::GetPresShell(nsIPresShell*& aPresShell) { aPresShell = nsnull; - nsCOMPtr docShell(do_QueryInterface(mWebShell)); - if (docShell) { + if (mDocShell) { nsIContentViewer* cv = nsnull; - docShell->GetContentViewer(&cv); + mDocShell->GetContentViewer(&cv); if (nsnull != cv) { nsIDocumentViewer* docv = nsnull; cv->QueryInterface(kIDocumentViewerIID, (void**) &docv); diff --git a/mozilla/webshell/tests/viewer/nsXPBaseWindow.h b/mozilla/webshell/tests/viewer/nsXPBaseWindow.h index 97f69abb263..d6489d4e41f 100644 --- a/mozilla/webshell/tests/viewer/nsXPBaseWindow.h +++ b/mozilla/webshell/tests/viewer/nsXPBaseWindow.h @@ -39,7 +39,6 @@ #include "nsIXPBaseWindow.h" #include "nsIStreamListener.h" -#include "nsIWebShell.h" #include "nsString.h" #include "nsVoidArray.h" #include "nsCRT.h" @@ -57,7 +56,6 @@ class nsIPresShell; * */ class nsXPBaseWindow : public nsIXPBaseWindow, - public nsIWebShellContainer, public nsIDOMMouseListener { public: @@ -88,25 +86,13 @@ public: NS_IMETHOD Close(); NS_IMETHOD SetTitle(const PRUnichar* aTitle); NS_IMETHOD GetTitle(const PRUnichar** aResult); - NS_IMETHOD GetWebShell(nsIWebShell*& aResult); + NS_IMETHOD GetDocShell(nsIDocShell*& aResult); NS_IMETHOD GetPresShell(nsIPresShell*& aPresShell); //NS_IMETHOD HandleEvent(nsGUIEvent * anEvent); NS_IMETHOD LoadURL(const nsString &aURL); - // nsIWebShellContainer - NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason); - NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); - NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); - NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus); - NS_IMETHOD NewWebShell(PRUint32 aChromeMask, - PRBool aVisible, - nsIWebShell *&aNewWebShell); - NS_IMETHOD ContentShellAdded(nsIWebShell* aChildShell, nsIContent* frameNode); - NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult); - NS_IMETHOD FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken); - void Layout(PRInt32 aWidth, PRInt32 aHeight); void ForceRefresh(); @@ -147,7 +133,7 @@ protected: nsString mDialogURL; nsIWidget* mWindow; - nsIWebShell* mWebShell; + nsIDocShell* mDocShell; nsIWindowListener * mWindowListener; // XXX Someday this will be a list PRBool mDocIsLoaded; diff --git a/mozilla/webshell/tests/viewer/public/nsIXPBaseWindow.h b/mozilla/webshell/tests/viewer/public/nsIXPBaseWindow.h index 2e4fb35c05e..3628abddc1d 100644 --- a/mozilla/webshell/tests/viewer/public/nsIXPBaseWindow.h +++ b/mozilla/webshell/tests/viewer/public/nsIXPBaseWindow.h @@ -41,7 +41,7 @@ class nsIAppShell; class nsIFactory; -class nsIWebShell; +class nsIDocShell; class nsString; class nsIPresShell; class nsIDOMElement; @@ -136,7 +136,7 @@ public: NS_IMETHOD GetTitle(const PRUnichar** aResult) = 0; - NS_IMETHOD GetWebShell(nsIWebShell*& aResult) = 0; + NS_IMETHOD GetDocShell(nsIDocShell*& aResult) = 0; NS_IMETHOD LoadURL(const nsString &aURL) = 0; diff --git a/mozilla/widget/public/nsIMenu.h b/mozilla/widget/public/nsIMenu.h index e8fae69ea2a..c9c3fa8f9bd 100644 --- a/mozilla/widget/public/nsIMenu.h +++ b/mozilla/widget/public/nsIMenu.h @@ -40,7 +40,7 @@ #include "nsISupports.h" #include "nsString.h" -#include "nsIWebShell.h" +#include "nsIDocShell.h" class nsIMenuBar; class nsIMenu; @@ -70,7 +70,7 @@ class nsIMenu : public nsISupports { * */ NS_IMETHOD Create ( nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) = 0; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) = 0; /** * Get the Menu's Parent diff --git a/mozilla/widget/public/nsIMenuBar.h b/mozilla/widget/public/nsIMenuBar.h index 4e8b5280db2..c53c46ac2fe 100644 --- a/mozilla/widget/public/nsIMenuBar.h +++ b/mozilla/widget/public/nsIMenuBar.h @@ -41,7 +41,6 @@ #include "nsISupports.h" #include "nsString.h" #include "nsIMenu.h" -#include "nsIWebShell.h" class nsIWidget; diff --git a/mozilla/widget/public/nsIMenuItem.h b/mozilla/widget/public/nsIMenuItem.h index b8feb1c4adf..2af20f2b128 100644 --- a/mozilla/widget/public/nsIMenuItem.h +++ b/mozilla/widget/public/nsIMenuItem.h @@ -42,7 +42,7 @@ #include "nsISupports.h" #include "nsString.h" -#include "nsIWebShell.h" +#include "nsIDocShell.h" #include "nsIDOMElement.h" @@ -81,7 +81,7 @@ class nsIMenuItem : public nsISupports { */ NS_IMETHOD Create ( nsIMenu* aParent, const nsString & aLabel, PRBool isSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) = 0; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) = 0; /** * Get the MenuItem label diff --git a/mozilla/widget/public/nsIMenuListener.h b/mozilla/widget/public/nsIMenuListener.h index b193ab5cd7d..a26bf56edbf 100644 --- a/mozilla/widget/public/nsIMenuListener.h +++ b/mozilla/widget/public/nsIMenuListener.h @@ -83,7 +83,7 @@ class nsIMenuListener : public nsISupports { virtual nsEventStatus MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, void* aNode, - void* aWebShell) = 0; + void* aDocShell) = 0; virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent) = 0; diff --git a/mozilla/widget/src/cocoa/nsMenuBarX.cpp b/mozilla/widget/src/cocoa/nsMenuBarX.cpp index ce2be0d955d..7bbb0da1807 100644 --- a/mozilla/widget/src/cocoa/nsMenuBarX.cpp +++ b/mozilla/widget/src/cocoa/nsMenuBarX.cpp @@ -201,14 +201,13 @@ nsMenuBarX::SetRebuild(PRBool aNeedsRebuild) } void -nsMenuBarX :: GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) +nsMenuBarX :: GetDocument ( nsIDocShell* inDocShell, nsIDocument** outDocument ) { *outDocument = nsnull; - nsCOMPtr docShell ( do_QueryInterface(inWebShell) ); - nsCOMPtr cv; - if ( docShell ) { - docShell->GetContentViewer(getter_AddRefs(cv)); + if ( inDocShell ) { + nsCOMPtr cv; + inDocShell->GetContentViewer(getter_AddRefs(cv)); if (cv) { // get the document nsCOMPtr docv(do_QueryInterface(cv)); @@ -226,17 +225,17 @@ nsMenuBarX :: GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) // Name says it all. // void -nsMenuBarX :: RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) +nsMenuBarX :: RegisterAsDocumentObserver ( nsIDocShell* inDocShell ) { nsCOMPtr doc; - GetDocument(inWebShell, getter_AddRefs(doc)); + GetDocument(inDocShell, getter_AddRefs(doc)); if (!doc) return; // register ourselves nsCOMPtr observer ( do_QueryInterface(NS_STATIC_CAST(nsIMenuBar*,this)) ); doc->AddObserver(observer); - // also get pointer to doc, just in case webshell goes away + // also get pointer to doc, just in case docshell goes away // we can still remove ourself as doc observer directly from doc mDocument = doc; } // RegisterAsDocumentObesrver @@ -396,11 +395,11 @@ nsMenuBarX :: ExecuteCommand ( nsIContent* inDispatchTo ) { nsEventStatus status = nsEventStatus_eIgnore; if ( inDispatchTo ) { - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return nsEventStatus_eConsumeNoDefault; nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext)); + MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext)); nsMouseEvent event(NS_XUL_COMMAND); @@ -437,9 +436,9 @@ nsMenuBarX :: HideItem ( nsIDOMDocument* inDoc, const nsAString & inID, nsIConte nsEventStatus nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void * menubarNode, void * aWebShell ) + void * menubarNode, void * aDocShell ) { - mWebShellWeakRef = do_GetWeakReference(NS_STATIC_CAST(nsIWebShell*, aWebShell)); + mDocShellWeakRef = do_GetWeakReference(NS_STATIC_CAST(nsIDocShell*, aDocShell)); nsIDOMNode* aDOMNode = NS_STATIC_CAST(nsIDOMNode*, menubarNode); mMenuBarContent = do_QueryInterface(aDOMNode); // strong ref NS_ASSERTION ( mMenuBarContent, "No content specified for this menubar" ); @@ -458,8 +457,8 @@ nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWin if ( err ) return nsEventStatus_eIgnore; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (webShell) RegisterAsDocumentObserver(webShell); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (docShell) RegisterAsDocumentObserver(docShell); // set this as a nsMenuListener on aParentWindow aParentWindow->AddMenuListener((nsIMenuListener *)this); @@ -482,7 +481,7 @@ nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWin if ( pnsMenu ) { pnsMenu->Create(NS_STATIC_CAST(nsIMenuBar*, this), menuName, menuAccessKey, NS_STATIC_CAST(nsIChangeManager *, this), - NS_REINTERPRET_CAST(nsIWebShell*, aWebShell), menu); + NS_REINTERPRET_CAST(nsIDocShell*, aDocShell), menu); // Make nsMenu a child of nsMenuBar. nsMenuBar takes ownership AddMenu(pnsMenu); @@ -924,25 +923,24 @@ nsMenuBarX :: Unregister ( PRUint32 inCommandID ) // -// WebShellToPresContext +// DocShellToPresContext // -// Helper to dig out a pres context from a webshell. A common thing to do before +// Helper to dig out a pres context from a docshell. A common thing to do before // sending an event into the dom. // +// XXXbz this should be using DOM event apis! nsresult -MenuHelpersX::WebShellToPresContext (nsIWebShell* inWebShell, nsPresContext** outContext ) +MenuHelpersX::DocShellToPresContext (nsIDocShell* inDocShell, nsPresContext** outContext ) { NS_ENSURE_ARG_POINTER(outContext); *outContext = nsnull; - if (!inWebShell) + if (!inDocShell) return NS_ERROR_INVALID_ARG; nsresult retval = NS_OK; - nsCOMPtr docShell(do_QueryInterface(inWebShell)); - nsCOMPtr contentViewer; - docShell->GetContentViewer(getter_AddRefs(contentViewer)); + inDocShell->GetContentViewer(getter_AddRefs(contentViewer)); if ( contentViewer ) { nsCOMPtr docViewer ( do_QueryInterface(contentViewer) ); if ( docViewer ) @@ -955,7 +953,7 @@ MenuHelpersX::WebShellToPresContext (nsIWebShell* inWebShell, nsPresContext** ou return retval; -} // WebShellToPresContext +} // DocShellToPresContext diff --git a/mozilla/widget/src/cocoa/nsMenuBarX.h b/mozilla/widget/src/cocoa/nsMenuBarX.h index 7f2e20aba7f..bdd53118c7d 100644 --- a/mozilla/widget/src/cocoa/nsMenuBarX.h +++ b/mozilla/widget/src/cocoa/nsMenuBarX.h @@ -63,8 +63,8 @@ class nsIDOMNode; namespace MenuHelpersX { - // utility routine for getting a PresContext out of a webShell - nsresult WebShellToPresContext ( nsIWebShell* inWebShell, nsPresContext** outContext ) ; + // utility routine for getting a PresContext out of a docShell + nsresult DocShellToPresContext ( nsIDocShell* inDocShell, nsPresContext** outContext ) ; } @@ -95,7 +95,7 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); @@ -120,8 +120,8 @@ public: protected: - void GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) ; - void RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) ; + void GetDocument ( nsIDocShell* inDocShell, nsIDocument** outDocument ) ; + void RegisterAsDocumentObserver ( nsIDocShell* inDocShell ) ; // Make our menubar conform to Aqua UI guidelines void AquifyMenuBar ( ) ; @@ -150,7 +150,7 @@ protected: PRBool mIsMenuBarAdded; - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsIDocument* mDocument; // pointer to document MenuRef mRootMenu; // root menu, representing entire menu bar. diff --git a/mozilla/widget/src/cocoa/nsMenuItemX.cpp b/mozilla/widget/src/cocoa/nsMenuItemX.cpp index 575b8279525..ba48c021646 100644 --- a/mozilla/widget/src/cocoa/nsMenuItemX.cpp +++ b/mozilla/widget/src/cocoa/nsMenuItemX.cpp @@ -94,11 +94,11 @@ nsMenuItemX::~nsMenuItemX() NS_METHOD nsMenuItemX::Create ( nsIMenu* aParent, const nsString & aLabel, PRBool aIsSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) { mContent = aNode; // addref mMenuParent = aParent; // weak - mWebShellWeakRef = do_GetWeakReference(aShell); + mDocShellWeakRef = do_GetWeakReference(aShell); mEnabled = aEnabled; mMenuType = aItemType; @@ -222,7 +222,7 @@ nsEventStatus nsMenuItemX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * menuNode, - void * aWebShell) + void * aDocShell) { return nsEventStatus_eIgnore; } @@ -255,10 +255,10 @@ nsEventStatus nsMenuItemX::SetRebuild(PRBool aNeedsRebuild) NS_METHOD nsMenuItemX::DoCommand() { nsCOMPtr presContext; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return nsEventStatus_eConsumeNoDefault; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext)); + MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext)); nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(NS_XUL_COMMAND); diff --git a/mozilla/widget/src/cocoa/nsMenuItemX.h b/mozilla/widget/src/cocoa/nsMenuItemX.h index c3eac6d83bb..ca05e3af3f2 100644 --- a/mozilla/widget/src/cocoa/nsMenuItemX.h +++ b/mozilla/widget/src/cocoa/nsMenuItemX.h @@ -68,7 +68,7 @@ public: // nsIMenuItem Methods NS_IMETHOD Create ( nsIMenu* aParent, const nsString & aLabel, PRBool aIsSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) ; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) ; NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetShortcutChar(const nsString &aText); NS_IMETHOD GetShortcutChar(nsString &aText); @@ -91,7 +91,7 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); @@ -109,7 +109,7 @@ protected: nsCOMPtr mTarget; // never set? nsCOMPtr mXULCommandListener; - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsCOMPtr mContent; PRUint8 mModifiers; diff --git a/mozilla/widget/src/cocoa/nsMenuX.cpp b/mozilla/widget/src/cocoa/nsMenuX.cpp index 3060031df6a..3389de7a379 100644 --- a/mozilla/widget/src/cocoa/nsMenuX.cpp +++ b/mozilla/widget/src/cocoa/nsMenuX.cpp @@ -148,9 +148,9 @@ nsMenuX::~nsMenuX() // NS_METHOD nsMenuX::Create(nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) { - mWebShellWeakRef = do_GetWeakReference(aShell); + mDocShellWeakRef = do_GetWeakReference(aShell); mMenuContent = aNode; // register this menu to be notified when changes are made to our content object @@ -504,16 +504,16 @@ nsEventStatus nsMenuX::MenuSelected(const nsMenuEvent & aMenuEvent) if (mNeedsRebuild) RemoveAll(); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return nsEventStatus_eConsumeNoDefault; } if (mIsHelpMenu) { - HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell); + HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, docShell); mConstructed = true; } else { - MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell); + MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, docShell); mConstructed = true; } } @@ -557,7 +557,7 @@ nsEventStatus nsMenuX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * /* menuNode */, - void * aWebShell) + void * aDocShell) { mConstructed = false; gConstructingMenu = PR_TRUE; @@ -602,7 +602,7 @@ nsEventStatus nsMenuX::HelpMenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * /* menuNode */, - void * aWebShell) + void * aDocShell) { //printf("nsMenuX::MenuConstruct called for %s = %d \n", NS_LossyConvertUCS2toASCII(mLabel).get(), mMacMenuHandle); @@ -844,13 +844,13 @@ void nsMenuX::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent else if ( type.EqualsLiteral("radio") ) itemType = nsIMenuItem::eRadio; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return; // Create the item. pnsMenuItem->Create(inParentMenu, menuitemName, PR_FALSE, itemType, - enabled, mManager, webShell, inMenuItemContent); + enabled, mManager, docShell, inMenuItemContent); // // Set key shortcut and modifiers @@ -928,11 +928,11 @@ nsMenuX::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent ) nsCOMPtr pnsMenu ( do_CreateInstance(kMenuCID) ); if (pnsMenu) { // Call Create - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return; nsCOMPtr supports(do_QueryInterface(pParentMenu)); - pnsMenu->Create(supports, menuName, EmptyString(), mManager, webShell, inMenuItemContent); + pnsMenu->Create(supports, menuName, EmptyString(), mManager, docShell, inMenuItemContent); // set if it's enabled or disabled nsAutoString disabled; @@ -978,13 +978,13 @@ nsMenuX::OnCreate() nsCOMPtr popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return PR_FALSE; } nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext) ); if ( presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1061,13 +1061,13 @@ nsMenuX::OnCreated() nsCOMPtr popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return PR_FALSE; } nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext(DocShell, getter_AddRefs(presContext) ); if ( presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1094,9 +1094,9 @@ nsMenuX::OnDestroy() nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(NS_XUL_POPUP_HIDING); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_WARNING("No web shell so can't run the OnDestroy"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_WARNING("No doc shell so can't run the OnDestroy"); return PR_FALSE; } @@ -1104,7 +1104,7 @@ nsMenuX::OnDestroy() GetMenuPopupContent(getter_AddRefs(popupContent)); nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext (webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext (docShell, getter_AddRefs(presContext) ); if (presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1124,9 +1124,9 @@ nsMenuX::OnDestroyed() nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(NS_XUL_POPUP_HIDDEN); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_WARNING("No web shell so can't run the OnDestroy"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_WARNING("No doc shell so can't run the OnDestroy"); return PR_FALSE; } @@ -1134,7 +1134,7 @@ nsMenuX::OnDestroyed() GetMenuPopupContent(getter_AddRefs(popupContent)); nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext (webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext (docShell, getter_AddRefs(presContext) ); if (presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; diff --git a/mozilla/widget/src/cocoa/nsMenuX.h b/mozilla/widget/src/cocoa/nsMenuX.h index db64a29c14b..5ea7d83878a 100644 --- a/mozilla/widget/src/cocoa/nsMenuX.h +++ b/mozilla/widget/src/cocoa/nsMenuX.h @@ -76,14 +76,14 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); // nsIMenu Methods NS_IMETHOD Create ( nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) ; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) ; NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetLabel(const nsAString &aText); @@ -133,7 +133,7 @@ protected: void LoadSeparator ( nsIContent* menuitemContent ); nsEventStatus HelpMenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void* unused, void* aWebShell); + void* unused, void* aDocShell); MenuHandle NSStringNewMenu(short menuID, nsString& menuTitle); @@ -144,7 +144,7 @@ protected: nsISupports* mParent; // weak, my parent owns me nsIChangeManager* mManager; // weak ref, it will outlive us [menubar] - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsCOMPtr mMenuContent; // the |menu| tag, strong ref nsCOMPtr mListener; // strong ref diff --git a/mozilla/widget/src/mac/nsMenu.cpp b/mozilla/widget/src/mac/nsMenu.cpp index 21a21a3b31c..67749f5f105 100644 --- a/mozilla/widget/src/mac/nsMenu.cpp +++ b/mozilla/widget/src/mac/nsMenu.cpp @@ -203,9 +203,9 @@ nsMenu::~nsMenu() // NS_METHOD nsMenu::Create( nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) { - mWebShellWeakRef = do_GetWeakReference(aShell); + mDocShellWeakRef = do_GetWeakReference(aShell); mMenuContent = aNode; // register this menu to be notified when changes are made to our content object @@ -565,10 +565,10 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) // Now get the pres context so we can execute the command nsCOMPtr presContext; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return nsEventStatus_eConsumeNoDefault; - MenuHelpers::WebShellToPresContext(webShell, getter_AddRefs(presContext)); + MenuHelpers::DocShellToPresContext(docShell, getter_AddRefs(presContext)); nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event; @@ -712,17 +712,17 @@ nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent) if(mNeedsRebuild) RemoveAll(); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return nsEventStatus_eConsumeNoDefault; } if(mIsHelpMenu) { - HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell); + HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, docShell); mConstructed = true; } else { - MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell); + MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, docShell); mConstructed = true; } } @@ -769,7 +769,7 @@ nsEventStatus nsMenu::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * /* domNode */, - void * aWebShell) + void * aDocShell) { mConstructed = false; gConstructingMenu = PR_TRUE; @@ -817,7 +817,7 @@ nsEventStatus nsMenu::MenuConstruct( nsEventStatus nsMenu::HelpMenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void* /* unused */, void* aWebShell) + void* /* unused */, void* aDocShell) { //printf("nsMenu::MenuConstruct called for %s = %d \n", NS_LossyConvertUCS2toASCII(mLabel).get(), mMacMenuHandle); @@ -1031,13 +1031,13 @@ nsMenu::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent ) else if ( type.EqualsLiteral("radio") ) itemType = nsIMenuItem::eRadio; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return; // Create the item. pnsMenuItem->Create(inParentMenu, menuitemName, PR_FALSE, itemType, - enabled, mManager, webShell, inMenuItemContent); + enabled, mManager, docShell, inMenuItemContent); // // Set key shortcut and modifiers @@ -1116,11 +1116,11 @@ nsMenu::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent ) nsCOMPtr pnsMenu ( do_CreateInstance(kMenuCID) ); if (pnsMenu) { // Call Create - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return; nsCOMPtr supports(do_QueryInterface(pParentMenu)); - pnsMenu->Create(supports, menuName, EmptyString(), mManager, webShell, inMenuItemContent); + pnsMenu->Create(supports, menuName, EmptyString(), mManager, docShell, inMenuItemContent); // set if it's enabled or disabled nsAutoString disabled; @@ -1172,13 +1172,13 @@ nsMenu::OnCreate() nsCOMPtr popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return PR_FALSE; } nsCOMPtr presContext; - MenuHelpers::WebShellToPresContext(webShell, getter_AddRefs(presContext) ); + MenuHelpers::DocShellToPresContext(docShell, getter_AddRefs(presContext) ); if ( presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1262,13 +1262,13 @@ nsMenu::OnCreated() nsCOMPtr popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return PR_FALSE; } nsCOMPtr presContext; - MenuHelpers::WebShellToPresContext(webShell, getter_AddRefs(presContext) ); + MenuHelpers::DocShellToPresContext(docShell, getter_AddRefs(presContext) ); if ( presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1303,9 +1303,9 @@ nsMenu::OnDestroy() event.clickCount = 0; event.widget = nsnull; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_WARNING("No web shell so can't run the OnDestroy"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_WARNING("No doc shell so can't run the OnDestroy"); return PR_FALSE; } @@ -1313,7 +1313,7 @@ nsMenu::OnDestroy() GetMenuPopupContent(getter_AddRefs(popupContent)); nsCOMPtr presContext; - MenuHelpers::WebShellToPresContext (webShell, getter_AddRefs(presContext) ); + MenuHelpers::DocShellToPresContext (docShell, getter_AddRefs(presContext) ); if (presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1341,9 +1341,9 @@ nsMenu::OnDestroyed() event.clickCount = 0; event.widget = nsnull; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_WARNING("No web shell so can't run the OnDestroy"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_WARNING("No doc shell so can't run the OnDestroy"); return PR_FALSE; } @@ -1351,7 +1351,7 @@ nsMenu::OnDestroyed() GetMenuPopupContent(getter_AddRefs(popupContent)); nsCOMPtr presContext; - MenuHelpers::WebShellToPresContext (webShell, getter_AddRefs(presContext) ); + MenuHelpers::DocShellToPresContext (docShell, getter_AddRefs(presContext) ); if (presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; diff --git a/mozilla/widget/src/mac/nsMenu.h b/mozilla/widget/src/mac/nsMenu.h index 7a9c228e656..d89e8870085 100644 --- a/mozilla/widget/src/mac/nsMenu.h +++ b/mozilla/widget/src/mac/nsMenu.h @@ -82,14 +82,14 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void* unused, void * aWebShell); + void* unused, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); // nsIMenu Methods NS_IMETHOD Create ( nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) ; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) ; NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetLabel(const nsAString &aText); @@ -130,7 +130,7 @@ protected: nsISupports* mParent; // weak, my parent owns me nsIChangeManager* mManager; // weak ref, it will outlive us - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsCOMPtr mMenuContent; // the |menu| tag, strong ref nsCOMPtr mListener; @@ -162,7 +162,7 @@ protected: void LoadSubMenu( nsIMenu * pParentMenu, nsIContent* menuitemContent); void LoadSeparator ( nsIContent* menuitemContent ); nsEventStatus HelpMenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void* unused, void* aWebShell); + void* unused, void* aDocShell); MenuHandle NSStringNewMenu(short menuID, nsString& menuTitle); diff --git a/mozilla/widget/src/mac/nsMenuBar.cpp b/mozilla/widget/src/mac/nsMenuBar.cpp index 38bdda511da..752520f4498 100644 --- a/mozilla/widget/src/mac/nsMenuBar.cpp +++ b/mozilla/widget/src/mac/nsMenuBar.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ + /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -252,14 +252,13 @@ nsMenuBar::SetRebuild(PRBool aNeedsRebuild) } void -nsMenuBar :: GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) +nsMenuBar :: GetDocument ( nsIDocShell* inDocShell, nsIDocument** outDocument ) { *outDocument = nsnull; - nsCOMPtr docShell ( do_QueryInterface(inWebShell) ); - nsCOMPtr cv; - if ( docShell ) { - docShell->GetContentViewer(getter_AddRefs(cv)); + if ( inDocShell ) { + nsCOMPtr cv; + inDocShell->GetContentViewer(getter_AddRefs(cv)); if (cv) { // get the document nsCOMPtr docv(do_QueryInterface(cv)); @@ -277,17 +276,17 @@ nsMenuBar :: GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) // Name says it all. // void -nsMenuBar :: RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) +nsMenuBar :: RegisterAsDocumentObserver ( nsIDocShell* inDocShell ) { nsCOMPtr doc; - GetDocument(inWebShell, getter_AddRefs(doc)); + GetDocument(inDocShell, getter_AddRefs(doc)); if (!doc) return; // register ourselves nsCOMPtr observer ( do_QueryInterface(NS_STATIC_CAST(nsIMenuBar*,this)) ); doc->AddObserver(observer); - // also get pointer to doc, just in case webshell goes away + // also get pointer to doc, just in case docshell goes away // we can still remove ourself as doc observer directly from doc mDocument = doc; @@ -296,9 +295,9 @@ nsMenuBar :: RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) nsEventStatus nsMenuBar::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void * menubarNode, void * aWebShell ) + void * menubarNode, void * aDocShell ) { - mWebShellWeakRef = do_GetWeakReference(NS_STATIC_CAST(nsIWebShell*, aWebShell)); + mDocShellWeakRef = do_GetWeakReference(NS_STATIC_CAST(nsIDocShell*, aDocShell)); nsIDOMNode* aDOMNode = NS_STATIC_CAST(nsIDOMNode*, menubarNode); mMenuBarContent = do_QueryInterface(aDOMNode); // strong ref @@ -363,9 +362,9 @@ nsMenuBar::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWind Create(aParentWindow); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (webShell) - RegisterAsDocumentObserver(webShell); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (docShell) + RegisterAsDocumentObserver(docShell); // set this as a nsMenuListener on aParentWindow aParentWindow->AddMenuListener((nsIMenuListener *)this); @@ -388,7 +387,7 @@ nsMenuBar::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWind if ( pnsMenu ) { pnsMenu->Create(NS_STATIC_CAST(nsIMenuBar*, this), menuName, menuAccessKey, NS_STATIC_CAST(nsIChangeManager *, this), - NS_REINTERPRET_CAST(nsIWebShell*, aWebShell), menu); + NS_REINTERPRET_CAST(nsIDocShell*, aDocShell), menu); // Make nsMenu a child of nsMenuBar. nsMenuBar takes ownership AddMenu(pnsMenu); @@ -868,25 +867,23 @@ MenuHelpers :: ConvertToScriptRun ( const nsString & inStr, const UnicodeToTextR // -// WebShellToPresContext +// DocShellToPresContext // -// Helper to dig out a pres context from a webshell. A common thing to do before +// Helper to dig out a pres context from a docshell. A common thing to do before // sending an event into the dom. // nsresult -MenuHelpers :: WebShellToPresContext (nsIWebShell* inWebShell, nsPresContext** outContext ) +MenuHelpers :: DocShellToPresContext (nsIDocShell* inDocShell, nsPresContext** outContext ) { NS_ENSURE_ARG_POINTER(outContext); *outContext = nsnull; - if (!inWebShell) + if (!inDocShell) return NS_ERROR_INVALID_ARG; nsresult retval = NS_OK; - nsCOMPtr docShell(do_QueryInterface(inWebShell)); - nsCOMPtr contentViewer; - docShell->GetContentViewer(getter_AddRefs(contentViewer)); + inDocShell->GetContentViewer(getter_AddRefs(contentViewer)); if ( contentViewer ) { nsCOMPtr docViewer ( do_QueryInterface(contentViewer) ); if ( docViewer ) @@ -899,7 +896,7 @@ MenuHelpers :: WebShellToPresContext (nsIWebShell* inWebShell, nsPresContext** o return retval; -} // WebShellToPresContext +} // DocShellToPresContext diff --git a/mozilla/widget/src/mac/nsMenuBar.h b/mozilla/widget/src/mac/nsMenuBar.h index 502cbfe78af..89d7329e6d7 100644 --- a/mozilla/widget/src/mac/nsMenuBar.h +++ b/mozilla/widget/src/mac/nsMenuBar.h @@ -59,8 +59,8 @@ class nsIDocument; namespace MenuHelpers { - // utility routine for getting a PresContext out of a webShell - nsresult WebShellToPresContext ( nsIWebShell* inWebShell, nsPresContext** outContext ) ; + // utility routine for getting a PresContext out of a docShell + nsresult DocShellToPresContext ( nsIDocShell* inDocShell, nsPresContext** outContext ) ; // utility routine for handling unicode->OS text conversions for setting the item // text in a menu. @@ -98,7 +98,7 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void* aDOMNode, void * aWebShell); + void* aDOMNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); @@ -123,8 +123,8 @@ public: protected: - void GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) ; - void RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) ; + void GetDocument ( nsIDocShell* inDocShell, nsIDocument** outDocument ) ; + void RegisterAsDocumentObserver ( nsIDocShell* inDocShell ) ; nsHashtable mObserverTable; // stores observers for content change notification @@ -135,7 +135,7 @@ protected: PRBool mIsMenuBarAdded; - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsIDocument * mDocument; // pointer to doc // Mac Specific diff --git a/mozilla/widget/src/mac/nsMenuBarX.cpp b/mozilla/widget/src/mac/nsMenuBarX.cpp index 8c7bd2b61fb..e488a8424c6 100644 --- a/mozilla/widget/src/mac/nsMenuBarX.cpp +++ b/mozilla/widget/src/mac/nsMenuBarX.cpp @@ -202,14 +202,13 @@ nsMenuBarX::SetRebuild(PRBool aNeedsRebuild) } void -nsMenuBarX :: GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) +nsMenuBarX :: GetDocument ( nsIDocShell* inDocShell, nsIDocument** outDocument ) { *outDocument = nsnull; - nsCOMPtr docShell ( do_QueryInterface(inWebShell) ); - nsCOMPtr cv; - if ( docShell ) { - docShell->GetContentViewer(getter_AddRefs(cv)); + if ( inDocShell ) { + nsCOMPtr cv; + inDocShell->GetContentViewer(getter_AddRefs(cv)); if (cv) { // get the document nsCOMPtr docv(do_QueryInterface(cv)); @@ -227,17 +226,17 @@ nsMenuBarX :: GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) // Name says it all. // void -nsMenuBarX :: RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) +nsMenuBarX :: RegisterAsDocumentObserver ( nsIDocShell* inDocShell ) { nsCOMPtr doc; - GetDocument(inWebShell, getter_AddRefs(doc)); + GetDocument(inDocShell, getter_AddRefs(doc)); if (!doc) return; // register ourselves nsCOMPtr observer ( do_QueryInterface(NS_STATIC_CAST(nsIMenuBar*,this)) ); doc->AddObserver(observer); - // also get pointer to doc, just in case webshell goes away + // also get pointer to doc, just in case docshell goes away // we can still remove ourself as doc observer directly from doc mDocument = doc; } // RegisterAsDocumentObesrver @@ -415,7 +414,7 @@ nsMenuBarX :: ExecuteCommand ( nsIContent* inDispatchTo ) if (!inDispatchTo) return nsEventStatus_eIgnore; - return MenuHelpersX::DispatchCommandTo(mWebShellWeakRef, inDispatchTo); + return MenuHelpersX::DispatchCommandTo(mDocShellWeakRef, inDispatchTo); } // ExecuteCommand @@ -445,9 +444,9 @@ nsMenuBarX :: HideItem ( nsIDOMDocument* inDoc, const nsAString & inID, nsIConte nsEventStatus nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void * menubarNode, void * aWebShell ) + void * menubarNode, void * aDocShell ) { - mWebShellWeakRef = do_GetWeakReference(NS_STATIC_CAST(nsIWebShell*, aWebShell)); + mDocShellWeakRef = do_GetWeakReference(NS_STATIC_CAST(nsIDocShell*, aDocShell)); nsIDOMNode* aDOMNode = NS_STATIC_CAST(nsIDOMNode*, menubarNode); mMenuBarContent = do_QueryInterface(aDOMNode); // strong ref NS_ASSERTION ( mMenuBarContent, "No content specified for this menubar" ); @@ -466,8 +465,8 @@ nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWin if ( err ) return nsEventStatus_eIgnore; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (webShell) RegisterAsDocumentObserver(webShell); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (docShell) RegisterAsDocumentObserver(docShell); // set this as a nsMenuListener on aParentWindow aParentWindow->AddMenuListener((nsIMenuListener *)this); @@ -490,7 +489,7 @@ nsMenuBarX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWin if ( pnsMenu ) { pnsMenu->Create(NS_STATIC_CAST(nsIMenuBar*, this), menuName, menuAccessKey, NS_STATIC_CAST(nsIChangeManager *, this), - NS_REINTERPRET_CAST(nsIWebShell*, aWebShell), menu); + NS_REINTERPRET_CAST(nsIDocShell*, aDocShell), menu); // Make nsMenu a child of nsMenuBar. nsMenuBar takes ownership AddMenu(pnsMenu); @@ -935,25 +934,23 @@ nsMenuBarX :: Unregister ( PRUint32 inCommandID ) // -// WebShellToPresContext +// DocShellToPresContext // -// Helper to dig out a pres context from a webshell. A common thing to do before +// Helper to dig out a pres context from a docshell. A common thing to do before // sending an event into the dom. // nsresult -MenuHelpersX::WebShellToPresContext (nsIWebShell* inWebShell, nsPresContext** outContext ) +MenuHelpersX::DocShellToPresContext (nsIDocShell* inDocShell, nsPresContext** outContext ) { NS_ENSURE_ARG_POINTER(outContext); *outContext = nsnull; - if (!inWebShell) + if (!inDocShell) return NS_ERROR_INVALID_ARG; nsresult retval = NS_OK; - nsCOMPtr docShell(do_QueryInterface(inWebShell)); - nsCOMPtr contentViewer; - docShell->GetContentViewer(getter_AddRefs(contentViewer)); + inDocShell->GetContentViewer(getter_AddRefs(contentViewer)); if ( contentViewer ) { nsCOMPtr docViewer ( do_QueryInterface(contentViewer) ); if ( docViewer ) @@ -966,19 +963,19 @@ MenuHelpersX::WebShellToPresContext (nsIWebShell* inWebShell, nsPresContext** ou return retval; -} // WebShellToPresContext +} // DocShellToPresContext nsEventStatus -MenuHelpersX::DispatchCommandTo(nsIWeakReference* aWebShellWeakRef, +MenuHelpersX::DispatchCommandTo(nsIWeakReference* aDocShellWeakRef, nsIContent* aTargetContent) { NS_PRECONDITION(aTargetContent, "null ptr"); - nsCOMPtr webShell = do_QueryReferent(aWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(aDocShellWeakRef); + if (!docShell) return nsEventStatus_eConsumeNoDefault; nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext)); + MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext)); nsEventStatus status = nsEventStatus_eConsumeNoDefault; nsMouseEvent event(NS_XUL_COMMAND); diff --git a/mozilla/widget/src/mac/nsMenuBarX.h b/mozilla/widget/src/mac/nsMenuBarX.h index 8660f4cb1d1..bc5515a9640 100644 --- a/mozilla/widget/src/mac/nsMenuBarX.h +++ b/mozilla/widget/src/mac/nsMenuBarX.h @@ -63,9 +63,9 @@ class nsIDOMNode; namespace MenuHelpersX { - // utility routine for getting a PresContext out of a webShell - nsresult WebShellToPresContext ( nsIWebShell* inWebShell, nsPresContext** outContext ) ; - nsEventStatus DispatchCommandTo(nsIWeakReference* aWebShellWeakRef, + // utility routine for getting a PresContext out of a docShell + nsresult DocShellToPresContext ( nsIDocShell* inDocShell, nsPresContext** outContext ) ; + nsEventStatus DispatchCommandTo(nsIWeakReference* aDocShellWeakRef, nsIContent* aTargetContent); } @@ -97,7 +97,7 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); @@ -122,8 +122,8 @@ public: protected: - void GetDocument ( nsIWebShell* inWebShell, nsIDocument** outDocument ) ; - void RegisterAsDocumentObserver ( nsIWebShell* inWebShell ) ; + void GetDocument ( nsIDocShell* inDocShell, nsIDocument** outDocument ) ; + void RegisterAsDocumentObserver ( nsIDocShell* inDocShell ) ; // Make our menubar conform to Aqua UI guidelines void AquifyMenuBar ( ) ; @@ -152,7 +152,7 @@ protected: PRUint32 mCurrentCommandID; // unique command id (per menu-bar) to give to next item that asks - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsIDocument* mDocument; // pointer to document MenuRef mRootMenu; // root menu, representing entire menu bar. diff --git a/mozilla/widget/src/mac/nsMenuItem.cpp b/mozilla/widget/src/mac/nsMenuItem.cpp index 3a8570bc1bb..2027351e138 100644 --- a/mozilla/widget/src/mac/nsMenuItem.cpp +++ b/mozilla/widget/src/mac/nsMenuItem.cpp @@ -96,11 +96,11 @@ nsMenuItem::~nsMenuItem() NS_METHOD nsMenuItem::Create ( nsIMenu* aParent, const nsString & aLabel, PRBool aIsSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) { mContent = aNode; // addref mMenuParent = aParent; // weak - mWebShellWeakRef = do_GetWeakReference(aShell); + mDocShellWeakRef = do_GetWeakReference(aShell); mEnabled = aEnabled; mMenuType = aItemType; @@ -248,7 +248,7 @@ nsEventStatus nsMenuItem::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * menuNode, - void * aWebShell) + void * aDocShell) { return nsEventStatus_eIgnore; } @@ -283,10 +283,10 @@ NS_METHOD nsMenuItem::DoCommand() nsresult rv = NS_ERROR_FAILURE; nsCOMPtr presContext; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return nsEventStatus_eConsumeNoDefault; - MenuHelpers::WebShellToPresContext(webShell, getter_AddRefs(presContext)); + MenuHelpers::DocShellToPresContext(docShell, getter_AddRefs(presContext)); nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event; diff --git a/mozilla/widget/src/mac/nsMenuItem.h b/mozilla/widget/src/mac/nsMenuItem.h index f7d1892adcb..5123b1acfe4 100644 --- a/mozilla/widget/src/mac/nsMenuItem.h +++ b/mozilla/widget/src/mac/nsMenuItem.h @@ -69,7 +69,7 @@ public: // nsIMenuItem Methods NS_IMETHOD Create ( nsIMenu* aParent, const nsString & aLabel, PRBool aIsSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) ; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) ; NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetShortcutChar(const nsString &aText); NS_IMETHOD GetShortcutChar(nsString &aText); @@ -92,7 +92,7 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); @@ -110,7 +110,7 @@ protected: nsCOMPtr mTarget; // never set? nsCOMPtr mXULCommandListener; - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsCOMPtr mContent; PRUint8 mModifiers; diff --git a/mozilla/widget/src/mac/nsMenuItemX.cpp b/mozilla/widget/src/mac/nsMenuItemX.cpp index f888f17870c..3936729fba8 100644 --- a/mozilla/widget/src/mac/nsMenuItemX.cpp +++ b/mozilla/widget/src/mac/nsMenuItemX.cpp @@ -95,11 +95,11 @@ nsMenuItemX::~nsMenuItemX() NS_METHOD nsMenuItemX::Create ( nsIMenu* aParent, const nsString & aLabel, PRBool aIsSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) { mContent = aNode; // addref mMenuParent = aParent; // weak - mWebShellWeakRef = do_GetWeakReference(aShell); + mDocShellWeakRef = do_GetWeakReference(aShell); mEnabled = aEnabled; mMenuType = aItemType; @@ -226,7 +226,7 @@ nsEventStatus nsMenuItemX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * menuNode, - void * aWebShell) + void * aDocShell) { return nsEventStatus_eIgnore; } @@ -267,7 +267,7 @@ NS_METHOD nsMenuItemX::DoCommand() /* the AttributeChanged code will update all the internal state */ } - return MenuHelpersX::DispatchCommandTo(mWebShellWeakRef, mContent); + return MenuHelpersX::DispatchCommandTo(mDocShellWeakRef, mContent); } diff --git a/mozilla/widget/src/mac/nsMenuItemX.h b/mozilla/widget/src/mac/nsMenuItemX.h index c3eac6d83bb..ca05e3af3f2 100644 --- a/mozilla/widget/src/mac/nsMenuItemX.h +++ b/mozilla/widget/src/mac/nsMenuItemX.h @@ -68,7 +68,7 @@ public: // nsIMenuItem Methods NS_IMETHOD Create ( nsIMenu* aParent, const nsString & aLabel, PRBool aIsSeparator, EMenuItemType aItemType, PRBool aEnabled, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) ; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) ; NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetShortcutChar(const nsString &aText); NS_IMETHOD GetShortcutChar(nsString &aText); @@ -91,7 +91,7 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct(const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); @@ -109,7 +109,7 @@ protected: nsCOMPtr mTarget; // never set? nsCOMPtr mXULCommandListener; - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsCOMPtr mContent; PRUint8 mModifiers; diff --git a/mozilla/widget/src/mac/nsMenuX.cpp b/mozilla/widget/src/mac/nsMenuX.cpp index 123d800219c..b2a3bc942f0 100644 --- a/mozilla/widget/src/mac/nsMenuX.cpp +++ b/mozilla/widget/src/mac/nsMenuX.cpp @@ -154,9 +154,9 @@ nsMenuX::~nsMenuX() // NS_METHOD nsMenuX::Create(nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) { - mWebShellWeakRef = do_GetWeakReference(aShell); + mDocShellWeakRef = do_GetWeakReference(aShell); mMenuContent = aNode; // register this menu to be notified when changes are made to our content object @@ -510,16 +510,16 @@ nsEventStatus nsMenuX::MenuSelected(const nsMenuEvent & aMenuEvent) if (mNeedsRebuild) RemoveAll(); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return nsEventStatus_eConsumeNoDefault; } if (mIsHelpMenu) { - HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell); + HelpMenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, docShell); mConstructed = true; } else { - MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, webShell); + MenuConstruct(aMenuEvent, nsnull /* mParentWindow */, nsnull, docShell); mConstructed = true; } } @@ -563,7 +563,7 @@ nsEventStatus nsMenuX::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * /* menuNode */, - void * aWebShell) + void * aDocShell) { mConstructed = false; gConstructingMenu = PR_TRUE; @@ -608,7 +608,7 @@ nsEventStatus nsMenuX::HelpMenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * /* menuNode */, - void * aWebShell) + void * aDocShell) { //printf("nsMenuX::MenuConstruct called for %s = %d \n", NS_LossyConvertUCS2toASCII(mLabel).get(), mMacMenuHandle); @@ -856,13 +856,13 @@ void nsMenuX::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent else if ( type.EqualsLiteral("radio") ) itemType = nsIMenuItem::eRadio; - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return; // Create the item. pnsMenuItem->Create(inParentMenu, menuitemName, PR_FALSE, itemType, - enabled, mManager, webShell, inMenuItemContent); + enabled, mManager, docShell, inMenuItemContent); // // Set key shortcut and modifiers @@ -940,11 +940,11 @@ nsMenuX::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent ) nsCOMPtr pnsMenu ( do_CreateInstance(kMenuCID) ); if (pnsMenu) { // Call Create - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) return; nsCOMPtr supports(do_QueryInterface(pParentMenu)); - pnsMenu->Create(supports, menuName, EmptyString(), mManager, webShell, inMenuItemContent); + pnsMenu->Create(supports, menuName, EmptyString(), mManager, docShell, inMenuItemContent); // set if it's enabled or disabled nsAutoString disabled; @@ -990,13 +990,13 @@ nsMenuX::OnCreate() nsCOMPtr popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return PR_FALSE; } nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext) ); if ( presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1072,13 +1072,13 @@ nsMenuX::OnCreated() nsCOMPtr popupContent; GetMenuPopupContent(getter_AddRefs(popupContent)); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_ERROR("No web shell"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_ERROR("No doc shell"); return PR_FALSE; } nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext(webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext) ); if ( presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1105,9 +1105,9 @@ nsMenuX::OnDestroy() nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(NS_XUL_POPUP_HIDING); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_WARNING("No web shell so can't run the OnDestroy"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_WARNING("No doc shell so can't run the OnDestroy"); return PR_FALSE; } @@ -1115,7 +1115,7 @@ nsMenuX::OnDestroy() GetMenuPopupContent(getter_AddRefs(popupContent)); nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext (webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext (docShell, getter_AddRefs(presContext) ); if (presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; @@ -1135,9 +1135,9 @@ nsMenuX::OnDestroyed() nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event(NS_XUL_POPUP_HIDDEN); - nsCOMPtr webShell = do_QueryReferent(mWebShellWeakRef); - if (!webShell) { - NS_WARNING("No web shell so can't run the OnDestroy"); + nsCOMPtr docShell = do_QueryReferent(mDocShellWeakRef); + if (!docShell) { + NS_WARNING("No doc shell so can't run the OnDestroy"); return PR_FALSE; } @@ -1145,7 +1145,7 @@ nsMenuX::OnDestroyed() GetMenuPopupContent(getter_AddRefs(popupContent)); nsCOMPtr presContext; - MenuHelpersX::WebShellToPresContext (webShell, getter_AddRefs(presContext) ); + MenuHelpersX::DocShellToPresContext (docShell, getter_AddRefs(presContext) ); if (presContext ) { nsresult rv = NS_OK; nsIContent* dispatchTo = popupContent ? popupContent : mMenuContent; diff --git a/mozilla/widget/src/mac/nsMenuX.h b/mozilla/widget/src/mac/nsMenuX.h index db64a29c14b..5ea7d83878a 100644 --- a/mozilla/widget/src/mac/nsMenuX.h +++ b/mozilla/widget/src/mac/nsMenuX.h @@ -76,14 +76,14 @@ public: nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent); nsEventStatus MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, - void * menuNode, void * aWebShell); + void * menuNode, void * aDocShell); nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent); nsEventStatus CheckRebuild(PRBool & aMenuEvent); nsEventStatus SetRebuild(PRBool aMenuEvent); // nsIMenu Methods NS_IMETHOD Create ( nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, - nsIChangeManager* aManager, nsIWebShell* aShell, nsIContent* aNode ) ; + nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) ; NS_IMETHOD GetParent(nsISupports *&aParent); NS_IMETHOD GetLabel(nsString &aText); NS_IMETHOD SetLabel(const nsAString &aText); @@ -133,7 +133,7 @@ protected: void LoadSeparator ( nsIContent* menuitemContent ); nsEventStatus HelpMenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow, - void* unused, void* aWebShell); + void* unused, void* aDocShell); MenuHandle NSStringNewMenu(short menuID, nsString& menuTitle); @@ -144,7 +144,7 @@ protected: nsISupports* mParent; // weak, my parent owns me nsIChangeManager* mManager; // weak ref, it will outlive us [menubar] - nsWeakPtr mWebShellWeakRef; // weak ref to webshell + nsWeakPtr mDocShellWeakRef; // weak ref to docshell nsCOMPtr mMenuContent; // the |menu| tag, strong ref nsCOMPtr mListener; // strong ref diff --git a/mozilla/xpcom/tests/SizeTest06.cpp b/mozilla/xpcom/tests/SizeTest06.cpp index 2c28e7f3282..bfc0b97f189 100644 --- a/mozilla/xpcom/tests/SizeTest06.cpp +++ b/mozilla/xpcom/tests/SizeTest06.cpp @@ -2,14 +2,11 @@ #include "nsIDOMWindowInternal.h" #include "nsIScriptGlobalObject.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIWebShellWindow.h" #include "nsCOMPtr.h" NS_DEF_PTR(nsIScriptGlobalObject); -NS_DEF_PTR(nsIWebShell); -NS_DEF_PTR(nsIWebShellContainer); NS_DEF_PTR(nsIWebShellWindow); /* @@ -48,23 +45,8 @@ Test06_raw(nsIDOMWindowInternal* aDOMWindow, nsIWebShellWindow** aWebShellWindow nsIDocShell* docShell = 0; if (scriptGlobalObject) scriptGlobalObject->GetDocShell(&docShell); - nsIWebShell* webShell = 0; - if (docShell) - status=docShell->QueryInterface(NS_GET_IID(nsIWebShell), (void**)&webShell); nsIWebShell* rootWebShell = 0; - if (webShell) - //status = webShell->GetRootWebShellEvenIfChrome(rootWebShell); - {} - nsIWebShellContainer* webShellContainer = 0; - if (rootWebShell) - status = rootWebShell->GetContainer(webShellContainer); - if (webShellContainer) - status = webShellContainer->QueryInterface(NS_GET_IID(nsIWebShellWindow), (void**)aWebShellWindow); - else - (*aWebShellWindow) = 0; - NS_IF_RELEASE(webShellContainer); NS_IF_RELEASE(rootWebShell); - NS_IF_RELEASE(webShell); NS_IF_RELEASE(docShell); NS_IF_RELEASE(scriptGlobalObject); // return status; @@ -83,22 +65,6 @@ Test06_raw_optimized(nsIDOMWindowInternal* aDOMWindow, nsIWebShellWindow** aWebS nsIDocShell* docShell = 0; scriptGlobalObject->GetDocShell(&docShell); if (docShell) { - nsIWebShell* webShell = 0; - docShell->QueryInterface(NS_GET_IID(nsIWebShell), (void**)webShell); - if (webShell) { - nsIWebShell* rootWebShell; - // status = webShell->GetRootWebShellEvenIfChrome(rootWebShell); - if (NS_SUCCEEDED(status)) { - nsIWebShellContainer* webShellContainer; - status = rootWebShell->GetContainer(webShellContainer); - if (NS_SUCCEEDED(status)) { - status = webShellContainer->QueryInterface(NS_GET_IID(nsIWebShellWindow), (void**)aWebShellWindow); - NS_RELEASE(webShellContainer); - } - NS_RELEASE(rootWebShell); - } - NS_RELEASE(webShell); - } NS_RELEASE(docShell); } NS_RELEASE(scriptGlobalObject); @@ -116,17 +82,6 @@ Test06_nsCOMPtr_as_found(nsIDOMWindowInternal* aDOMWindow, nsCOMPtr docShell; if (scriptGlobalObject) scriptGlobalObject->GetDocShell(getter_AddRefs(docShell)); - nsCOMPtr webShell; - if (docShell) - webShell = do_QueryInterface(docShell); - nsCOMPtr rootWebShell; - if (webShell) - //webShell->GetRootWebShellEvenIfChrome(*getter_AddRefs(rootWebShell)); - {} - nsCOMPtr webShellContainer; - if (rootWebShell) - rootWebShell->GetContainer(*getter_AddRefs(webShellContainer)); - (*aWebShellWindow) = do_QueryInterface(webShellContainer); } void // nsresult @@ -141,17 +96,7 @@ Test06_nsCOMPtr00(nsIDOMWindowInternal* aDOMWindow, nsIWebShellWindow** aWebShel if (scriptGlobalObject) scriptGlobalObject->GetDocShell(&temp0); nsCOMPtr docShell = dont_AddRef(temp0); - nsCOMPtr webShell; - if (docShell) - webShell=do_QueryInterface(docShell, &status); - nsIWebShellContainer* temp2 = 0; - if (webShell) - status = webShell->GetContainer(temp2); - nsCOMPtr webShellContainer = dont_AddRef(temp2); - if (webShellContainer) - status = webShellContainer->QueryInterface(NS_GET_IID(nsIWebShellWindow), (void**)aWebShellWindow); - else - (*aWebShellWindow) = 0; + (*aWebShellWindow) = 0; // return status; } @@ -166,17 +111,7 @@ Test06_nsCOMPtr_optimized(nsIDOMWindowInternal* aDOMWindow, nsCOMPtrGetDocShell(&temp0); - nsCOMPtr webShell = do_QueryInterface(temp0, &status); - nsIWebShell* temp2 = 0; - if (webShell) - // status = webShell->GetRootWebShellEvenIfChrome(temp2); - {} - nsCOMPtr rootWebShell = dont_AddRef(temp2); - nsIWebShellContainer* temp3 = 0; - if (rootWebShell) - status = rootWebShell->GetContainer(temp3); - nsCOMPtr webShellContainer = dont_AddRef(temp3); - (*aWebShellWindow) = do_QueryInterface(webShellContainer, &status); + (*aWebShellWindow) = do_QueryInterface(nsnull, &status); // return status; } @@ -192,14 +127,6 @@ Test06_nsCOMPtr02(nsIDOMWindowInternal* aDOMWindow, nsIWebShellWindow** aWebShel if (scriptGlobalObject) { nsIDocShell* temp0; scriptGlobalObject->GetDocShell(&temp0); - nsCOMPtr webShell = do_QueryInterface(temp0); - if (webShell) { - nsIWebShellContainer* temp2; - status = webShell->GetContainer(temp2); - nsCOMPtr webShellContainer = dont_AddRef(temp2); - if (webShellContainer) - status = webShellContainer->QueryInterface(NS_GET_IID(nsIWebShellWindow), (void**)aWebShellWindow); - } } // return status; } @@ -218,13 +145,6 @@ Test06_nsCOMPtr03(nsIDOMWindowInternal* aDOMWindow, nsCOMPtr* scriptGlobalObject->GetDocShell(&temp0); nsCOMPtr docShell = dont_AddRef(temp0); if (docShell) { - nsCOMPtr webShell = do_QueryInterface(docShell, &status); - if (webShell) { - nsIWebShellContainer* temp2; - status = webShell->GetContainer(temp2); - nsCOMPtr webShellContainer = dont_AddRef(temp2); - (*aWebShellWindow) = do_QueryInterface(webShellContainer, &status); - } } } // return status; diff --git a/mozilla/xpfe/appshell/public/nsIWebShellWindow.h b/mozilla/xpfe/appshell/public/nsIWebShellWindow.h index 820bcf09b8a..ea9a95a0cbc 100644 --- a/mozilla/xpfe/appshell/public/nsIWebShellWindow.h +++ b/mozilla/xpfe/appshell/public/nsIWebShellWindow.h @@ -41,7 +41,7 @@ #include "nsISupports.h" /* Forward declarations.... */ -class nsIWebShell; +class nsIDocShell; class nsIWidget; class nsString; class nsIDOMWindowInternal; @@ -55,15 +55,18 @@ class nsIWebShellWindow : public nsISupports public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWEBSHELL_WINDOW_IID) + // XXXbz why do we need Show()? This should probably inherit from + // nsIBaseWindow in a reasonable way and use nsIBaseWindow::SetVisibility + // (that's what it ends up doing anyway.....) NS_IMETHOD Show(PRBool aShow) = 0; NS_IMETHOD ShowModal() = 0; NS_IMETHOD Toolbar() = 0; NS_IMETHOD Close() = 0; - NS_IMETHOD GetWebShell(nsIWebShell *& aWebShell) = 0; - NS_IMETHOD GetContentWebShell(nsIWebShell **aResult) = 0; + NS_IMETHOD GetDocShell(nsIDocShell *& aDocShell) = 0; + NS_IMETHOD GetContentDocShell(nsIDocShell **aResult) = 0; NS_IMETHOD GetWidget(nsIWidget *& aWidget) = 0; NS_IMETHOD GetDOMWindow(nsIDOMWindowInternal** aDOMWindow) = 0; - NS_IMETHOD ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindowInternal** aDOMWindow) = 0; + NS_IMETHOD ConvertDocShellToDOMWindow(nsIDocShell* aShell, nsIDOMWindowInternal** aDOMWindow) = 0; NS_IMETHOD LockUntilChromeLoad() = 0; NS_IMETHOD GetLockedState(PRBool& aResult) = 0; diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index ea7531070ec..98dbcf927b6 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -141,7 +141,6 @@ /* Define Class IDs */ static NS_DEFINE_CID(kWindowCID, NS_WINDOW_CID); -static NS_DEFINE_CID(kWebShellCID, NS_WEB_SHELL_CID); #include "nsWidgetsCID.h" static NS_DEFINE_CID(kMenuBarCID, NS_MENUBAR_CID); @@ -153,8 +152,6 @@ static NS_DEFINE_CID(kMenuItemCID, NS_MENUITEM_CID); #define DEBUG_MENUSDEL 1 #endif -#include "nsIWebShell.h" - #define SIZE_PERSISTENCE_TIMEOUT 500 // msec struct ThreadedWindowEvent { @@ -162,30 +159,8 @@ struct ThreadedWindowEvent { nsWebShellWindow *window; }; -// The web shell info object is used to hold information about content areas that will -// subsequently be filled in when we receive a webshell added notification. -struct nsWebShellInfo { - nsString id; // The identifier of the iframe or frame node in the XUL tree. - PRBool primary; // whether it's considered a/the primary content - nsIWebShell* child; // The child web shell that will end up being used for the content area. - - nsWebShellInfo(const nsString& anID, PRBool aPrimary, nsIWebShell* aChildShell) - { - id = anID; - primary = aPrimary; - child = aChildShell; - NS_IF_ADDREF(aChildShell); - } - - ~nsWebShellInfo() - { - NS_IF_RELEASE(child); - } -}; - nsWebShellWindow::nsWebShellWindow() : nsXULWindow() { - mWebShell = nsnull; mWindow = nsnull; mLockedUntilChromeLoad = PR_FALSE; mIntrinsicallySized = PR_FALSE; @@ -197,12 +172,6 @@ nsWebShellWindow::nsWebShellWindow() : nsXULWindow() nsWebShellWindow::~nsWebShellWindow() { - if (nsnull != mWebShell) { - nsCOMPtr shellAsWin(do_QueryInterface(mWebShell)); - shellAsWin->Destroy(); - NS_RELEASE(mWebShell); - } - if (mWindow) mWindow->SetClientData(0); mWindow = nsnull; // Force release here. @@ -216,19 +185,14 @@ nsWebShellWindow::~nsWebShellWindow() } } -NS_IMPL_THREADSAFE_ADDREF(nsWebShellWindow) -NS_IMPL_THREADSAFE_RELEASE(nsWebShellWindow) +NS_IMPL_ADDREF_INHERITED(nsWebShellWindow, nsXULWindow) +NS_IMPL_RELEASE_INHERITED(nsWebShellWindow, nsXULWindow) NS_INTERFACE_MAP_BEGIN(nsWebShellWindow) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebShellContainer) NS_INTERFACE_MAP_ENTRY(nsIWebShellWindow) - NS_INTERFACE_MAP_ENTRY(nsIWebShellContainer) NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) - NS_INTERFACE_MAP_ENTRY(nsIXULWindow) - NS_INTERFACE_MAP_ENTRY(nsIBaseWindow) - NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) -NS_INTERFACE_MAP_END + NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver) +NS_INTERFACE_MAP_END_INHERITING(nsXULWindow) nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent, nsIAppShell* aShell, nsIURI* aUrl, @@ -284,17 +248,14 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent, mWindow->SetBackgroundColor(NS_RGB(192,192,192)); // Create web shell - mDocShell = do_CreateInstance(kWebShellCID); + mDocShell = do_CreateInstance("@mozilla.org/webshell;1"); NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); - CallQueryInterface(mDocShell, &mWebShell); - NS_ENSURE_TRUE(mWebShell, NS_ERROR_FAILURE); r.x = r.y = 0; nsCOMPtr docShellAsWin(do_QueryInterface(mDocShell)); NS_ENSURE_SUCCESS(docShellAsWin->InitWindow(nsnull, mWindow, r.x, r.y, r.width, r.height), NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(docShellAsWin->Create(), NS_ERROR_FAILURE); - mWebShell->SetContainer(this); // Attach a WebProgress listener.during initialization... nsCOMPtr webProgress(do_GetInterface(mDocShell, &rv)); @@ -380,7 +341,7 @@ nsEventStatus PR_CALLBACK nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) { nsEventStatus result = nsEventStatus_eIgnore; - nsIWebShell* webShell = nsnull; + nsIDocShell* docShell = nsnull; nsWebShellWindow *eventWindow = nsnull; // Get the WebShell instance... @@ -390,14 +351,14 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) aEvent->widget->GetClientData(data); if (data != nsnull) { eventWindow = NS_REINTERPRET_CAST(nsWebShellWindow *, data); - webShell = eventWindow->mWebShell; + docShell = eventWindow->mDocShell; } } - if (nsnull != webShell) { + if (docShell) { switch(aEvent->message) { /* - * For size events, the WebShell must be resized to fill the entire + * For size events, the DocShell must be resized to fill the entire * client area of the window... */ case NS_MOVE: { @@ -409,7 +370,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) case NS_SIZE: { PRBool chromeLock = PR_FALSE; nsSizeEvent* sizeEvent = (nsSizeEvent*)aEvent; - nsCOMPtr shellAsWin(do_QueryInterface(webShell)); + nsCOMPtr shellAsWin(do_QueryInterface(docShell)); shellAsWin->SetPositionAndSize(0, 0, sizeEvent->windowSize->width, sizeEvent->windowSize->height, PR_FALSE); // persist size, but not immediately, in case this OS is firing @@ -453,7 +414,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) // the deactivation. Bug #82534 if(modeEvent->mSizeMode == nsSizeMode_Minimized) { nsCOMPtr domWindow; - eventWindow->ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow)); + eventWindow->ConvertDocShellToDOMWindow(docShell, getter_AddRefs(domWindow)); if (domWindow) { nsCOMPtr privateDOMWindow = do_QueryInterface(domWindow); if(privateDOMWindow) { @@ -508,14 +469,14 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) printf("nsWebShellWindow::NS_ACTIVATE\n"); #endif nsCOMPtr domWindow; - eventWindow->ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow)); + eventWindow->ConvertDocShellToDOMWindow(docShell, getter_AddRefs(domWindow)); /* - nsCOMPtr contentShell; - eventWindow->GetContentWebShell(getter_AddRefs(contentShell)); + nsCOMPtr contentShell; + eventWindow->GetContentDocShell(getter_AddRefs(contentShell)); if (contentShell) { if (NS_SUCCEEDED(eventWindow-> - ConvertWebShellToDOMWindow(contentShell, getter_AddRefs(domWindow)))) { + ConvertDocShellToDOMWindow(contentShell, getter_AddRefs(domWindow)))) { if(domWindow){ nsCOMPtr privateDOMWindow = do_QueryInterface(domWindow); if(privateDOMWindow) @@ -539,14 +500,14 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) #endif nsCOMPtr domWindow; - eventWindow->ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow)); + eventWindow->ConvertDocShellToDOMWindow(docShell, getter_AddRefs(domWindow)); /* - nsCOMPtr contentShell; - eventWindow->GetContentWebShell(getter_AddRefs(contentShell)); + nsCOMPtr contentShell; + eventWindow->GetContentDocShell(getter_AddRefs(contentShell)); if (contentShell) { if (NS_SUCCEEDED(eventWindow-> - ConvertWebShellToDOMWindow(contentShell, getter_AddRefs(domWindow)))) { + ConvertDocShellToDOMWindow(contentShell, getter_AddRefs(domWindow)))) { if(domWindow){ nsCOMPtr privateDOMWindow = do_QueryInterface(domWindow); if(privateDOMWindow) @@ -574,7 +535,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) #endif nsCOMPtr domDocument; nsCOMPtr domWindow; - eventWindow->ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow)); + eventWindow->ConvertDocShellToDOMWindow(docShell, getter_AddRefs(domWindow)); nsCOMPtr piWin(do_QueryInterface(domWindow)); if (!domWindow) { break; @@ -944,7 +905,7 @@ void nsWebShellWindow::DynamicLoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aP //fake event nsMenuEvent fake; - menuListener->MenuConstruct(fake, aParentWindow, menubarNode, mWebShell); + menuListener->MenuConstruct(fake, aParentWindow, menubarNode, mDocShell); // Parent should own menubar now NS_RELEASE(pnsMenuBar); @@ -1069,7 +1030,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi //------------------------------------------------------------------------------ NS_IMETHODIMP -nsWebShellWindow::ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindowInternal** aDOMWindow) +nsWebShellWindow::ConvertDocShellToDOMWindow(nsIDocShell* aShell, nsIDOMWindowInternal** aDOMWindow) { nsCOMPtr globalObjectOwner(do_QueryInterface(aShell)); NS_ENSURE_TRUE(globalObjectOwner, NS_ERROR_FAILURE); @@ -1102,10 +1063,9 @@ nsWebShellWindow::ShowModal() /* return the main, outermost webshell in this window */ NS_IMETHODIMP -nsWebShellWindow::GetWebShell(nsIWebShell *& aWebShell) +nsWebShellWindow::GetDocShell(nsIDocShell *& aDocShell) { - aWebShell = mWebShell; - NS_ADDREF(mWebShell); + NS_ADDREF(aDocShell = mDocShell); return NS_OK; } @@ -1120,7 +1080,7 @@ nsWebShellWindow::GetWebShell(nsIWebShell *& aWebShell) nondeterministic, and it seems dangerous to set a precedent like that. */ NS_IMETHODIMP -nsWebShellWindow::GetContentWebShell(nsIWebShell **aResult) +nsWebShellWindow::GetContentDocShell(nsIDocShell **aResult) { *aResult = nsnull; nsCOMPtr content; @@ -1144,7 +1104,7 @@ nsWebShellWindow::GetWidget(nsIWidget *& aWidget) NS_IMETHODIMP nsWebShellWindow::GetDOMWindow(nsIDOMWindowInternal** aDOMWindow) { - return ConvertWebShellToDOMWindow(mWebShell, aDOMWindow); + return ConvertDocShellToDOMWindow(mDocShell, aDOMWindow); } void * @@ -1357,18 +1317,18 @@ nsCOMPtr nsWebShellWindow::FindNamedDOMNode(const nsAString &aName, } // nsWebShellWindow::FindNamedDOMNode //---------------------------------------- -nsCOMPtr nsWebShellWindow::GetNamedDOMDoc(const nsAString & aWebShellName) +nsCOMPtr nsWebShellWindow::GetNamedDOMDoc(const nsAString & aDocShellName) { nsCOMPtr domDoc; // result == nsnull; // first get the toolbar child docShell nsCOMPtr childDocShell; - if (aWebShellName.EqualsLiteral("this")) { // XXX small kludge for code reused + if (aDocShellName.EqualsLiteral("this")) { // XXX small kludge for code reused childDocShell = mDocShell; } else { nsCOMPtr docShellAsItem; nsCOMPtr docShellAsNode(do_QueryInterface(mDocShell)); - docShellAsNode->FindChildWithName(PromiseFlatString(aWebShellName).get(), + docShellAsNode->FindChildWithName(PromiseFlatString(aDocShellName).get(), PR_TRUE, PR_FALSE, nsnull, getter_AddRefs(docShellAsItem)); childDocShell = do_QueryInterface(docShellAsItem); if (!childDocShell) @@ -1446,7 +1406,7 @@ void nsWebShellWindow::LoadContentAreas() { searchSpec.Mid(contentURL, eqPos+1, endPos-eqPos-1); endPos++; - // see if we have a webshell with a matching contentAreaID + // see if we have a docshell with a matching contentAreaID nsCOMPtr content; rv = GetContentShellById(contentAreaID.get(), getter_AddRefs(content)); if (NS_SUCCEEDED(rv) && content) { @@ -1482,7 +1442,7 @@ PRBool nsWebShellWindow::ExecuteCloseHandler() than it otherwise would.) */ nsCOMPtr kungFuDeathGrip(this); - nsCOMPtr globalObject(do_GetInterface(mWebShell)); + nsCOMPtr globalObject(do_GetInterface(mDocShell)); if (globalObject) { nsCOMPtr contentViewer; diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.h b/mozilla/xpfe/appshell/src/nsWebShellWindow.h index ee4c7816d45..4970449b2d6 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.h +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.h @@ -41,7 +41,6 @@ #include "nsISupports.h" #include "nsIWebShellWindow.h" #include "nsGUIEvent.h" -#include "nsIWebShell.h" #include "nsIWebProgressListener.h" #include "nsIDocumentObserver.h" #include "nsVoidArray.h" @@ -74,7 +73,6 @@ class nsVoidArray; class nsWebShellWindow : public nsXULWindow, public nsIWebShellWindow, - public nsIWebShellContainer, public nsIWebProgressListener, public nsIDocumentObserver @@ -83,7 +81,7 @@ public: nsWebShellWindow(); // nsISupports interface... - NS_DECL_ISUPPORTS + NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD LockUntilChromeLoad() { mLockedUntilChromeLoad = PR_TRUE; return NS_OK; } NS_IMETHOD GetLockedState(PRBool& aResult) { aResult = mLockedUntilChromeLoad; return NS_OK; } @@ -96,11 +94,11 @@ public: NS_IMETHOD ShowModal(); NS_IMETHOD Toolbar(); NS_IMETHOD Close(); - NS_IMETHOD GetWebShell(nsIWebShell *& aWebShell); - NS_IMETHOD GetContentWebShell(nsIWebShell **aResult); + NS_IMETHOD GetDocShell(nsIDocShell *& aWebShell); + NS_IMETHOD GetContentDocShell(nsIDocShell **aResult); NS_IMETHOD GetWidget(nsIWidget *& aWidget); NS_IMETHOD GetDOMWindow(nsIDOMWindowInternal** aDOMWindow); - NS_IMETHOD ConvertWebShellToDOMWindow(nsIWebShell* aShell, nsIDOMWindowInternal** aDOMWindow); + NS_IMETHOD ConvertDocShellToDOMWindow(nsIDocShell* aShell, nsIDOMWindowInternal** aDOMWindow); // nsWebShellWindow methods... nsresult Initialize(nsIXULWindow * aParent, nsIAppShell* aShell, nsIURI* aUrl, PRBool aCreatedVisible, PRBool aLoadDefaultPage, @@ -130,7 +128,7 @@ protected: NS_IMETHOD LoadMenuItem(nsIMenu * pParentMenu, nsIDOMElement * menuitemElement, nsIDOMNode * menuitemNode); #endif - nsCOMPtr GetDOMNodeFromWebShell(nsIWebShell *aShell); + nsCOMPtr GetDOMNodeFromDocShell(nsIDocShell *aShell); void ExecuteStartupCode(); void LoadContentAreas(); PRBool ExecuteCloseHandler(); @@ -139,7 +137,6 @@ protected: static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent); - nsIWebShell* mWebShell; PRBool mLockedUntilChromeLoad; PRBool mLoadDefaultPage; diff --git a/mozilla/xpfe/appshell/src/nsWindowMediator.cpp b/mozilla/xpfe/appshell/src/nsWindowMediator.cpp index ec2ca9d19e6..db8f7f82e64 100644 --- a/mozilla/xpfe/appshell/src/nsWindowMediator.cpp +++ b/mozilla/xpfe/appshell/src/nsWindowMediator.cpp @@ -52,7 +52,6 @@ #include "nsIDOMDocument.h" #include "nsIServiceManager.h" #include "nsISimpleEnumerator.h" -#include "nsIWebShell.h" #include "nsAppShellWindowEnumerator.h" #include "nsWindowMediator.h" #include "nsIWindowMediatorListener.h" diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index 66f66010213..73b78f548ea 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -66,7 +66,6 @@ #include "nsIContentViewer.h" #include "nsIContentViewerEdit.h" -#include "nsIWebShell.h" #include "nsIWebShellWindow.h" #include "nsIWebBrowserChrome.h" #include "nsIWindowWatcher.h" diff --git a/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp b/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp index bd6ff7bb44c..e41e990f2d2 100644 --- a/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp +++ b/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp @@ -54,7 +54,6 @@ #include "nsIServiceManager.h" #include "nsNetCID.h" #include "nsIWebShellWindow.h" -#include "nsIWebShell.h" #include "nsIDOMWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h"