bug 841436 - remove nolonger needed qi from nsIDocShell to nsIDocShellTreeItem r=bz

This commit is contained in:
Trevor Saunders 2013-02-12 17:02:51 -05:00
parent 169a18c6bc
commit 36453999ea
50 changed files with 216 additions and 361 deletions

View File

@ -15,7 +15,6 @@
#include "mozilla/dom/Element.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsPoint.h"

View File

@ -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<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(GetNode());
NS_ASSERTION(docShellTreeItem, "No docshell tree item for mContent");
if (!docShellTreeItem) {
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(GetNode());
NS_ASSERTION(docShell, "No docshell for mContent");
if (!docShell) {
return nullptr;
}
nsCOMPtr<nsIDocShellTreeItem> root;
docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
docShell->GetRootTreeItem(getter_AddRefs(root));
NS_ASSERTION(root, "No root content tree item");
if (!root) {
return nullptr;

View File

@ -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<nsIDocShellTreeItem> treeItem(GetDocShellTreeItemFor(aNode));
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode));
if (!treeItem)
return coords;
@ -396,18 +395,15 @@ nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
return coords;
}
already_AddRefed<nsIDocShellTreeItem>
nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
already_AddRefed<nsIDocShell>
nsCoreUtils::GetDocShellFor(nsINode *aNode)
{
if (!aNode)
return nullptr;
nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
nsIDocShellTreeItem *docShellTreeItem = nullptr;
if (container)
CallQueryInterface(container, &docShellTreeItem);
return docShellTreeItem;
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
return docShell.forget();
}
bool

View File

@ -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<nsIDocShellTreeItem>
GetDocShellTreeItemFor(nsINode *aNode);
static already_AddRefed<nsIDocShell> GetDocShellFor(nsINode *aNode);
/**
* Return true if the given document is root document.

View File

@ -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<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(mDocumentNode);
if (docShellTreeItem) {
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
if (docShell) {
nsCOMPtr<nsIDocShellTreeItem> 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;

View File

@ -1482,9 +1482,8 @@ HyperTextAccessible::GetEditor() const
return nullptr;
}
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(mContent);
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShellTreeItem));
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mContent);
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShell));
if (!editingSession)
return nullptr; // No editing session interface

View File

@ -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<nsIDocShellTreeItem> treeItem =
nsCoreUtils::GetDocShellTreeItemFor(mDocumentNode);
NS_ENSURE_TRUE(treeItem, 0);
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
NS_ENSURE_TRUE(docShell, 0);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
NS_ENSURE_TRUE(treeOwner, 0);
nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwner));
if (!xulWin) {

View File

@ -77,15 +77,14 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
if (iid != IID_IAccessible)
return E_NOINTERFACE;
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(mContent);
if (!docShellTreeItem)
nsCOMPtr<nsIDocShell> 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<nsIDocShellTreeItem> root;
docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
docShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
if (!root)
return E_UNEXPECTED;

View File

@ -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"

View File

@ -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"

View File

@ -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,24 +806,20 @@ nsContentSink::PrefetchHref(const nsAString &aHref,
nsCOMPtr<nsIDocShell> docshell = mDocShell;
nsCOMPtr<nsIDocShellTreeItem> treeItem, parentItem;
nsCOMPtr<nsIDocShellTreeItem> 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));
docshell->GetParent(getter_AddRefs(parentItem));
if (parentItem) {
treeItem = parentItem;
docshell = do_QueryInterface(treeItem);
docshell = do_QueryInterface(parentItem);
if (!docshell) {
NS_ERROR("cannot get a docshell from a treeItem!");
return;
}
}
}
} while (parentItem);
// OK, we passed the security check...

View File

@ -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"

View File

@ -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<nsIDocShellTreeItem> ourTreeItem = do_QueryInterface(ourDocshell);
nsCOMPtr<nsIDocShellTreeItem> otherTreeItem =
do_QueryInterface(otherDocshell);
nsCOMPtr<nsIDocShellTreeItem> ourRootTreeItem, otherRootTreeItem;
ourTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(ourRootTreeItem));
otherTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(otherRootTreeItem));
ourDocshell->GetSameTypeRootTreeItem(getter_AddRefs(ourRootTreeItem));
otherDocshell->GetSameTypeRootTreeItem(getter_AddRefs(otherRootTreeItem));
nsCOMPtr<nsIWebNavigation> ourRootWebnav =
do_QueryInterface(ourRootTreeItem);
nsCOMPtr<nsIWebNavigation> 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<nsIDocShellTreeOwner> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> ourItem = do_QueryInterface(mDocShell);
if (ourItem) {
if (mDocShell) {
nsCOMPtr<nsIDocShellTreeItem> parentItem;
ourItem->GetParent(getter_AddRefs(parentItem));
mDocShell->GetParent(getter_AddRefs(parentItem));
nsCOMPtr<nsIDocShellTreeOwner> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
NS_ASSERTION(treeItem, "docshell must be a treeitem!");
// Check that we're still in the docshell tree.
nsCOMPtr<nsIDocShellTreeOwner> 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<nsIDocShellTreeItem> 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<nsIWebNavigation> 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<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
if (!docShellAsItem) {
if (!mDocShell) {
return;
}
nsCOMPtr<nsIDocShellTreeItem> 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);
}
}

View File

@ -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<nsIDocShell> docShell = NS_CP_GetDocShellFromContext(mContext);
nsCOMPtr<nsIDocShellTreeItem> currentDocShellTreeItem(do_QueryInterface(docShell));
if (!currentDocShellTreeItem) {
if (!docShell) {
return NS_OK;
}
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> currentDocShellTreeItem(do_QueryInterface(docShell));
NS_ASSERTION(currentDocShellTreeItem, "No DocShellTreeItem from docshell");
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocument> rootDoc = do_GetInterface(sameTypeRoot);
NS_ASSERTION(rootDoc, "No root document from document shell root tree item.");

View File

@ -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"

View File

@ -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"

View File

@ -25,7 +25,6 @@
#include "nsCRT.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIWebNavigation.h"
#include "nsIDocShellTreeItem.h"
#include "nsIScriptContext.h"
using namespace mozilla;

View File

@ -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 <algorithm>

View File

@ -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"

View File

@ -53,7 +53,6 @@
#include "nsVideoFrame.h"
#include "BasicLayers.h"
#include <limits>
#include "nsIDocShellTreeItem.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIAppShell.h"
#include "nsWidgetsCID.h"

View File

@ -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"

View File

@ -9,7 +9,6 @@
#include "nsContentCreatorFunctions.h"
#include "nsHTMLMediaElement.h"
#include "nsIDocumentInlines.h"
#include "nsIDocShellTreeItem.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Element.h"

View File

@ -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<nsIDocShellTreeItem> docShellAsItem =
do_QueryInterface(mDocShell);
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem));
nsCOMPtr<nsIDocShell> parent(do_QueryInterface(parentAsItem));
if (parent) {

View File

@ -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<nsIDocShell> docShell(do_QueryInterface(aContainer));
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
if (docShellAsItem) {
docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
if (docShell) {
docShell->GetSameTypeParent(getter_AddRefs(parentAsItem));
}
nsCOMPtr<nsIDocShell> 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);

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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<nsIDocShellTreeItem> dsti = do_QueryInterface(docShell);
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> shellItem = do_QueryInterface(docShell);
shellItem->GetItemType(&itemType);
docShell->GetItemType(&itemType);
if (itemType != nsIDocShellTreeItem::typeChrome) {
nsCOMPtr<nsIContent> 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<nsIDocShellTreeItem> dsti = do_QueryInterface(docShell);
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> shellItem = do_QueryInterface(aWindow->GetDocShell());
shellItem->GetItemType(&itemType);
nsCOMPtr<nsIDocShell> 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<nsIDocument> doc;
nsCOMPtr<nsIDocShellTreeItem> startItem;
nsCOMPtr<nsIDocShell> 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<nsIWebNavigation> 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<nsIDocShellTreeItem> curItem = startItem;
nsCOMPtr<nsIDocShellTreeItem> curItem = startDocShell.get();
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> rootItem;
startItem->GetRootTreeItem(getter_AddRefs(rootItem));
startDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
GetLastDocShell(rootItem, getter_AddRefs(nextItem));
}

View File

@ -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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> 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<nsIContent> content(do_QueryInterface(GetFrameElementInternal()));
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> docShellAsItem =
do_QueryInterface(openerPwin->GetDocShell());
nsCOMPtr<nsIDocShell> openerDocShell = openerPwin->GetDocShell();
if (docShellAsItem) {
if (openerDocShell) {
nsCOMPtr<nsIDocShellTreeItem> openerRootItem;
docShellAsItem->GetRootTreeItem(getter_AddRefs(openerRootItem));
openerDocShell->GetRootTreeItem(getter_AddRefs(openerRootItem));
nsCOMPtr<nsIDocShell> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeOwner> 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,16 +4684,12 @@ nsGlobalWindow::WindowExists(const nsAString& aName,
caller = GetCallerDocShellTreeItem();
}
nsCOMPtr<nsIDocShellTreeItem> docShell = do_QueryInterface(mDocShell);
NS_ASSERTION(docShell,
"Docshell doesn't implement nsIDocShellTreeItem?");
if (!caller) {
caller = docShell;
caller = mDocShell;
}
nsCOMPtr<nsIDocShellTreeItem> namedItem;
docShell->FindItemWithName(PromiseFlatString(aName).get(), nullptr, caller,
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<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
nsCOMPtr<nsIDocShellTreeItem> rootItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsPIDOMWindow> 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<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
if (treeItem) {
if (mDocShell) {
nsCOMPtr<nsIDocShellTreeItem> rootItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
if (rootItem != treeItem) {
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
if (rootItem != mDocShell) {
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(rootItem);
if (window)
return window->GetFullScreen(aFullScreen);
@ -5337,10 +5321,8 @@ nsGlobalWindow::Focus()
nsCOMPtr<nsIDOMWindow> activeWindow;
fm->GetActiveWindow(getter_AddRefs(activeWindow));
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
NS_ASSERTION(treeItem, "What happened?");
nsCOMPtr<nsIDocShellTreeItem> rootItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDOMWindow> 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<nsIDOMWindow*>(this) &&
mDocument) {
@ -5385,7 +5367,7 @@ nsGlobalWindow::Focus()
}
nsCOMPtr<nsIDocShellTreeItem> parentDsti;
treeItem->GetParent(getter_AddRefs(parentDsti));
mDocShell->GetParent(getter_AddRefs(parentDsti));
// set the parent's current focus to the frame containing this window.
nsCOMPtr<nsIDOMWindow> parent(do_GetInterface(parentDsti));
@ -5802,8 +5784,7 @@ nsGlobalWindow::SizeToContent()
nsIntSize newDevSize(CSSToDevIntPixels(cssSize));
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> docItem(do_QueryInterface(mDocShell));
if (docItem) {
if (mDocShell) {
nsCOMPtr<nsIBrowserDOMWindow> bwin;
nsCOMPtr<nsIDocShellTreeItem> rootItem;
docItem->GetRootTreeItem(getter_AddRefs(rootItem));
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDOMWindow> rootWin(do_GetInterface(rootItem));
nsCOMPtr<nsIDOMChromeWindow> 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<nsIDocShellTreeNode> node = do_QueryInterface(GetDocShell());
if (node) {
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (docShell) {
int32_t childCount = 0;
node->GetChildCount(&childCount);
docShell->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIDocShellTreeItem> childShell;
node->GetChildAt(i, getter_AddRefs(childShell));
docShell->GetChildAt(i, getter_AddRefs(childShell));
nsCOMPtr<nsPIDOMWindow> childWindow = do_GetInterface(childShell);
if (childWindow) {
childWindow->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
@ -9495,15 +9471,14 @@ nsGlobalWindow::FireDelayedDOMEvents()
ScheduleActiveTimerCallback();
}
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(GetDocShell());
if (node) {
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (docShell) {
int32_t childCount = 0;
node->GetChildCount(&childCount);
docShell->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIDocShellTreeItem> childShell;
node->GetChildAt(i, getter_AddRefs(childShell));
docShell->GetChildAt(i, getter_AddRefs(childShell));
NS_ASSERTION(childShell, "null child shell");
nsCOMPtr<nsPIDOMWindow> pWin = do_GetInterface(childShell);
@ -10532,18 +10507,16 @@ nsGlobalWindow::GetTreeOwner(nsIDocShellTreeOwner **aTreeOwner)
{
FORWARD_TO_OUTER(GetTreeOwner, (aTreeOwner), NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
nsCOMPtr<nsIDocShellTreeOwner> 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<nsIDocShellTreeNode> node(do_QueryInterface(GetDocShell()));
if (node) {
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (docShell) {
int32_t childCount = 0;
node->GetChildCount(&childCount);
docShell->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIDocShellTreeItem> childShell;
node->GetChildAt(i, getter_AddRefs(childShell));
docShell->GetChildAt(i, getter_AddRefs(childShell));
NS_ASSERTION(childShell, "null child shell");
nsCOMPtr<nsPIDOMWindow> pWin = do_GetInterface(childShell);
@ -10922,15 +10894,14 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren)
}
// Resume our children as well.
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(GetDocShell());
if (node) {
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
if (docShell) {
int32_t childCount = 0;
node->GetChildCount(&childCount);
docShell->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIDocShellTreeItem> childShell;
node->GetChildAt(i, getter_AddRefs(childShell));
docShell->GetChildAt(i, getter_AddRefs(childShell));
NS_ASSERTION(childShell, "null child shell");
nsCOMPtr<nsPIDOMWindow> pWin = do_GetInterface(childShell);

View File

@ -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<nsIDocShellTreeItem> dsti = do_QueryInterface(piWindow->GetDocShell());
if (dsti) {
nsCOMPtr<nsIDocShell> docShell = piWindow->GetDocShell();
if (docShell) {
int32_t itemType;
dsti->GetItemType(&itemType);
docShell->GetItemType(&itemType);
if (itemType == nsIDocShellTreeItem::typeChrome) {
caretOn = false;
}

View File

@ -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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> root;
dsTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
aDocShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
//QI root to nsIWebNavigation

View File

@ -24,13 +24,12 @@ namespace {
bool
IsChromeType(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell);
if (!ds) {
if (!aDocShell) {
return false;
}
int32_t itemType;
ds->GetItemType(&itemType);
aDocShell->GetItemType(&itemType);
return itemType == nsIDocShellTreeItem::typeChrome;
}

View File

@ -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"

View File

@ -214,16 +214,15 @@ 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<nsIDocShellTreeOwner*>(this);
rv =
mWebBrowser->mDocShellAsItem->FindItemWithName(aName, thisSupports,
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<nsIDocShellTreeOwner> 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<nsIWebNavigation> webNav(do_QueryInterface(aShellItem));

View File

@ -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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> 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,8 +450,8 @@ 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
if (mDocShell)
mDocShell->SetItemType(mContentType == typeChromeWrapper
? static_cast<int32_t>(typeChrome)
: static_cast<int32_t>(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<nsIDocShellTreeOwner*>(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<nsIInterfaceRequestor> req(do_QueryInterface(aDocShell));
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(aDocShell));
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryInterface(aDocShell));
nsCOMPtr<nsIWebNavigation> nav(do_QueryInterface(aDocShell));
nsCOMPtr<nsIScrollable> scrollable(do_QueryInterface(aDocShell));
nsCOMPtr<nsITextScroll> textScroll(do_QueryInterface(aDocShell));
nsCOMPtr<nsIWebProgress> 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;

View File

@ -131,7 +131,6 @@ protected:
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq;
nsCOMPtr<nsIBaseWindow> mDocShellAsWin;
nsCOMPtr<nsIDocShellTreeItem> mDocShellAsItem;
nsCOMPtr<nsIWebNavigation> mDocShellAsNav;
nsCOMPtr<nsIScrollable> mDocShellAsScrollable;
nsCOMPtr<nsITextScroll> mDocShellAsTextScroll;

View File

@ -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"

View File

@ -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<nsIDocShellTreeNode> 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<nsIDocShellTreeItem> childItem;
node->GetChildAt(i, getter_AddRefs(childItem));
aShell->GetChildAt(i, getter_AddRefs(childItem));
AttachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(childItem)));
}
}
@ -1487,14 +1482,11 @@ DetachContainerRecurse(nsIDocShell *aShell)
}
// Now recurse through the children
nsCOMPtr<nsIDocShellTreeNode> 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<nsIDocShellTreeItem> childItem;
node->GetChildAt(i, getter_AddRefs(childItem));
aShell->GetChildAt(i, getter_AddRefs(childItem));
DetachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(childItem)));
}
}

View File

@ -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<nsIDocShellTreeItem> curItem = do_QueryInterface(docShell);
nsCOMPtr<nsIDocShellTreeItem> parentItem;
curItem->GetParent(getter_AddRefs(parentItem));
docShell->GetParent(getter_AddRefs(parentItem));
docShell = do_QueryInterface(parentItem);
}

View File

@ -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"

View File

@ -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<nsIDocShellTreeNode> 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<nsIDocShellTreeItem> docShellItem =
do_QueryInterface(domWin->GetDocShell());
if (!docShellItem) return;
nsCOMPtr<nsIDocShell> docShell = domWin->GetDocShell();
if (!docShell) return;
nsCOMPtr<nsIDocShellTreeOwner> owner;
docShellItem->GetTreeOwner(getter_AddRefs(owner));
docShell->GetTreeOwner(getter_AddRefs(owner));
nsCOMPtr<nsIWebBrowserChrome> 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<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> docShellAsItem =
do_QueryInterface(window->GetDocShell());
nsCOMPtr<nsIDocShell> docShell = window->GetDocShell();
if (docShellAsItem) {
if (docShell) {
// get this DocViewer docshell
nsCOMPtr<nsIDocShell> thisDVDocShell(do_QueryReferent(mContainer));
while (!found) {
nsCOMPtr<nsIDocShell> parentDocshell(do_QueryInterface(docShellAsItem));
if (parentDocshell) {
if (parentDocshell == thisDVDocShell) {
if (docShell) {
if (docShell == thisDVDocShell) {
found = true;
break;
}
} else {
break; // at top of tree
}
nsCOMPtr<nsIDocShellTreeItem> docShellParent;
docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
docShellAsItem = docShellParent;
nsCOMPtr<nsIDocShellTreeItem> docShellItemParent;
docShell->GetSameTypeParent(getter_AddRefs(docShellItemParent));
docShell = do_QueryInterface(docShellItemParent);
} // while
}
} // scriptobj

View File

@ -57,16 +57,14 @@ nsPrintObject::Init(nsIDocShell* aDocShell, nsIDOMDocument* aDoc,
mDocShell = aDocShell;
} else {
mTreeOwner = do_GetInterface(aDocShell);
nsCOMPtr<nsIDocShellTreeItem> 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<nsIDocShellTreeItem> newItem = do_QueryInterface(mDocShell);
newItem->SetItemType(itemType);
newItem->SetTreeOwner(mTreeOwner);
mDocShell->SetItemType(itemType);
mDocShell->SetTreeOwner(mTreeOwner);
}
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);

View File

@ -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<nsIDocShellTreeItem> 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<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
docShellAsNode->GetChildCount(&n);
aDocShell->GetChildCount(&n);
for (i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
aDocShell->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> 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<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
docShellAsNode->GetChildCount(&n);
aDocShell->GetChildCount(&n);
for (i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
aDocShell->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> 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<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
docShellAsNode->GetChildCount(&n);
aDocShell->GetChildCount(&n);
for (i = 0; i < n; i++) {
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
aDocShell->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (childAsShell) {
DumpViewsRecur(childAsShell, out);

View File

@ -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"

View File

@ -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<nsIDocShellTreeItem> docShellAsItem =
do_QueryInterface(domWindow->GetDocShell());
if (docShellAsItem) {
nsCOMPtr<nsIDocShell> docShell = domWindow->GetDocShell();
if (docShell) {
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
if (treeOwner) {
CallQueryInterface(treeOwner, aWindow);
}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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<nsIDocShellTreeItem> docShellAsItem =
do_QueryInterface(mDocShell);
if (!docShellAsItem) {
if (!mDocShell) {
return;
}
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
mDocShell->GetSameTypeParent(getter_AddRefs(parentAsItem));
nsCOMPtr<nsIDocShell> parent(do_QueryInterface(parentAsItem));
if (parent) {
nsCOMPtr<nsIContentViewer> 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<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
nsCOMPtr<nsIDocShellTreeItem> parent;
treeItem->GetSameTypeParent(getter_AddRefs(parent));
mDocShell->GetSameTypeParent(getter_AddRefs(parent));
if (parent) {
return;
}

View File

@ -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"