From 36453999ea4c368b1106e05bbfc9aa157fe3e1f6 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 12 Feb 2013 17:02:51 -0500 Subject: [PATCH] bug 841436 - remove nolonger needed qi from nsIDocShell to nsIDocShellTreeItem r=bz --- accessible/src/base/nsAccUtils.h | 1 - accessible/src/base/nsAccessNode.cpp | 10 +- accessible/src/base/nsCoreUtils.cpp | 14 +- accessible/src/base/nsCoreUtils.h | 7 +- accessible/src/generic/DocAccessible.cpp | 12 +- .../src/generic/HyperTextAccessible.cpp | 5 +- accessible/src/generic/RootAccessible.cpp | 7 +- accessible/src/msaa/nsAccessNodeWrap.cpp | 7 +- caps/src/nsScriptSecurityManager.cpp | 1 - content/base/src/nsCCUncollectableMarker.cpp | 1 - content/base/src/nsContentSink.cpp | 19 +-- content/base/src/nsContentUtils.cpp | 1 - content/base/src/nsFrameLoader.cpp | 108 ++++++-------- content/base/src/nsMixedContentBlocker.cpp | 10 +- .../canvas/src/CanvasRenderingContext2D.cpp | 2 - content/canvas/src/DocumentRendererChild.cpp | 2 - content/events/src/nsDOMDataTransfer.cpp | 1 - content/events/src/nsEventStateManager.cpp | 2 - .../html/content/src/nsGenericHTMLElement.cpp | 1 - .../html/content/src/nsHTMLMediaElement.cpp | 1 - content/html/document/src/ImageDocument.cpp | 1 - content/html/document/src/VideoDocument.cpp | 1 - .../html/document/src/nsHTMLContentSink.cpp | 6 +- content/html/document/src/nsHTMLDocument.cpp | 10 +- content/xml/document/src/nsXMLContentSink.cpp | 1 - content/xul/document/src/nsXULDocument.cpp | 1 - dom/base/nsDOMWindowList.cpp | 2 - dom/base/nsFocusManager.cpp | 31 ++-- dom/base/nsGlobalWindow.cpp | 137 +++++++----------- dom/base/nsGlobalWindowCommands.cpp | 7 +- dom/base/nsHistory.cpp | 6 +- dom/base/nsScreen.cpp | 5 +- dom/ipc/TabChild.cpp | 1 - .../webBrowser/nsDocShellTreeOwner.cpp | 15 +- embedding/browser/webBrowser/nsWebBrowser.cpp | 34 ++--- embedding/browser/webBrowser/nsWebBrowser.h | 1 - .../components/find/src/nsWebBrowserFind.cpp | 1 - layout/base/nsDocumentViewer.cpp | 16 +- layout/base/nsLayoutUtils.cpp | 4 +- layout/base/nsPresContext.cpp | 1 - layout/printing/nsPrintEngine.cpp | 33 ++--- layout/printing/nsPrintObject.cpp | 8 +- .../src/nsLayoutDebuggingTools.cpp | 20 +-- .../layout-debug/src/nsRegressionTester.cpp | 2 - layout/xul/base/src/nsResizerFrame.cpp | 8 +- layout/xul/base/src/nsXULPopupManager.cpp | 1 - netwerk/protocol/http/HttpChannelParent.cpp | 1 - .../http/HttpChannelParentListener.cpp | 1 - parser/html/nsHtml5TreeOpExecutor.cpp | 9 +- widget/xpwidgets/nsBaseFilePicker.cpp | 1 - 50 files changed, 216 insertions(+), 361 deletions(-) diff --git a/accessible/src/base/nsAccUtils.h b/accessible/src/base/nsAccUtils.h index 0b89a985882..fcdfa69a616 100644 --- a/accessible/src/base/nsAccUtils.h +++ b/accessible/src/base/nsAccUtils.h @@ -15,7 +15,6 @@ #include "mozilla/dom/Element.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIPersistentProperties2.h" #include "nsIPresShell.h" #include "nsPoint.h" diff --git a/accessible/src/base/nsAccessNode.cpp b/accessible/src/base/nsAccessNode.cpp index 69d3b032ec6..276686f4d2c 100644 --- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -11,7 +11,6 @@ #include "RootAccessible.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIDOMWindow.h" #include "nsIFrame.h" #include "nsIInterfaceRequestorUtils.h" @@ -82,14 +81,13 @@ nsAccessNode::Shutdown() RootAccessible* nsAccessNode::RootAccessible() const { - nsCOMPtr docShellTreeItem = - nsCoreUtils::GetDocShellTreeItemFor(GetNode()); - NS_ASSERTION(docShellTreeItem, "No docshell tree item for mContent"); - if (!docShellTreeItem) { + nsCOMPtr docShell = nsCoreUtils::GetDocShellFor(GetNode()); + NS_ASSERTION(docShell, "No docshell for mContent"); + if (!docShell) { return nullptr; } nsCOMPtr root; - docShellTreeItem->GetRootTreeItem(getter_AddRefs(root)); + docShell->GetRootTreeItem(getter_AddRefs(root)); NS_ASSERTION(root, "No root content tree item"); if (!root) { return nullptr; diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 6afe3cbd0c4..751c2c02ce1 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -38,7 +38,6 @@ #include "mozilla/dom/Element.h" #include "nsITreeBoxObject.h" -#include "nsIDocShellTreeItem.h" #include "nsITreeColumns.h" //////////////////////////////////////////////////////////////////////////////// @@ -380,7 +379,7 @@ nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode) { nsIntPoint coords(0, 0); - nsCOMPtr treeItem(GetDocShellTreeItemFor(aNode)); + nsCOMPtr treeItem(GetDocShellFor(aNode)); if (!treeItem) return coords; @@ -396,18 +395,15 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode) return coords; } -already_AddRefed -nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode) +already_AddRefed +nsCoreUtils::GetDocShellFor(nsINode *aNode) { if (!aNode) return nullptr; nsCOMPtr container = aNode->OwnerDoc()->GetContainer(); - nsIDocShellTreeItem *docShellTreeItem = nullptr; - if (container) - CallQueryInterface(container, &docShellTreeItem); - - return docShellTreeItem; + nsCOMPtr docShell = do_QueryInterface(container); + return docShell.forget(); } bool diff --git a/accessible/src/base/nsCoreUtils.h b/accessible/src/base/nsCoreUtils.h index 2eba55ac92f..e104be65230 100644 --- a/accessible/src/base/nsCoreUtils.h +++ b/accessible/src/base/nsCoreUtils.h @@ -17,7 +17,7 @@ class nsRange; class nsIFrame; -class nsIDocShellTreeItem; +class nsIDocShell; class nsITreeColumn; class nsITreeBoxObject; class nsIWidget; @@ -176,10 +176,9 @@ public: static nsIntPoint GetScreenCoordsForWindow(nsINode *aNode); /** - * Return document shell tree item for the given DOM node. + * Return document shell for the given DOM node. */ - static already_AddRefed - GetDocShellTreeItemFor(nsINode *aNode); + static already_AddRefed GetDocShellFor(nsINode *aNode); /** * Return true if the given document is root document. diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index 78a08b10794..455ee3b44c4 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -18,7 +18,6 @@ #include "nsIMutableArray.h" #include "nsICommandManager.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIDocument.h" #include "nsIDOMAttr.h" #include "nsIDOMCharacterData.h" @@ -185,14 +184,13 @@ DocAccessible::Name(nsString& aName) role DocAccessible::NativeRole() { - nsCOMPtr docShellTreeItem = - nsCoreUtils::GetDocShellTreeItemFor(mDocumentNode); - if (docShellTreeItem) { + nsCOMPtr docShell = nsCoreUtils::GetDocShellFor(mDocumentNode); + if (docShell) { nsCOMPtr sameTypeRoot; - docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); + docShell->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); int32_t itemType; - docShellTreeItem->GetItemType(&itemType); - if (sameTypeRoot == docShellTreeItem) { + docShell->GetItemType(&itemType); + if (sameTypeRoot == docShell) { // Root of content or chrome tree if (itemType == nsIDocShellTreeItem::typeChrome) return roles::CHROME_WINDOW; diff --git a/accessible/src/generic/HyperTextAccessible.cpp b/accessible/src/generic/HyperTextAccessible.cpp index 5df3be98863..5382a6b44c8 100644 --- a/accessible/src/generic/HyperTextAccessible.cpp +++ b/accessible/src/generic/HyperTextAccessible.cpp @@ -1482,9 +1482,8 @@ HyperTextAccessible::GetEditor() const return nullptr; } - nsCOMPtr docShellTreeItem = - nsCoreUtils::GetDocShellTreeItemFor(mContent); - nsCOMPtr editingSession(do_GetInterface(docShellTreeItem)); + nsCOMPtr docShell = nsCoreUtils::GetDocShellFor(mContent); + nsCOMPtr editingSession(do_GetInterface(docShell)); if (!editingSession) return nullptr; // No editing session interface diff --git a/accessible/src/generic/RootAccessible.cpp b/accessible/src/generic/RootAccessible.cpp index 18bc4d2b91c..b51b1fda084 100644 --- a/accessible/src/generic/RootAccessible.cpp +++ b/accessible/src/generic/RootAccessible.cpp @@ -108,11 +108,10 @@ RootAccessible::GetChromeFlags() // Return the flag set for the top level window as defined // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME] // Not simple: nsIXULWindow is not just a QI from nsIDOMWindow - nsCOMPtr treeItem = - nsCoreUtils::GetDocShellTreeItemFor(mDocumentNode); - NS_ENSURE_TRUE(treeItem, 0); + nsCOMPtr docShell = nsCoreUtils::GetDocShellFor(mDocumentNode); + NS_ENSURE_TRUE(docShell, 0); nsCOMPtr treeOwner; - treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); + docShell->GetTreeOwner(getter_AddRefs(treeOwner)); NS_ENSURE_TRUE(treeOwner, 0); nsCOMPtr xulWin(do_GetInterface(treeOwner)); if (!xulWin) { diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index c00d0e2eb09..82eee13f562 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -77,15 +77,14 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv) if (iid != IID_IAccessible) return E_NOINTERFACE; - nsCOMPtr docShellTreeItem = - nsCoreUtils::GetDocShellTreeItemFor(mContent); - if (!docShellTreeItem) + nsCOMPtr docShell = nsCoreUtils::GetDocShellFor(mContent); + if (!docShell) return E_UNEXPECTED; // Walk up the parent chain without crossing the boundary at which item // types change, preventing us from walking up out of tab content. nsCOMPtr root; - docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root)); + docShell->GetSameTypeRootTreeItem(getter_AddRefs(root)); if (!root) return E_UNEXPECTED; diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 7bcbc711460..65f76083f73 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -40,7 +40,6 @@ #include "nsIScriptGlobalObject.h" #include "nsPIDOMWindow.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIPrompt.h" #include "nsIWindowWatcher.h" #include "nsIConsoleService.h" diff --git a/content/base/src/nsCCUncollectableMarker.cpp b/content/base/src/nsCCUncollectableMarker.cpp index af79c6265c3..60058ccec1b 100644 --- a/content/base/src/nsCCUncollectableMarker.cpp +++ b/content/base/src/nsCCUncollectableMarker.cpp @@ -6,7 +6,6 @@ #include "nsCCUncollectableMarker.h" #include "nsIObserverService.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsServiceManagerUtils.h" #include "nsIContentViewer.h" #include "nsIDocument.h" diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index 08d731373b2..a9a25f5e8a4 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -17,7 +17,6 @@ #include "nsStyleLinkElement.h" #include "nsIDocShell.h" #include "nsILoadContext.h" -#include "nsIDocShellTreeItem.h" #include "nsCPrefetchService.h" #include "nsIURI.h" #include "nsNetUtil.h" @@ -807,22 +806,18 @@ nsContentSink::PrefetchHref(const nsAString &aHref, nsCOMPtr docshell = mDocShell; - nsCOMPtr treeItem, parentItem; + nsCOMPtr parentItem; do { uint32_t appType = 0; nsresult rv = docshell->GetAppType(&appType); if (NS_FAILED(rv) || appType == nsIDocShell::APP_TYPE_MAIL) return; // do not prefetch from mailnews - treeItem = do_QueryInterface(docshell); - if (treeItem) { - treeItem->GetParent(getter_AddRefs(parentItem)); - if (parentItem) { - treeItem = parentItem; - docshell = do_QueryInterface(treeItem); - if (!docshell) { - NS_ERROR("cannot get a docshell from a treeItem!"); - return; - } + docshell->GetParent(getter_AddRefs(parentItem)); + if (parentItem) { + docshell = do_QueryInterface(parentItem); + if (!docshell) { + NS_ERROR("cannot get a docshell from a treeItem!"); + return; } } } while (parentItem); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index fdfeb7de314..6db0968776f 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -41,7 +41,6 @@ #include "nsPIDOMWindow.h" #include "nsIJSContextStack.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsParserCIID.h" #include "nsIParser.h" #include "nsIFragmentContentSink.h" diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index 556302afaf4..a8f9145031c 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -28,8 +28,6 @@ #include "nsIWebNavigation.h" #include "nsIWebProgress.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIDocShellTreeOwner.h" #include "nsIDocShellLoadInfo.h" #include "nsIDOMApplicationRegistry.h" @@ -1031,12 +1029,9 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, // To avoid having to mess with session history, avoid swapping // frameloaders that don't correspond to root same-type docshells, // unless both roots have session history disabled. - nsCOMPtr ourTreeItem = do_QueryInterface(ourDocshell); - nsCOMPtr otherTreeItem = - do_QueryInterface(otherDocshell); nsCOMPtr ourRootTreeItem, otherRootTreeItem; - ourTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(ourRootTreeItem)); - otherTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(otherRootTreeItem)); + ourDocshell->GetSameTypeRootTreeItem(getter_AddRefs(ourRootTreeItem)); + otherDocshell->GetSameTypeRootTreeItem(getter_AddRefs(otherRootTreeItem)); nsCOMPtr ourRootWebnav = do_QueryInterface(ourRootTreeItem); nsCOMPtr otherRootWebnav = @@ -1051,7 +1046,7 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, ourRootWebnav->GetSessionHistory(getter_AddRefs(ourHistory)); otherRootWebnav->GetSessionHistory(getter_AddRefs(otherHistory)); - if ((ourRootTreeItem != ourTreeItem || otherRootTreeItem != otherTreeItem) && + if ((ourRootTreeItem != ourDocshell || otherRootTreeItem != otherDocshell) && (ourHistory || otherHistory)) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -1061,8 +1056,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, // the code below needs to be audited as it assumes identical types. int32_t ourType = nsIDocShellTreeItem::typeChrome; int32_t otherType = nsIDocShellTreeItem::typeChrome; - ourTreeItem->GetItemType(&ourType); - otherTreeItem->GetItemType(&otherType); + ourDocshell->GetItemType(&ourType); + otherDocshell->GetItemType(&otherType); if (ourType != otherType) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -1072,21 +1067,21 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, // nsIDocShellTreeItem::typeContent then all of our descendants are the same // type as us. if (ourType != nsIDocShellTreeItem::typeContent && - (!AllDescendantsOfType(ourTreeItem, ourType) || - !AllDescendantsOfType(otherTreeItem, otherType))) { + (!AllDescendantsOfType(ourDocshell, ourType) || + !AllDescendantsOfType(otherDocshell, otherType))) { return NS_ERROR_NOT_IMPLEMENTED; } // Save off the tree owners, frame elements, chrome event handlers, and // docshell and document parents before doing anything else. nsCOMPtr ourOwner, otherOwner; - ourTreeItem->GetTreeOwner(getter_AddRefs(ourOwner)); - otherTreeItem->GetTreeOwner(getter_AddRefs(otherOwner)); + ourDocshell->GetTreeOwner(getter_AddRefs(ourOwner)); + otherDocshell->GetTreeOwner(getter_AddRefs(otherOwner)); // Note: it's OK to have null treeowners. nsCOMPtr ourParentItem, otherParentItem; - ourTreeItem->GetParent(getter_AddRefs(ourParentItem)); - otherTreeItem->GetParent(getter_AddRefs(otherParentItem)); + ourDocshell->GetParent(getter_AddRefs(ourParentItem)); + otherDocshell->GetParent(getter_AddRefs(otherParentItem)); if (!ourParentItem || !otherParentItem) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -1164,25 +1159,25 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, // Fire pageshow events on still-loading pages, and then fire pagehide // events. Note that we do NOT fire these in the normal way, but just fire // them on the chrome event handlers. - FirePageShowEvent(ourTreeItem, ourChromeEventHandler, false); - FirePageShowEvent(otherTreeItem, otherChromeEventHandler, false); - FirePageHideEvent(ourTreeItem, ourChromeEventHandler); - FirePageHideEvent(otherTreeItem, otherChromeEventHandler); + FirePageShowEvent(ourDocshell, ourChromeEventHandler, false); + FirePageShowEvent(otherDocshell, otherChromeEventHandler, false); + FirePageHideEvent(ourDocshell, ourChromeEventHandler); + FirePageHideEvent(otherDocshell, otherChromeEventHandler); nsIFrame* ourFrame = ourContent->GetPrimaryFrame(); nsIFrame* otherFrame = otherContent->GetPrimaryFrame(); if (!ourFrame || !otherFrame) { mInSwap = aOther->mInSwap = false; - FirePageShowEvent(ourTreeItem, ourChromeEventHandler, true); - FirePageShowEvent(otherTreeItem, otherChromeEventHandler, true); + FirePageShowEvent(ourDocshell, ourChromeEventHandler, true); + FirePageShowEvent(otherDocshell, otherChromeEventHandler, true); return NS_ERROR_NOT_IMPLEMENTED; } nsSubDocumentFrame* ourFrameFrame = do_QueryFrame(ourFrame); if (!ourFrameFrame) { mInSwap = aOther->mInSwap = false; - FirePageShowEvent(ourTreeItem, ourChromeEventHandler, true); - FirePageShowEvent(otherTreeItem, otherChromeEventHandler, true); + FirePageShowEvent(ourDocshell, ourChromeEventHandler, true); + FirePageShowEvent(otherDocshell, otherChromeEventHandler, true); return NS_ERROR_NOT_IMPLEMENTED; } @@ -1190,31 +1185,31 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, rv = ourFrameFrame->BeginSwapDocShells(otherFrame); if (NS_FAILED(rv)) { mInSwap = aOther->mInSwap = false; - FirePageShowEvent(ourTreeItem, ourChromeEventHandler, true); - FirePageShowEvent(otherTreeItem, otherChromeEventHandler, true); + FirePageShowEvent(ourDocshell, ourChromeEventHandler, true); + FirePageShowEvent(otherDocshell, otherChromeEventHandler, true); return rv; } // Now move the docshells to the right docshell trees. Note that this // resets their treeowners to null. - ourParentItem->RemoveChild(ourTreeItem); - otherParentItem->RemoveChild(otherTreeItem); + ourParentItem->RemoveChild(ourDocshell); + otherParentItem->RemoveChild(otherDocshell); if (ourType == nsIDocShellTreeItem::typeContent) { - ourOwner->ContentShellRemoved(ourTreeItem); - otherOwner->ContentShellRemoved(otherTreeItem); + ourOwner->ContentShellRemoved(ourDocshell); + otherOwner->ContentShellRemoved(otherDocshell); } - ourParentItem->AddChild(otherTreeItem); - otherParentItem->AddChild(ourTreeItem); + ourParentItem->AddChild(otherDocshell); + otherParentItem->AddChild(ourDocshell); // Restore the correct chrome event handlers. ourDocshell->SetChromeEventHandler(otherChromeEventHandler); otherDocshell->SetChromeEventHandler(ourChromeEventHandler); // Restore the correct treeowners // (and also chrome event handlers for content frames only). - SetTreeOwnerAndChromeEventHandlerOnDocshellTree(ourTreeItem, otherOwner, + SetTreeOwnerAndChromeEventHandlerOnDocshellTree(ourDocshell, otherOwner, ourType == nsIDocShellTreeItem::typeContent ? otherChromeEventHandler : nullptr); - SetTreeOwnerAndChromeEventHandlerOnDocshellTree(otherTreeItem, ourOwner, + SetTreeOwnerAndChromeEventHandlerOnDocshellTree(otherDocshell, ourOwner, ourType == nsIDocShellTreeItem::typeContent ? ourChromeEventHandler : nullptr); // Switch the owner content before we start calling AddTreeItemToTreeOwner. @@ -1223,8 +1218,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, SetOwnerContent(otherContent); aOther->SetOwnerContent(ourContent); - AddTreeItemToTreeOwner(ourTreeItem, otherOwner, otherParentType, nullptr); - aOther->AddTreeItemToTreeOwner(otherTreeItem, ourOwner, ourParentType, + AddTreeItemToTreeOwner(ourDocshell, otherOwner, otherParentType, nullptr); + aOther->AddTreeItemToTreeOwner(otherDocshell, ourOwner, ourParentType, nullptr); // SetSubDocumentFor nulls out parent documents on the old child doc if a @@ -1308,8 +1303,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther, ourParentDocument->FlushPendingNotifications(Flush_Layout); otherParentDocument->FlushPendingNotifications(Flush_Layout); - FirePageShowEvent(ourTreeItem, otherChromeEventHandler, true); - FirePageShowEvent(otherTreeItem, ourChromeEventHandler, true); + FirePageShowEvent(ourDocshell, otherChromeEventHandler, true); + FirePageShowEvent(otherDocshell, ourChromeEventHandler, true); mInSwap = aOther->mInSwap = false; return NS_OK; @@ -1361,13 +1356,12 @@ nsFrameLoader::Destroy() // Let the tree owner know we're gone. if (mIsTopLevelContent) { - nsCOMPtr ourItem = do_QueryInterface(mDocShell); - if (ourItem) { + if (mDocShell) { nsCOMPtr parentItem; - ourItem->GetParent(getter_AddRefs(parentItem)); + mDocShell->GetParent(getter_AddRefs(parentItem)); nsCOMPtr owner = do_GetInterface(parentItem); if (owner) { - owner->ContentShellRemoved(ourItem); + owner->ContentShellRemoved(mDocShell); } } } @@ -1570,8 +1564,7 @@ nsFrameLoader::MaybeCreateDocShell() } // Get the frame name and tell the docshell about it. - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); nsAutoString frameName; int32_t namespaceID = mOwnerContent->GetNameSpaceID(); @@ -1587,7 +1580,7 @@ nsFrameLoader::MaybeCreateDocShell() } if (!frameName.IsEmpty()) { - docShellAsItem->SetName(frameName.get()); + mDocShell->SetName(frameName.get()); } // If our container is a web-shell, inform it that it has a new @@ -1611,7 +1604,7 @@ nsFrameLoader::MaybeCreateDocShell() parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner)); NS_ENSURE_STATE(parentTreeOwner); mIsTopLevelContent = - AddTreeItemToTreeOwner(docShellAsItem, parentTreeOwner, parentType, + AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType, parentAsNode); // Make sure all shells have links back to the content element @@ -1735,19 +1728,16 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI) return NS_ERROR_FAILURE; } - nsCOMPtr treeItem = do_QueryInterface(mDocShell); - NS_ASSERTION(treeItem, "docshell must be a treeitem!"); - // Check that we're still in the docshell tree. nsCOMPtr treeOwner; - treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); + mDocShell->GetTreeOwner(getter_AddRefs(treeOwner)); NS_WARN_IF_FALSE(treeOwner, "Trying to load a new url to a docshell without owner!"); NS_ENSURE_STATE(treeOwner); int32_t ourType; - rv = treeItem->GetItemType(&ourType); + rv = mDocShell->GetItemType(&ourType); if (NS_SUCCEEDED(rv) && ourType != nsIDocShellTreeItem::typeContent) { // No need to do recursion-protection here XXXbz why not?? Do we really // trust people not to screw up with non-content docshells? @@ -1757,7 +1747,7 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI) // Bug 8065: Don't exceed some maximum depth in content frames // (MAX_DEPTH_CONTENT_FRAMES) nsCOMPtr parentAsItem; - treeItem->GetSameTypeParent(getter_AddRefs(parentAsItem)); + mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem)); int32_t depth = 0; while (parentAsItem) { ++depth; @@ -1776,7 +1766,7 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI) // Bug 136580: Check for recursive frame loading int32_t matchCount = 0; - treeItem->GetSameTypeParent(getter_AddRefs(parentAsItem)); + mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem)); while (parentAsItem) { // Check the parent URI with the URI we're loading nsCOMPtr parentAsNav(do_QueryInterface(parentAsItem)); @@ -2472,14 +2462,12 @@ nsFrameLoader::AttributeChanged(nsIDocument* aDocument, // Notify our enclosing chrome that our type has changed. We only do this // if our parent is chrome, since in all other cases we're random content // subframes and the treeowner shouldn't worry about us. - - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - if (!docShellAsItem) { + if (!mDocShell) { return; } nsCOMPtr parentItem; - docShellAsItem->GetParent(getter_AddRefs(parentItem)); + mDocShell->GetParent(getter_AddRefs(parentItem)); if (!parentItem) { return; } @@ -2507,18 +2495,18 @@ nsFrameLoader::AttributeChanged(nsIDocument* aDocument, if (!is_primary) { nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); if (pm) - pm->HidePopupsInDocShell(docShellAsItem); + pm->HidePopupsInDocShell(mDocShell); } #endif - parentTreeOwner->ContentShellRemoved(docShellAsItem); + parentTreeOwner->ContentShellRemoved(mDocShell); if (value.LowerCaseEqualsLiteral("content") || StringBeginsWith(value, NS_LITERAL_STRING("content-"), nsCaseInsensitiveStringComparator())) { bool is_targetable = is_primary || value.LowerCaseEqualsLiteral("content-targetable"); - parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary, + parentTreeOwner->ContentShellAdded(mDocShell, is_primary, is_targetable, value); } } diff --git a/content/base/src/nsMixedContentBlocker.cpp b/content/base/src/nsMixedContentBlocker.cpp index f37507e0ade..a8d63e806fe 100644 --- a/content/base/src/nsMixedContentBlocker.cpp +++ b/content/base/src/nsMixedContentBlocker.cpp @@ -9,7 +9,6 @@ #include "nsINode.h" #include "nsCOMPtr.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsISecurityEventSink.h" #include "nsIWebProgressListener.h" #include "nsContentUtils.h" @@ -61,12 +60,11 @@ public: // set the approriate flag to true if we are about to load Mixed Active // Content. nsCOMPtr docShell = NS_CP_GetDocShellFromContext(mContext); - nsCOMPtr currentDocShellTreeItem(do_QueryInterface(docShell)); - if (!currentDocShellTreeItem) { + if (!docShell) { return NS_OK; } nsCOMPtr sameTypeRoot; - currentDocShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); + docShell->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); NS_ASSERTION(sameTypeRoot, "No document shell root tree item from document shell tree item!"); // now get the document from sameTypeRoot @@ -368,10 +366,8 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType, } // Get the root document from the docshell - nsCOMPtr currentDocShellTreeItem(do_QueryInterface(docShell)); - NS_ASSERTION(currentDocShellTreeItem, "No DocShellTreeItem from docshell"); nsCOMPtr sameTypeRoot; - currentDocShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); + docShell->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); NS_ASSERTION(sameTypeRoot, "No document shell root tree item from document shell tree item!"); nsCOMPtr rootDoc = do_GetInterface(sameTypeRoot); NS_ASSERTION(rootDoc, "No root document from document shell root tree item."); diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index 830d2026212..2b6440b31c9 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -43,8 +43,6 @@ #include "nsIDocShell.h" #include "nsIDOMWindow.h" #include "nsPIDOMWindow.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIXPConnect.h" #include "nsDisplayList.h" diff --git a/content/canvas/src/DocumentRendererChild.cpp b/content/canvas/src/DocumentRendererChild.cpp index 72c618f5954..4a0d1466a5b 100644 --- a/content/canvas/src/DocumentRendererChild.cpp +++ b/content/canvas/src/DocumentRendererChild.cpp @@ -11,8 +11,6 @@ #include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeNode.h" -#include "nsIDocShellTreeItem.h" #include "nsIInterfaceRequestorUtils.h" #include "nsComponentManagerUtils.h" #include "nsCSSParser.h" diff --git a/content/events/src/nsDOMDataTransfer.cpp b/content/events/src/nsDOMDataTransfer.cpp index fadc8d306f0..9c5ec0136b0 100644 --- a/content/events/src/nsDOMDataTransfer.cpp +++ b/content/events/src/nsDOMDataTransfer.cpp @@ -25,7 +25,6 @@ #include "nsCRT.h" #include "nsIScriptObjectPrincipal.h" #include "nsIWebNavigation.h" -#include "nsIDocShellTreeItem.h" #include "nsIScriptContext.h" using namespace mozilla; diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 65d41dd7c09..27848844151 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -33,8 +33,6 @@ #include "nsPIDOMWindow.h" #include "nsPIWindowRoot.h" #include "nsIEnumerator.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIWebNavigation.h" #include "nsIContentViewer.h" #include diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 684b3716e81..db418c72aeb 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -43,7 +43,6 @@ #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsINameSpaceManager.h" #include "nsError.h" #include "nsScriptLoader.h" diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index 5aa38f049a0..3eecf4c8fc0 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -53,7 +53,6 @@ #include "nsVideoFrame.h" #include "BasicLayers.h" #include -#include "nsIDocShellTreeItem.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "nsIAppShell.h" #include "nsWidgetsCID.h" diff --git a/content/html/document/src/ImageDocument.cpp b/content/html/document/src/ImageDocument.cpp index e078c7a6009..2bacbe9efc7 100644 --- a/content/html/document/src/ImageDocument.cpp +++ b/content/html/document/src/ImageDocument.cpp @@ -36,7 +36,6 @@ #include "nsIDocShell.h" #include "nsIContentViewer.h" #include "nsIMarkupDocumentViewer.h" -#include "nsIDocShellTreeItem.h" #include "nsThreadUtils.h" #include "nsIScrollableFrame.h" #include "nsContentUtils.h" diff --git a/content/html/document/src/VideoDocument.cpp b/content/html/document/src/VideoDocument.cpp index b341ea7afca..c14e1c2d1ef 100644 --- a/content/html/document/src/VideoDocument.cpp +++ b/content/html/document/src/VideoDocument.cpp @@ -9,7 +9,6 @@ #include "nsContentCreatorFunctions.h" #include "nsHTMLMediaElement.h" #include "nsIDocumentInlines.h" -#include "nsIDocShellTreeItem.h" #include "nsContentUtils.h" #include "mozilla/dom/Element.h" diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index fbce9b05e85..4dfa539d3af 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -2069,12 +2069,10 @@ HTMLContentSink::SetDocumentCharset(nsACString& aCharset) // it but if we get a null pointer, that's perfectly legal for // parent and parentContentViewer - nsCOMPtr docShellAsItem = - do_QueryInterface(mDocShell); - NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); nsCOMPtr parentAsItem; - docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem)); + mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem)); nsCOMPtr parent(do_QueryInterface(parentAsItem)); if (parent) { diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index ae0c88a1898..6cdf144e26c 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -32,7 +32,6 @@ #include "nsIContentViewer.h" #include "nsIMarkupDocumentViewer.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsDocShellLoadTypes.h" #include "nsIWebNavigation.h" #include "nsIBaseWindow.h" @@ -683,12 +682,9 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, // but if we get a null pointer, that's perfectly legal for parent // and parentContentViewer nsCOMPtr docShell(do_QueryInterface(aContainer)); - - nsCOMPtr docShellAsItem(do_QueryInterface(docShell)); - nsCOMPtr parentAsItem; - if (docShellAsItem) { - docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem)); + if (docShell) { + docShell->GetSameTypeParent(getter_AddRefs(parentAsItem)); } nsCOMPtr parent(do_QueryInterface(parentAsItem)); @@ -751,7 +747,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, parserCharsetSource = charsetSource; parserCharset = charset; } else { - NS_ASSERTION(docShell && docShellAsItem, "Unexpected null value"); + NS_ASSERTION(docShell, "Unexpected null value"); charsetSource = kCharsetUninitialized; wyciwygChannel = do_QueryInterface(aChannel); diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index abbfd1d7592..7d782dfa723 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -14,7 +14,6 @@ #include "nsIURI.h" #include "nsNetUtil.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIStyleSheetLinkingElement.h" #include "nsIDOMComment.h" #include "nsIDOMCDATASection.h" diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 9242ac99041..162bcf6acf2 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -81,7 +81,6 @@ #include "nsEventDispatcher.h" #include "nsIObserverService.h" #include "nsNodeUtils.h" -#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeOwner.h" #include "nsIXULWindow.h" #include "nsXULPopupManager.h" diff --git a/dom/base/nsDOMWindowList.cpp b/dom/base/nsDOMWindowList.cpp index 1e5e4bc49ed..50ad132dc93 100644 --- a/dom/base/nsDOMWindowList.cpp +++ b/dom/base/nsDOMWindowList.cpp @@ -14,8 +14,6 @@ #include "nsIDOMDocument.h" #include "nsIDOMWindow.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIScriptGlobalObject.h" diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 075e04f39a6..bbcf1dc4e7b 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -26,7 +26,6 @@ #include "nsIHTMLDocument.h" #include "nsIDocShell.h" #include "nsIEditorDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeOwner.h" #include "nsLayoutUtils.h" #include "nsIPresShell.h" @@ -1115,9 +1114,8 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags, if (beingDestroyed) return; - nsCOMPtr dsti = do_QueryInterface(docShell); nsCOMPtr parentDsti; - dsti->GetParent(getter_AddRefs(parentDsti)); + docShell->GetParent(getter_AddRefs(parentDsti)); docShell = do_QueryInterface(parentDsti); } @@ -2449,8 +2447,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow, else { // Otherwise, for content shells, start from the location of the caret. int32_t itemType; - nsCOMPtr shellItem = do_QueryInterface(docShell); - shellItem->GetItemType(&itemType); + docShell->GetItemType(&itemType); if (itemType != nsIDocShellTreeItem::typeChrome) { nsCOMPtr endSelectionContent; GetSelectionLocation(doc, presShell, @@ -2553,10 +2550,8 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow, // reached the beginning or end of the document. Traverse up to the parent // document and try again. - nsCOMPtr dsti = do_QueryInterface(docShell); - nsCOMPtr docShellParent; - dsti->GetParent(getter_AddRefs(docShellParent)); + docShell->GetParent(getter_AddRefs(docShellParent)); if (docShellParent) { // move up to the parent shell and try again from there. @@ -2969,8 +2964,8 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow, } else { int32_t itemType; - nsCOMPtr shellItem = do_QueryInterface(aWindow->GetDocShell()); - shellItem->GetItemType(&itemType); + nsCOMPtr docShell = aWindow->GetDocShell(); + docShell->GetItemType(&itemType); if (itemType == nsIDocShellTreeItem::typeChrome) return nullptr; @@ -3145,12 +3140,12 @@ nsFocusManager::GetNextTabbableDocument(nsIContent* aStartContent, bool aForward // If currentPopup is set, then the starting content is in a panel. nsIFrame* currentPopup = nullptr; nsCOMPtr doc; - nsCOMPtr startItem; + nsCOMPtr startDocShell; if (aStartContent) { doc = aStartContent->GetCurrentDoc(); if (doc) { - startItem = do_QueryInterface(doc->GetWindow()->GetDocShell()); + startDocShell = doc->GetWindow()->GetDocShell(); } // Check if the starting content is inside a panel. Document navigation @@ -3165,25 +3160,25 @@ nsFocusManager::GetNextTabbableDocument(nsIContent* aStartContent, bool aForward } } else if (mFocusedWindow) { - startItem = do_QueryInterface(mFocusedWindow->GetDocShell()); + startDocShell = mFocusedWindow->GetDocShell(); doc = mFocusedWindow->GetExtantDoc(); } else { nsCOMPtr webnav = do_GetInterface(mActiveWindow); - startItem = do_QueryInterface(webnav); + startDocShell = do_QueryInterface(webnav); if (mActiveWindow) { doc = mActiveWindow->GetExtantDoc(); } } - if (!startItem) + if (!startDocShell) return nullptr; // perform a depth first search (preorder) of the docshell tree // looking for an HTML Frame or a chrome document nsIContent* content = aStartContent; - nsCOMPtr curItem = startItem; + nsCOMPtr curItem = startDocShell.get(); nsCOMPtr nextItem; do { // If moving forward, check for a panel in the starting document. If one @@ -3216,7 +3211,7 @@ nsFocusManager::GetNextTabbableDocument(nsIContent* aStartContent, bool aForward GetNextDocShell(curItem, getter_AddRefs(nextItem)); if (!nextItem) { // wrap around to the beginning, which is the top of the tree - startItem->GetRootTreeItem(getter_AddRefs(nextItem)); + startDocShell->GetRootTreeItem(getter_AddRefs(nextItem)); } } else { @@ -3224,7 +3219,7 @@ nsFocusManager::GetNextTabbableDocument(nsIContent* aStartContent, bool aForward if (!nextItem) { // wrap around to the end, which is the last item in the tree nsCOMPtr rootItem; - startItem->GetRootTreeItem(getter_AddRefs(rootItem)); + startDocShell->GetRootTreeItem(getter_AddRefs(rootItem)); GetLastDocShell(rootItem, getter_AddRefs(nextItem)); } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index a2db3489ea3..d167fdd3078 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -80,8 +80,6 @@ #include "nsIContentViewerEdit.h" #include "nsIDocShell.h" #include "nsIDocShellLoadInfo.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIEditorDocShell.h" #include "nsIDocCharset.h" #include "nsIDocument.h" @@ -1765,8 +1763,7 @@ nsGlobalWindow::SetInitialPrincipalToSubject() // it for a content docshell. if (newWindowPrincipal == systemPrincipal) { int32_t itemType; - nsCOMPtr item = do_QueryInterface(GetDocShell()); - nsresult rv = item->GetItemType(&itemType); + nsresult rv = GetDocShell()->GetItemType(&itemType); if (NS_FAILED(rv) || itemType != nsIDocShellTreeItem::typeChrome) { newWindowPrincipal = nullptr; } @@ -2378,10 +2375,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, // situation when we're creating a temporary non-chrome-about-blank // document in a chrome docshell, don't notify just yet. Instead wait // until we have a real chrome doc. - nsCOMPtr treeItem(do_QueryInterface(mDocShell)); int32_t itemType = nsIDocShellTreeItem::typeContent; - if (treeItem) { - treeItem->GetItemType(&itemType); + if (mDocShell) { + mDocShell->GetItemType(&itemType); } if (itemType != nsIDocShellTreeItem::typeChrome || @@ -2910,13 +2906,12 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor) mIsDocumentLoaded = true; nsCOMPtr content(do_QueryInterface(GetFrameElementInternal())); - nsCOMPtr treeItem = - do_QueryInterface(GetDocShell()); + nsIDocShell* docShell = GetDocShell(); int32_t itemType = nsIDocShellTreeItem::typeChrome; - if (treeItem) { - treeItem->GetItemType(&itemType); + if (docShell) { + docShell->GetItemType(&itemType); } if (content && GetParentInternal() && @@ -3351,8 +3346,7 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent) baseWin->GetVisibility(&visible); if (!visible) { - nsCOMPtr treeItem(do_QueryInterface(mDocShell)); - treeItem->GetSameTypeRootTreeItem(getter_AddRefs(primaryContent)); + mDocShell->GetSameTypeRootTreeItem(getter_AddRefs(primaryContent)); } } } @@ -3667,12 +3661,11 @@ nsGlobalWindow::GetOpener(nsIDOMWindow** aOpener) // We don't want to reveal the opener if the opener is a mail window, // because opener can be used to spoof the contents of a message (bug 105050). // So, we look in the opener's root docshell to see if it's a mail window. - nsCOMPtr docShellAsItem = - do_QueryInterface(openerPwin->GetDocShell()); + nsCOMPtr openerDocShell = openerPwin->GetDocShell(); - if (docShellAsItem) { + if (openerDocShell) { nsCOMPtr openerRootItem; - docShellAsItem->GetRootTreeItem(getter_AddRefs(openerRootItem)); + openerDocShell->GetRootTreeItem(getter_AddRefs(openerRootItem)); nsCOMPtr openerRootDocShell(do_QueryInterface(openerRootItem)); if (openerRootDocShell) { uint32_t appType; @@ -3779,9 +3772,8 @@ nsGlobalWindow::GetName(nsAString& aName) FORWARD_TO_OUTER(GetName, (aName), NS_ERROR_NOT_INITIALIZED); nsXPIDLString name; - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - if (docShellAsItem) - docShellAsItem->GetName(getter_Copies(name)); + if (mDocShell) + mDocShell->GetName(getter_Copies(name)); aName.Assign(name); return NS_OK; @@ -3793,9 +3785,8 @@ nsGlobalWindow::SetName(const nsAString& aName) FORWARD_TO_OUTER(SetName, (aName), NS_ERROR_NOT_INITIALIZED); nsresult result = NS_OK; - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - if (docShellAsItem) - result = docShellAsItem->SetName(PromiseFlatString(aName).get()); + if (mDocShell) + result = mDocShell->SetName(PromiseFlatString(aName).get()); return result; } @@ -4411,14 +4402,13 @@ nsGlobalWindow::CheckSecurityWidthAndHeight(int32_t* aWidth, int32_t* aHeight) nsresult nsGlobalWindow::SetDocShellWidthAndHeight(int32_t aInnerWidth, int32_t aInnerHeight) { - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); nsCOMPtr treeOwner; - docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner)); + mDocShell->GetTreeOwner(getter_AddRefs(treeOwner)); NS_ENSURE_TRUE(treeOwner, NS_ERROR_FAILURE); - NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, aInnerWidth, aInnerHeight), + NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(mDocShell, aInnerWidth, aInnerHeight), NS_ERROR_FAILURE); return NS_OK; @@ -4694,17 +4684,13 @@ nsGlobalWindow::WindowExists(const nsAString& aName, caller = GetCallerDocShellTreeItem(); } - nsCOMPtr docShell = do_QueryInterface(mDocShell); - NS_ASSERTION(docShell, - "Docshell doesn't implement nsIDocShellTreeItem?"); - if (!caller) { - caller = docShell; + caller = mDocShell; } nsCOMPtr namedItem; - docShell->FindItemWithName(PromiseFlatString(aName).get(), nullptr, caller, - getter_AddRefs(namedItem)); + mDocShell->FindItemWithName(PromiseFlatString(aName).get(), nullptr, caller, + getter_AddRefs(namedItem)); return namedItem != nullptr; } @@ -4760,19 +4746,18 @@ nsGlobalWindow::SetFullScreenInternal(bool aFullScreen, bool aRequireTrust) // SetFullScreen needs to be called on the root window, so get that // via the DocShell tree, and if we are not already the root, // call SetFullScreen on that window instead. - nsCOMPtr treeItem = do_QueryInterface(mDocShell); nsCOMPtr rootItem; - treeItem->GetRootTreeItem(getter_AddRefs(rootItem)); + mDocShell->GetRootTreeItem(getter_AddRefs(rootItem)); nsCOMPtr window = do_GetInterface(rootItem); if (!window) return NS_ERROR_FAILURE; - if (rootItem != treeItem) + if (rootItem != mDocShell) return window->SetFullScreenInternal(aFullScreen, aRequireTrust); // make sure we don't try to set full screen on a non-chrome window, // which might happen in embedding world int32_t itemType; - treeItem->GetItemType(&itemType); + mDocShell->GetItemType(&itemType); if (itemType != nsIDocShellTreeItem::typeChrome) return NS_ERROR_FAILURE; @@ -4838,11 +4823,10 @@ nsGlobalWindow::GetFullScreen(bool* aFullScreen) // Get the fullscreen value of the root window, to always have the value // accurate, even when called from content. - nsCOMPtr treeItem = do_QueryInterface(mDocShell); - if (treeItem) { + if (mDocShell) { nsCOMPtr rootItem; - treeItem->GetRootTreeItem(getter_AddRefs(rootItem)); - if (rootItem != treeItem) { + mDocShell->GetRootTreeItem(getter_AddRefs(rootItem)); + if (rootItem != mDocShell) { nsCOMPtr window = do_GetInterface(rootItem); if (window) return window->GetFullScreen(aFullScreen); @@ -5337,10 +5321,8 @@ nsGlobalWindow::Focus() nsCOMPtr activeWindow; fm->GetActiveWindow(getter_AddRefs(activeWindow)); - nsCOMPtr treeItem = do_QueryInterface(mDocShell); - NS_ASSERTION(treeItem, "What happened?"); nsCOMPtr rootItem; - treeItem->GetRootTreeItem(getter_AddRefs(rootItem)); + mDocShell->GetRootTreeItem(getter_AddRefs(rootItem)); nsCOMPtr rootWin = do_GetInterface(rootItem); bool isActive = (rootWin == activeWindow); @@ -5368,7 +5350,7 @@ nsGlobalWindow::Focus() // XXXbz should we really be checking for IsInitialDocument() instead? bool lookForPresShell = true; int32_t itemType = nsIDocShellTreeItem::typeContent; - treeItem->GetItemType(&itemType); + mDocShell->GetItemType(&itemType); if (itemType == nsIDocShellTreeItem::typeChrome && GetPrivateRoot() == static_cast(this) && mDocument) { @@ -5385,7 +5367,7 @@ nsGlobalWindow::Focus() } nsCOMPtr parentDsti; - treeItem->GetParent(getter_AddRefs(parentDsti)); + mDocShell->GetParent(getter_AddRefs(parentDsti)); // set the parent's current focus to the frame containing this window. nsCOMPtr parent(do_GetInterface(parentDsti)); @@ -5802,8 +5784,7 @@ nsGlobalWindow::SizeToContent() nsIntSize newDevSize(CSSToDevIntPixels(cssSize)); - nsCOMPtr docShellAsItem = do_QueryInterface(mDocShell); - NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, + NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(mDocShell, newDevSize.width, newDevSize.height), NS_ERROR_FAILURE); @@ -6099,12 +6080,8 @@ nsGlobalWindow::RevisePopupAbuseLevel(PopupControlState aControl) NS_ASSERTION(mDocShell, "Must have docshell"); - nsCOMPtr item(do_QueryInterface(mDocShell)); - - NS_ASSERTION(item, "Docshell doesn't implement nsIDocShellTreeItem?"); - int32_t type = nsIDocShellTreeItem::typeChrome; - item->GetItemType(&type); + mDocShell->GetItemType(&type); if (type != nsIDocShellTreeItem::typeContent) return openAllowed; @@ -6959,11 +6936,10 @@ nsGlobalWindow::ReallyCloseWindow() // but if we're a browser window we could be in some nasty // self-destroying cascade that we should mostly ignore - nsCOMPtr docItem(do_QueryInterface(mDocShell)); - if (docItem) { + if (mDocShell) { nsCOMPtr bwin; nsCOMPtr rootItem; - docItem->GetRootTreeItem(getter_AddRefs(rootItem)); + mDocShell->GetRootTreeItem(getter_AddRefs(rootItem)); nsCOMPtr rootWin(do_GetInterface(rootItem)); nsCOMPtr chromeWin(do_QueryInterface(rootWin)); if (chromeWin) @@ -8190,14 +8166,14 @@ nsGlobalWindow::SetKeyboardIndicators(UIStateChangeType aShowAccelerators, mShowFocusRings = aShowFocusRings == UIStateChangeType_Set; // propagate the indicators to child windows - nsCOMPtr node = do_QueryInterface(GetDocShell()); - if (node) { + nsCOMPtr docShell = GetDocShell(); + if (docShell) { int32_t childCount = 0; - node->GetChildCount(&childCount); + docShell->GetChildCount(&childCount); for (int32_t i = 0; i < childCount; ++i) { nsCOMPtr childShell; - node->GetChildAt(i, getter_AddRefs(childShell)); + docShell->GetChildAt(i, getter_AddRefs(childShell)); nsCOMPtr childWindow = do_GetInterface(childShell); if (childWindow) { childWindow->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings); @@ -9495,15 +9471,14 @@ nsGlobalWindow::FireDelayedDOMEvents() ScheduleActiveTimerCallback(); } - nsCOMPtr node = - do_QueryInterface(GetDocShell()); - if (node) { + nsCOMPtr docShell = GetDocShell(); + if (docShell) { int32_t childCount = 0; - node->GetChildCount(&childCount); + docShell->GetChildCount(&childCount); for (int32_t i = 0; i < childCount; ++i) { nsCOMPtr childShell; - node->GetChildAt(i, getter_AddRefs(childShell)); + docShell->GetChildAt(i, getter_AddRefs(childShell)); NS_ASSERTION(childShell, "null child shell"); nsCOMPtr pWin = do_GetInterface(childShell); @@ -10532,18 +10507,16 @@ nsGlobalWindow::GetTreeOwner(nsIDocShellTreeOwner **aTreeOwner) { FORWARD_TO_OUTER(GetTreeOwner, (aTreeOwner), NS_ERROR_NOT_INITIALIZED); - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - // If there's no docShellAsItem, this window must have been closed, // in that case there is no tree owner. - if (!docShellAsItem) { + if (!mDocShell) { *aTreeOwner = nullptr; return NS_OK; } - return docShellAsItem->GetTreeOwner(aTreeOwner); + return mDocShell->GetTreeOwner(aTreeOwner); } nsresult @@ -10551,14 +10524,13 @@ nsGlobalWindow::GetTreeOwner(nsIBaseWindow **aTreeOwner) { FORWARD_TO_OUTER(GetTreeOwner, (aTreeOwner), NS_ERROR_NOT_INITIALIZED); - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); nsCOMPtr treeOwner; - // If there's no docShellAsItem, this window must have been closed, + // If there's no mDocShell, this window must have been closed, // in that case there is no tree owner. - if (docShellAsItem) { - docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner)); + if (mDocShell) { + mDocShell->GetTreeOwner(getter_AddRefs(treeOwner)); } if (!treeOwner) { @@ -10818,14 +10790,14 @@ nsGlobalWindow::SuspendTimeouts(uint32_t aIncrease, } // Suspend our children as well. - nsCOMPtr node(do_QueryInterface(GetDocShell())); - if (node) { + nsCOMPtr docShell = GetDocShell(); + if (docShell) { int32_t childCount = 0; - node->GetChildCount(&childCount); + docShell->GetChildCount(&childCount); for (int32_t i = 0; i < childCount; ++i) { nsCOMPtr childShell; - node->GetChildAt(i, getter_AddRefs(childShell)); + docShell->GetChildAt(i, getter_AddRefs(childShell)); NS_ASSERTION(childShell, "null child shell"); nsCOMPtr pWin = do_GetInterface(childShell); @@ -10922,15 +10894,14 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren) } // Resume our children as well. - nsCOMPtr node = - do_QueryInterface(GetDocShell()); - if (node) { + nsCOMPtr docShell = GetDocShell(); + if (docShell) { int32_t childCount = 0; - node->GetChildCount(&childCount); + docShell->GetChildCount(&childCount); for (int32_t i = 0; i < childCount; ++i) { nsCOMPtr childShell; - node->GetChildAt(i, getter_AddRefs(childShell)); + docShell->GetChildAt(i, getter_AddRefs(childShell)); NS_ASSERTION(childShell, "null child shell"); nsCOMPtr pWin = do_GetInterface(childShell); diff --git a/dom/base/nsGlobalWindowCommands.cpp b/dom/base/nsGlobalWindowCommands.cpp index f9b6d70de06..e9917bd6826 100644 --- a/dom/base/nsGlobalWindowCommands.cpp +++ b/dom/base/nsGlobalWindowCommands.cpp @@ -19,7 +19,6 @@ #include "nsPIDOMWindow.h" #include "nsIPresShell.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsISelectionController.h" #include "nsIWebNavigation.h" #include "nsIContentViewerEdit.h" @@ -243,10 +242,10 @@ nsSelectMoveScrollCommand::DoCommand(const char *aCommandName, nsISupports *aCom if (!caretOn) { caretOn = Preferences::GetBool("accessibility.browsewithcaret"); if (caretOn) { - nsCOMPtr dsti = do_QueryInterface(piWindow->GetDocShell()); - if (dsti) { + nsCOMPtr docShell = piWindow->GetDocShell(); + if (docShell) { int32_t itemType; - dsti->GetItemType(&itemType); + docShell->GetItemType(&itemType); if (itemType == nsIDocShellTreeItem::typeChrome) { caretOn = false; } diff --git a/dom/base/nsHistory.cpp b/dom/base/nsHistory.cpp index e0c1e57678e..b3ee74a2859 100644 --- a/dom/base/nsHistory.cpp +++ b/dom/base/nsHistory.cpp @@ -14,7 +14,6 @@ #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIWebNavigation.h" #include "nsIHistoryEntry.h" #include "nsIURI.h" @@ -377,12 +376,11 @@ nsHistory::GetSessionHistoryFromDocShell(nsIDocShell * aDocShell, */ // QI mDocShell to nsIDocShellTreeItem - nsCOMPtr dsTreeItem(do_QueryInterface(aDocShell)); - NS_ENSURE_TRUE(dsTreeItem, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(aDocShell, NS_ERROR_FAILURE); // Get the root DocShell from it nsCOMPtr root; - dsTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root)); + aDocShell->GetSameTypeRootTreeItem(getter_AddRefs(root)); NS_ENSURE_TRUE(root, NS_ERROR_FAILURE); //QI root to nsIWebNavigation diff --git a/dom/base/nsScreen.cpp b/dom/base/nsScreen.cpp index 7b9f9773562..64d69c3f384 100644 --- a/dom/base/nsScreen.cpp +++ b/dom/base/nsScreen.cpp @@ -24,13 +24,12 @@ namespace { bool IsChromeType(nsIDocShell *aDocShell) { - nsCOMPtr ds = do_QueryInterface(aDocShell); - if (!ds) { + if (!aDocShell) { return false; } int32_t itemType; - ds->GetItemType(&itemType); + aDocShell->GetItemType(&itemType); return itemType == nsIDocShellTreeItem::typeChrome; } diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 0897c047833..064af539d71 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -45,7 +45,6 @@ #include "nsIDOMWindow.h" #include "nsIDOMWindowUtils.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIJSContextStack.h" diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index d54f45880f5..07f4b6c2092 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -214,17 +214,16 @@ nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName, // see bug 217886 for details // XXXbz what if our browser isn't targetable? We need to handle that somehow. if(name.LowerCaseEqualsLiteral("_content") || name.EqualsLiteral("_main")) { - *aFoundItem = mWebBrowser->mDocShellAsItem; + *aFoundItem = mWebBrowser->mDocShell; NS_IF_ADDREF(*aFoundItem); return NS_OK; } - if (!SameCOMIdentity(aRequestor, mWebBrowser->mDocShellAsItem)) { + if (!SameCOMIdentity(aRequestor, mWebBrowser->mDocShell)) { // This isn't a request coming up from our kid, so check with said kid nsISupports* thisSupports = static_cast(this); - rv = - mWebBrowser->mDocShellAsItem->FindItemWithName(aName, thisSupports, - aOriginalRequestor, aFoundItem); + rv = mWebBrowser->mDocShell->FindItemWithName(aName, thisSupports, + aOriginalRequestor, aFoundItem); if (NS_FAILED(rv) || *aFoundItem) { return rv; } @@ -234,7 +233,7 @@ nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName, if(mTreeOwner) { nsCOMPtr reqAsTreeOwner(do_QueryInterface(aRequestor)); if (mTreeOwner != reqAsTreeOwner) - return mTreeOwner->FindItemWithName(aName, mWebBrowser->mDocShellAsItem, + return mTreeOwner->FindItemWithName(aName, mWebBrowser->mDocShell, aOriginalRequestor, aFoundItem); return NS_OK; } @@ -355,7 +354,7 @@ nsDocShellTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell) if(mTreeOwner) return mTreeOwner->GetPrimaryContentShell(aShell); - *aShell = (mPrimaryContentShell ? mPrimaryContentShell : mWebBrowser->mDocShellAsItem.get()); + *aShell = (mPrimaryContentShell ? mPrimaryContentShell : mWebBrowser->mDocShell); NS_IF_ADDREF(*aShell); return NS_OK; @@ -372,7 +371,7 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, if(mTreeOwner) return mTreeOwner->SizeShellTo(aShellItem, aCX, aCY); - if(aShellItem == mWebBrowser->mDocShellAsItem) + if(aShellItem == mWebBrowser->mDocShell) return webBrowserChrome->SizeBrowserTo(aCX, aCY); nsCOMPtr webNav(do_QueryInterface(aShellItem)); diff --git a/embedding/browser/webBrowser/nsWebBrowser.cpp b/embedding/browser/webBrowser/nsWebBrowser.cpp index 1005aa06cd4..e37752a2673 100644 --- a/embedding/browser/webBrowser/nsWebBrowser.cpp +++ b/embedding/browser/webBrowser/nsWebBrowser.cpp @@ -405,7 +405,7 @@ NS_IMETHODIMP nsWebBrowser::GetName(PRUnichar** aName) NS_ENSURE_ARG_POINTER(aName); if(mDocShell) - mDocShellAsItem->GetName(aName); + mDocShell->GetName(aName); else *aName = ToNewUnicode(mInitInfo->name); @@ -416,10 +416,7 @@ NS_IMETHODIMP nsWebBrowser::SetName(const PRUnichar* aName) { if(mDocShell) { - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE); - - return docShellAsItem->SetName(aName); + return mDocShell->SetName(aName); } else mInitInfo->name = aName; @@ -433,9 +430,7 @@ NS_IMETHODIMP nsWebBrowser::NameEquals(const PRUnichar *aName, bool *_retval) NS_ENSURE_ARG_POINTER(_retval); if(mDocShell) { - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE); - return docShellAsItem->NameEquals(aName, _retval); + return mDocShell->NameEquals(aName, _retval); } else *_retval = mInitInfo->name.Equals(aName); @@ -455,10 +450,10 @@ NS_IMETHODIMP nsWebBrowser::SetItemType(int32_t aItemType) { NS_ENSURE_TRUE((aItemType == typeContentWrapper || aItemType == typeChromeWrapper), NS_ERROR_FAILURE); mContentType = aItemType; - if (mDocShellAsItem) - mDocShellAsItem->SetItemType(mContentType == typeChromeWrapper - ? static_cast(typeChrome) - : static_cast(typeContent)); + if (mDocShell) + mDocShell->SetItemType(mContentType == typeChromeWrapper + ? static_cast(typeChrome) + : static_cast(typeContent)); return NS_OK; } @@ -515,7 +510,7 @@ NS_IMETHODIMP nsWebBrowser::FindItemWithName(const PRUnichar *aName, NS_ENSURE_STATE(mDocShell); NS_ASSERTION(mDocShellTreeOwner, "This should always be set when in this situation"); - return mDocShellAsItem->FindItemWithName(aName, + return mDocShell->FindItemWithName(aName, static_cast(mDocShellTreeOwner), aOriginalRequestor, _retval); } @@ -1176,16 +1171,16 @@ NS_IMETHODIMP nsWebBrowser::Create() docShellParentWidget, mInitInfo->x, mInitInfo->y, mInitInfo->cx, mInitInfo->cy), NS_ERROR_FAILURE); - mDocShellAsItem->SetName(mInitInfo->name.get()); + mDocShell->SetName(mInitInfo->name.get()); if (mContentType == typeChromeWrapper) { - mDocShellAsItem->SetItemType(nsIDocShellTreeItem::typeChrome); + mDocShell->SetItemType(nsIDocShellTreeItem::typeChrome); } else { - mDocShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent); + mDocShell->SetItemType(nsIDocShellTreeItem::typeContent); } - mDocShellAsItem->SetTreeOwner(mDocShellTreeOwner); + mDocShell->SetTreeOwner(mDocShellTreeOwner); // If the webbrowser is a content docshell item then we won't hear any // events from subframes. To solve that we install our own chrome event handler @@ -1598,18 +1593,16 @@ NS_IMETHODIMP nsWebBrowser::SetDocShell(nsIDocShell* aDocShell) nsCOMPtr req(do_QueryInterface(aDocShell)); nsCOMPtr baseWin(do_QueryInterface(aDocShell)); - nsCOMPtr item(do_QueryInterface(aDocShell)); nsCOMPtr nav(do_QueryInterface(aDocShell)); nsCOMPtr scrollable(do_QueryInterface(aDocShell)); nsCOMPtr textScroll(do_QueryInterface(aDocShell)); nsCOMPtr progress(do_GetInterface(aDocShell)); - NS_ENSURE_TRUE(req && baseWin && item && nav && scrollable && textScroll && progress, + NS_ENSURE_TRUE(req && baseWin && nav && scrollable && textScroll && progress, NS_ERROR_FAILURE); mDocShell = aDocShell; mDocShellAsReq = req; mDocShellAsWin = baseWin; - mDocShellAsItem = item; mDocShellAsNav = nav; mDocShellAsScrollable = scrollable; mDocShellAsTextScroll = textScroll; @@ -1635,7 +1628,6 @@ NS_IMETHODIMP nsWebBrowser::SetDocShell(nsIDocShell* aDocShell) mDocShell = nullptr; mDocShellAsReq = nullptr; mDocShellAsWin = nullptr; - mDocShellAsItem = nullptr; mDocShellAsNav = nullptr; mDocShellAsScrollable = nullptr; mDocShellAsTextScroll = nullptr; diff --git a/embedding/browser/webBrowser/nsWebBrowser.h b/embedding/browser/webBrowser/nsWebBrowser.h index 0672e98387f..27f62caf420 100644 --- a/embedding/browser/webBrowser/nsWebBrowser.h +++ b/embedding/browser/webBrowser/nsWebBrowser.h @@ -131,7 +131,6 @@ protected: nsCOMPtr mDocShell; nsCOMPtr mDocShellAsReq; nsCOMPtr mDocShellAsWin; - nsCOMPtr mDocShellAsItem; nsCOMPtr mDocShellAsNav; nsCOMPtr mDocShellAsScrollable; nsCOMPtr mDocShellAsTextScroll; diff --git a/embedding/components/find/src/nsWebBrowserFind.cpp b/embedding/components/find/src/nsWebBrowserFind.cpp index 249f604d8f7..98570050f1b 100644 --- a/embedding/components/find/src/nsWebBrowserFind.cpp +++ b/embedding/components/find/src/nsWebBrowserFind.cpp @@ -18,7 +18,6 @@ #include "nsIURI.h" #include "nsIDocShell.h" #include "nsIEnumerator.h" -#include "nsIDocShellTreeItem.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIDocument.h" diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 27e14e9f9c1..e11648b3162 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -53,8 +53,6 @@ #include "nsIMarkupDocumentViewer.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIDocShellTreeOwner.h" #include "nsIDocShell.h" #include "nsIBaseWindow.h" @@ -1330,14 +1328,11 @@ AttachContainerRecurse(nsIDocShell* aShell) } // Now recurse through the children - nsCOMPtr node = do_QueryInterface(aShell); - NS_ASSERTION(node, "docshells must implement nsIDocShellTreeNode"); - int32_t childCount; - node->GetChildCount(&childCount); + aShell->GetChildCount(&childCount); for (int32_t i = 0; i < childCount; ++i) { nsCOMPtr childItem; - node->GetChildAt(i, getter_AddRefs(childItem)); + aShell->GetChildAt(i, getter_AddRefs(childItem)); AttachContainerRecurse(nsCOMPtr(do_QueryInterface(childItem))); } } @@ -1487,14 +1482,11 @@ DetachContainerRecurse(nsIDocShell *aShell) } // Now recurse through the children - nsCOMPtr node = do_QueryInterface(aShell); - NS_ASSERTION(node, "docshells must implement nsIDocShellTreeNode"); - int32_t childCount; - node->GetChildCount(&childCount); + aShell->GetChildCount(&childCount); for (int32_t i = 0; i < childCount; ++i) { nsCOMPtr childItem; - node->GetChildAt(i, getter_AddRefs(childItem)); + aShell->GetChildAt(i, getter_AddRefs(childItem)); DetachContainerRecurse(nsCOMPtr(do_QueryInterface(childItem))); } } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index de3e5d32f1a..e0ad31e1d5c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -42,7 +42,6 @@ #include "nsPIDOMWindow.h" #include "nsIBaseWindow.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIWidget.h" #include "gfxMatrix.h" #include "gfxPoint3D.h" @@ -4462,9 +4461,8 @@ nsLayoutUtils::GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow) } } - nsCOMPtr curItem = do_QueryInterface(docShell); nsCOMPtr parentItem; - curItem->GetParent(getter_AddRefs(parentItem)); + docShell->GetParent(getter_AddRefs(parentItem)); docShell = do_QueryInterface(parentItem); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index caac6f48c01..7da8d00ec5c 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -13,7 +13,6 @@ #include "nsPresContext.h" #include "nsIPresShell.h" #include "nsILinkHandler.h" -#include "nsIDocShellTreeItem.h" #include "nsIDocShell.h" #include "nsIContentViewer.h" #include "nsPIDOMWindow.h" diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 82abd9cd4c8..a6e197b8589 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -101,8 +101,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsIMarkupDocumentViewer.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsIDocShellTreeOwner.h" #include "nsIWebBrowserChrome.h" #include "nsIBaseWindow.h" @@ -529,9 +527,8 @@ nsPrintEngine::DoCommonPrint(bool aIsPrintPreview, mPrt->mPrintObject->mFrameType = mPrt->mIsParentAFrameSet ? eFrameSet : eDoc; // Build the "tree" of PrintObjects - nsCOMPtr parentAsNode = - do_QueryInterface(mPrt->mPrintObject->mDocShell); - BuildDocTree(parentAsNode, &mPrt->mPrintDocList, mPrt->mPrintObject); + BuildDocTree(mPrt->mPrintObject->mDocShell, &mPrt->mPrintDocList, + mPrt->mPrintObject); } if (!aIsPrintPreview) { @@ -1037,11 +1034,10 @@ nsPrintEngine::ShowPrintProgress(bool aIsForPrinting, bool& aDoNotify) nsPIDOMWindow *domWin = mDocument->GetWindow(); if (!domWin) return; - nsCOMPtr docShellItem = - do_QueryInterface(domWin->GetDocShell()); - if (!docShellItem) return; + nsCOMPtr docShell = domWin->GetDocShell(); + if (!docShell) return; nsCOMPtr owner; - docShellItem->GetTreeOwner(getter_AddRefs(owner)); + docShell->GetTreeOwner(getter_AddRefs(owner)); nsCOMPtr browserChrome = do_GetInterface(owner); if (!browserChrome) return; bool isModal = true; @@ -1111,8 +1107,7 @@ bool nsPrintEngine::IsParentAFrameSet(nsIDocShell * aParent) { // See if the incoming doc is the root document - nsCOMPtr parentAsItem(do_QueryInterface(aParent)); - if (!parentAsItem) return false; + if (!aParent) return false; // When it is the top level document we need to check // to see if it contains a frameset. If it does, then @@ -3125,25 +3120,23 @@ nsPrintEngine::IsWindowsInOurSubTree(nsPIDOMWindow * window) // now check to make sure it is in "our" tree of docshells if (window) { - nsCOMPtr docShellAsItem = - do_QueryInterface(window->GetDocShell()); + nsCOMPtr docShell = window->GetDocShell(); - if (docShellAsItem) { + if (docShell) { // get this DocViewer docshell nsCOMPtr thisDVDocShell(do_QueryReferent(mContainer)); while (!found) { - nsCOMPtr parentDocshell(do_QueryInterface(docShellAsItem)); - if (parentDocshell) { - if (parentDocshell == thisDVDocShell) { + if (docShell) { + if (docShell == thisDVDocShell) { found = true; break; } } else { break; // at top of tree } - nsCOMPtr docShellParent; - docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent)); - docShellAsItem = docShellParent; + nsCOMPtr docShellItemParent; + docShell->GetSameTypeParent(getter_AddRefs(docShellItemParent)); + docShell = do_QueryInterface(docShellItemParent); } // while } } // scriptobj diff --git a/layout/printing/nsPrintObject.cpp b/layout/printing/nsPrintObject.cpp index 8e3e6b8717c..6a1d5c582e5 100644 --- a/layout/printing/nsPrintObject.cpp +++ b/layout/printing/nsPrintObject.cpp @@ -57,16 +57,14 @@ nsPrintObject::Init(nsIDocShell* aDocShell, nsIDOMDocument* aDoc, mDocShell = aDocShell; } else { mTreeOwner = do_GetInterface(aDocShell); - nsCOMPtr item = do_QueryInterface(aDocShell); int32_t itemType = 0; - item->GetItemType(&itemType); + aDocShell->GetItemType(&itemType); // Create a container docshell for printing. mDocShell = do_CreateInstance("@mozilla.org/docshell;1"); NS_ENSURE_TRUE(mDocShell, NS_ERROR_OUT_OF_MEMORY); mDidCreateDocShell = true; - nsCOMPtr newItem = do_QueryInterface(mDocShell); - newItem->SetItemType(itemType); - newItem->SetTreeOwner(mTreeOwner); + mDocShell->SetItemType(itemType); + mDocShell->SetTreeOwner(mTreeOwner); } NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); diff --git a/layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp b/layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp index 072b2f216d7..4222dee9063 100644 --- a/layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp +++ b/layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp @@ -7,8 +7,6 @@ #include "nsLayoutDebuggingTools.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeNode.h" -#include "nsIDocShellTreeItem.h" #include "nsPIDOMWindow.h" #include "nsIContentViewer.h" @@ -342,8 +340,7 @@ NS_IMETHODIMP nsLayoutDebuggingTools::DumpWebShells() { NS_ENSURE_TRUE(mDocShell, NS_ERROR_NOT_INITIALIZED); - nsCOMPtr shellAsItem(do_QueryInterface(mDocShell)); - DumpAWebShell(shellAsItem, stdout, 0); + DumpAWebShell(mDocShell, stdout, 0); return NS_OK; } @@ -366,11 +363,10 @@ DumpContentRecur(nsIDocShell* aDocShell, FILE* out) } // dump the frames of the sub documents int32_t i, n; - nsCOMPtr docShellAsNode(do_QueryInterface(aDocShell)); - docShellAsNode->GetChildCount(&n); + aDocShell->GetChildCount(&n); for (i = 0; i < n; ++i) { nsCOMPtr child; - docShellAsNode->GetChildAt(i, getter_AddRefs(child)); + aDocShell->GetChildAt(i, getter_AddRefs(child)); nsCOMPtr childAsShell(do_QueryInterface(child)); if (child) { DumpContentRecur(childAsShell, out); @@ -406,11 +402,10 @@ DumpFramesRecur(nsIDocShell* aDocShell, FILE* out) // dump the frames of the sub documents int32_t i, n; - nsCOMPtr docShellAsNode(do_QueryInterface(aDocShell)); - docShellAsNode->GetChildCount(&n); + aDocShell->GetChildCount(&n); for (i = 0; i < n; ++i) { nsCOMPtr child; - docShellAsNode->GetChildAt(i, getter_AddRefs(child)); + aDocShell->GetChildAt(i, getter_AddRefs(child)); nsCOMPtr childAsShell(do_QueryInterface(child)); if (childAsShell) { DumpFramesRecur(childAsShell, out); @@ -446,11 +441,10 @@ DumpViewsRecur(nsIDocShell* aDocShell, FILE* out) // dump the views of the sub documents int32_t i, n; - nsCOMPtr docShellAsNode(do_QueryInterface(aDocShell)); - docShellAsNode->GetChildCount(&n); + aDocShell->GetChildCount(&n); for (i = 0; i < n; i++) { nsCOMPtr child; - docShellAsNode->GetChildAt(i, getter_AddRefs(child)); + aDocShell->GetChildAt(i, getter_AddRefs(child)); nsCOMPtr childAsShell(do_QueryInterface(child)); if (childAsShell) { DumpViewsRecur(childAsShell, out); diff --git a/layout/tools/layout-debug/src/nsRegressionTester.cpp b/layout/tools/layout-debug/src/nsRegressionTester.cpp index af942203e6d..652caf1eebc 100644 --- a/layout/tools/layout-debug/src/nsRegressionTester.cpp +++ b/layout/tools/layout-debug/src/nsRegressionTester.cpp @@ -10,8 +10,6 @@ #include "nsReadableUtils.h" #include "nsIWindowWatcher.h" #include "nsVoidArray.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeNode.h" #include "nsPIDOMWindow.h" #include "nsIPresShell.h" #include "nsIURI.h" diff --git a/layout/xul/base/src/nsResizerFrame.cpp b/layout/xul/base/src/nsResizerFrame.cpp index 0d1cabe4b98..1a94c0c56f4 100644 --- a/layout/xul/base/src/nsResizerFrame.cpp +++ b/layout/xul/base/src/nsResizerFrame.cpp @@ -17,7 +17,6 @@ #include "nsPresContext.h" #include "nsFrameManager.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeOwner.h" #include "nsIBaseWindow.h" #include "nsPIDOMWindow.h" @@ -364,11 +363,10 @@ nsResizerFrame::GetContentToResize(nsIPresShell* aPresShell, nsIBaseWindow** aWi // get the document and the window - should this be cached? nsPIDOMWindow *domWindow = aPresShell->GetDocument()->GetWindow(); if (domWindow) { - nsCOMPtr docShellAsItem = - do_QueryInterface(domWindow->GetDocShell()); - if (docShellAsItem) { + nsCOMPtr docShell = domWindow->GetDocShell(); + if (docShell) { nsCOMPtr treeOwner; - docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner)); + docShell->GetTreeOwner(getter_AddRefs(treeOwner)); if (treeOwner) { CallQueryInterface(treeOwner, aWindow); } diff --git a/layout/xul/base/src/nsXULPopupManager.cpp b/layout/xul/base/src/nsXULPopupManager.cpp index 2f15844bd7c..2d4735ae415 100644 --- a/layout/xul/base/src/nsXULPopupManager.cpp +++ b/layout/xul/base/src/nsXULPopupManager.cpp @@ -24,7 +24,6 @@ #include "nsIComponentManager.h" #include "nsITimer.h" #include "nsFocusManager.h" -#include "nsIDocShellTreeItem.h" #include "nsIDocShell.h" #include "nsPIDOMWindow.h" #include "nsIInterfaceRequestorUtils.h" diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index c86b9b9959a..6e16a132268 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -13,7 +13,6 @@ #include "nsNetUtil.h" #include "nsISupportsPriority.h" #include "nsIAuthPromptProvider.h" -#include "nsIDocShellTreeItem.h" #include "nsIBadCertListener2.h" #include "nsICacheEntryDescriptor.h" #include "nsSerializationHelper.h" diff --git a/netwerk/protocol/http/HttpChannelParentListener.cpp b/netwerk/protocol/http/HttpChannelParentListener.cpp index 98003a91a7d..57eb778096c 100644 --- a/netwerk/protocol/http/HttpChannelParentListener.cpp +++ b/netwerk/protocol/http/HttpChannelParentListener.cpp @@ -14,7 +14,6 @@ #include "nsNetUtil.h" #include "nsISupportsPriority.h" #include "nsIAuthPromptProvider.h" -#include "nsIDocShellTreeItem.h" #include "nsIBadCertListener2.h" #include "nsICacheEntryDescriptor.h" #include "nsSerializationHelper.h" diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index 49e9466d005..839bef8d534 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp @@ -235,13 +235,11 @@ nsHtml5TreeOpExecutor::SetDocumentCharsetAndSource(nsACString& aCharset, int32_t // in this block of code, if we get an error result, we return // it but if we get a null pointer, that's perfectly legal for // parent and parentContentViewer - nsCOMPtr docShellAsItem = - do_QueryInterface(mDocShell); - if (!docShellAsItem) { + if (!mDocShell) { return; } nsCOMPtr parentAsItem; - docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem)); + mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem)); nsCOMPtr parent(do_QueryInterface(parentAsItem)); if (parent) { nsCOMPtr parentContentViewer; @@ -880,9 +878,8 @@ nsHtml5TreeOpExecutor::MaybeComplainAboutCharset(const char* aMsgId, // the embedded different-origin pages anyway and can't fix problems even // if alerted about them. if (!strcmp(aMsgId, "EncNoDeclaration") && mDocShell) { - nsCOMPtr treeItem = do_QueryInterface(mDocShell); nsCOMPtr parent; - treeItem->GetSameTypeParent(getter_AddRefs(parent)); + mDocShell->GetSameTypeParent(getter_AddRefs(parent)); if (parent) { return; } diff --git a/widget/xpwidgets/nsBaseFilePicker.cpp b/widget/xpwidgets/nsBaseFilePicker.cpp index 6082c6ce053..08cb4b85396 100644 --- a/widget/xpwidgets/nsBaseFilePicker.cpp +++ b/widget/xpwidgets/nsBaseFilePicker.cpp @@ -7,7 +7,6 @@ #include "nsCOMPtr.h" #include "nsPIDOMWindow.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIBaseWindow.h" #include "nsIWidget.h"