bug 331376 - merge nsIDocShellTreeNode into nsIDocShellTreeItem r=smaug
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
#include "nsIScrollPositionListener.h"
|
#include "nsIScrollPositionListener.h"
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "nsIWeakReference.h"
|
#include "nsIWeakReference.h"
|
||||||
#include "nsIDocShellTreeNode.h"
|
|
||||||
|
|
||||||
class nsAccessiblePivot;
|
class nsAccessiblePivot;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const gXPInstallObserver = {
|
|||||||
if (aDocShell == aSoughtShell)
|
if (aDocShell == aSoughtShell)
|
||||||
return aDocShell;
|
return aDocShell;
|
||||||
|
|
||||||
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
|
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
|
||||||
for (var i = 0; i < node.childCount; ++i) {
|
for (var i = 0; i < node.childCount; ++i) {
|
||||||
var docShell = node.getChildAt(i);
|
var docShell = node.getChildAt(i);
|
||||||
docShell = this._findChildShell(docShell, aSoughtShell);
|
docShell = this._findChildShell(docShell, aSoughtShell);
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ function findChildShell(aDocument, aDocShell, aSoughtURI) {
|
|||||||
(aSoughtURI && aSoughtURI.spec == aDocShell.currentURI.spec))
|
(aSoughtURI && aSoughtURI.spec == aDocShell.currentURI.spec))
|
||||||
return aDocShell;
|
return aDocShell;
|
||||||
|
|
||||||
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
|
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
|
||||||
for (var i = 0; i < node.childCount; ++i) {
|
for (var i = 0; i < node.childCount; ++i) {
|
||||||
var docShell = node.getChildAt(i);
|
var docShell = node.getChildAt(i);
|
||||||
docShell = findChildShell(aDocument, docShell, aSoughtURI);
|
docShell = findChildShell(aDocument, docShell, aSoughtURI);
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS,
|
void MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS,
|
||||||
bool aPrepareForCC);
|
bool aPrepareForCC);
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -256,7 +256,7 @@ MarkSHEntry(nsISHEntry* aSHEntry, bool aCleanupJS, bool aPrepareForCC)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS, bool aPrepareForCC)
|
MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS, bool aPrepareForCC)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aNode);
|
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aNode);
|
||||||
if (!shell) {
|
if (!shell) {
|
||||||
@@ -299,8 +299,7 @@ MarkWindowList(nsISimpleEnumerator* aWindowList, bool aCleanupJS,
|
|||||||
iter) {
|
iter) {
|
||||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(iter);
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(iter);
|
||||||
if (window) {
|
if (window) {
|
||||||
nsCOMPtr<nsIDocShellTreeNode> rootDocShell =
|
nsCOMPtr<nsIDocShell> rootDocShell = window->GetDocShell();
|
||||||
do_QueryInterface(window->GetDocShell());
|
|
||||||
|
|
||||||
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);
|
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);
|
||||||
}
|
}
|
||||||
@@ -379,8 +378,7 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
if (hw) {
|
if (hw) {
|
||||||
nsCOMPtr<nsIDocShell> shell;
|
nsCOMPtr<nsIDocShell> shell;
|
||||||
hw->GetDocShell(getter_AddRefs(shell));
|
hw->GetDocShell(getter_AddRefs(shell));
|
||||||
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
|
MarkDocShell(shell, cleanupJS, prepareForCC);
|
||||||
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
|
|
||||||
}
|
}
|
||||||
bool hasHiddenPrivateWindow = false;
|
bool hasHiddenPrivateWindow = false;
|
||||||
appShell->GetHasHiddenPrivateWindow(&hasHiddenPrivateWindow);
|
appShell->GetHasHiddenPrivateWindow(&hasHiddenPrivateWindow);
|
||||||
@@ -389,8 +387,7 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
if (hw) {
|
if (hw) {
|
||||||
nsCOMPtr<nsIDocShell> shell;
|
nsCOMPtr<nsIDocShell> shell;
|
||||||
hw->GetDocShell(getter_AddRefs(shell));
|
hw->GetDocShell(getter_AddRefs(shell));
|
||||||
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
|
MarkDocShell(shell, cleanupJS, prepareForCC);
|
||||||
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5881,14 +5881,13 @@ nsContentUtils::FlushLayoutForTree(nsIDOMWindow* aWindow)
|
|||||||
doc->FlushPendingNotifications(Flush_Layout);
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
|
||||||
do_QueryInterface(piWin->GetDocShell());
|
if (docShell) {
|
||||||
if (node) {
|
|
||||||
int32_t i = 0, i_end;
|
int32_t i = 0, i_end;
|
||||||
node->GetChildCount(&i_end);
|
docShell->GetChildCount(&i_end);
|
||||||
for (; i < i_end; ++i) {
|
for (; i < i_end; ++i) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||||
node->GetChildAt(i, getter_AddRefs(item));
|
docShell->GetChildAt(i, getter_AddRefs(item));
|
||||||
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
||||||
if (win) {
|
if (win) {
|
||||||
FlushLayoutForTree(win);
|
FlushLayoutForTree(win);
|
||||||
|
|||||||
@@ -713,7 +713,7 @@ bool
|
|||||||
nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
||||||
nsIDocShellTreeOwner* aOwner,
|
nsIDocShellTreeOwner* aOwner,
|
||||||
int32_t aParentType,
|
int32_t aParentType,
|
||||||
nsIDocShellTreeNode* aParentNode)
|
nsIDocShell* aParentNode)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aItem, "Must have docshell treeitem");
|
NS_PRECONDITION(aItem, "Must have docshell treeitem");
|
||||||
NS_PRECONDITION(mOwnerContent, "Must have owning content");
|
NS_PRECONDITION(mOwnerContent, "Must have owning content");
|
||||||
@@ -1571,9 +1571,8 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> container =
|
nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
|
||||||
doc->GetContainer();
|
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(docShell);
|
||||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(container);
|
|
||||||
NS_ENSURE_STATE(parentAsWebNav);
|
NS_ENSURE_STATE(parentAsWebNav);
|
||||||
|
|
||||||
// Create the docshell...
|
// Create the docshell...
|
||||||
@@ -1615,53 +1614,41 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||||||
mDocShell->SetName(frameName);
|
mDocShell->SetName(frameName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If our container is a web-shell, inform it that it has a new
|
// Inform our docShell that it has a new child.
|
||||||
// child. If it's not a web-shell then some things will not operate
|
// Note: This logic duplicates a lot of logic in
|
||||||
// properly.
|
// nsSubDocumentFrame::AttributeChanged. We should fix that.
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(parentAsWebNav));
|
int32_t parentType;
|
||||||
if (parentAsNode) {
|
docShell->GetItemType(&parentType);
|
||||||
// Note: This logic duplicates a lot of logic in
|
|
||||||
// nsSubDocumentFrame::AttributeChanged. We should fix that.
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem =
|
// XXXbz why is this in content code, exactly? We should handle
|
||||||
do_QueryInterface(parentAsNode);
|
// this some other way..... Not sure how yet.
|
||||||
|
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||||
|
docShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||||
|
NS_ENSURE_STATE(parentTreeOwner);
|
||||||
|
mIsTopLevelContent =
|
||||||
|
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType, docShell);
|
||||||
|
|
||||||
int32_t parentType;
|
// Make sure all shells have links back to the content element
|
||||||
parentAsItem->GetItemType(&parentType);
|
// in the nearest enclosing chrome shell.
|
||||||
|
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
|
||||||
|
|
||||||
// XXXbz why is this in content code, exactly? We should handle
|
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
||||||
// this some other way..... Not sure how yet.
|
// Our parent shell is a chrome shell. It is therefore our nearest
|
||||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
// enclosing chrome shell.
|
||||||
parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
|
||||||
NS_ENSURE_STATE(parentTreeOwner);
|
|
||||||
mIsTopLevelContent =
|
|
||||||
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType,
|
|
||||||
parentAsNode);
|
|
||||||
|
|
||||||
// Make sure all shells have links back to the content element
|
chromeEventHandler = do_QueryInterface(mOwnerContent);
|
||||||
// in the nearest enclosing chrome shell.
|
NS_ASSERTION(chromeEventHandler,
|
||||||
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
|
"This mContent should implement this.");
|
||||||
|
} else {
|
||||||
|
// Our parent shell is a content shell. Get the chrome event
|
||||||
|
// handler from it and use that for our shell as well.
|
||||||
|
|
||||||
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
docShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||||
// Our parent shell is a chrome shell. It is therefore our nearest
|
|
||||||
// enclosing chrome shell.
|
|
||||||
|
|
||||||
chromeEventHandler = do_QueryInterface(mOwnerContent);
|
|
||||||
NS_ASSERTION(chromeEventHandler,
|
|
||||||
"This mContent should implement this.");
|
|
||||||
} else {
|
|
||||||
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
|
|
||||||
|
|
||||||
// Our parent shell is a content shell. Get the chrome event
|
|
||||||
// handler from it and use that for our shell as well.
|
|
||||||
|
|
||||||
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
|
||||||
}
|
|
||||||
|
|
||||||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||||
|
|
||||||
// This is nasty, this code (the do_GetInterface(mDocShell) below)
|
// This is nasty, this code (the do_GetInterface(mDocShell) below)
|
||||||
// *must* come *after* the above call to
|
// *must* come *after* the above call to
|
||||||
// mDocShell->SetChromeEventHandler() for the global window to get
|
// mDocShell->SetChromeEventHandler() for the global window to get
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class AutoResetInShow;
|
|||||||
class nsITabParent;
|
class nsITabParent;
|
||||||
class nsIDocShellTreeItem;
|
class nsIDocShellTreeItem;
|
||||||
class nsIDocShellTreeOwner;
|
class nsIDocShellTreeOwner;
|
||||||
class nsIDocShellTreeNode;
|
|
||||||
class mozIApplication;
|
class mozIApplication;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@@ -388,7 +387,7 @@ private:
|
|||||||
bool AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
bool AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
||||||
nsIDocShellTreeOwner* aOwner,
|
nsIDocShellTreeOwner* aOwner,
|
||||||
int32_t aParentType,
|
int32_t aParentType,
|
||||||
nsIDocShellTreeNode* aParentNode);
|
nsIDocShell* aParentNode);
|
||||||
|
|
||||||
nsIAtom* TypeAttrName() const {
|
nsIAtom* TypeAttrName() const {
|
||||||
return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;
|
return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;
|
||||||
|
|||||||
@@ -642,8 +642,7 @@ test(function test_FrameAncestor_ignores_userpass_bug779918() {
|
|||||||
.createInstance(Ci.nsIDocShell);
|
.createInstance(Ci.nsIDocShell);
|
||||||
docshellparent.setCurrentURI(aParentUri);
|
docshellparent.setCurrentURI(aParentUri);
|
||||||
docshellchild.setCurrentURI(aChildUri);
|
docshellchild.setCurrentURI(aChildUri);
|
||||||
docshellparent.QueryInterface(Ci.nsIDocShellTreeNode)
|
docshellparent.addChild(docshellchild);
|
||||||
.addChild(docshellchild);
|
|
||||||
return cspObj.permitsAncestry(docshellchild);
|
return cspObj.permitsAncestry(docshellchild);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1490,11 +1490,11 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||||||
ProcessingAccessKeyState aAccessKeyState,
|
ProcessingAccessKeyState aAccessKeyState,
|
||||||
int32_t aModifierMask)
|
int32_t aModifierMask)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISupports> pcContainer = aPresContext->GetContainerWeak();
|
nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
|
||||||
|
|
||||||
// Alt or other accesskey modifier is down, we may need to do an accesskey
|
// Alt or other accesskey modifier is down, we may need to do an accesskey
|
||||||
if (mAccessKeys.Count() > 0 &&
|
if (mAccessKeys.Count() > 0 &&
|
||||||
aModifierMask == GetAccessModifierMaskFor(pcContainer)) {
|
aModifierMask == GetAccessModifierMaskFor(docShell)) {
|
||||||
// Someone registered an accesskey. Find and activate it.
|
// Someone registered an accesskey. Find and activate it.
|
||||||
nsAutoTArray<uint32_t, 10> accessCharCodes;
|
nsAutoTArray<uint32_t, 10> accessCharCodes;
|
||||||
nsContentUtils::GetAccessKeyCandidates(aEvent, accessCharCodes);
|
nsContentUtils::GetAccessKeyCandidates(aEvent, accessCharCodes);
|
||||||
@@ -1508,7 +1508,6 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||||||
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
|
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||||
// checking all sub docshells
|
// checking all sub docshells
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShell(do_QueryInterface(pcContainer));
|
|
||||||
if (!docShell) {
|
if (!docShell) {
|
||||||
NS_WARNING("no docShellTreeNode for presContext");
|
NS_WARNING("no docShellTreeNode for presContext");
|
||||||
return;
|
return;
|
||||||
@@ -1552,7 +1551,6 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
// bubble up the process to the parent docshell if necessary
|
// bubble up the process to the parent docshell if necessary
|
||||||
if (eAccessKeyProcessingDown != aAccessKeyState && nsEventStatus_eConsumeNoDefault != *aStatus) {
|
if (eAccessKeyProcessingDown != aAccessKeyState && nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(pcContainer));
|
|
||||||
if (!docShell) {
|
if (!docShell) {
|
||||||
NS_WARNING("no docShellTreeItem for presContext");
|
NS_WARNING("no docShellTreeItem for presContext");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ class nsFrameLoader;
|
|||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
class nsIDocShell;
|
class nsIDocShell;
|
||||||
class nsIDocShellTreeNode;
|
|
||||||
class nsIDocShellTreeItem;
|
class nsIDocShellTreeItem;
|
||||||
class imgIContainer;
|
class imgIContainer;
|
||||||
class nsDOMDataTransfer;
|
class nsDOMDataTransfer;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ XPIDL_SOURCES += [
|
|||||||
'nsIDocShell.idl',
|
'nsIDocShell.idl',
|
||||||
'nsIDocShellLoadInfo.idl',
|
'nsIDocShellLoadInfo.idl',
|
||||||
'nsIDocShellTreeItem.idl',
|
'nsIDocShellTreeItem.idl',
|
||||||
'nsIDocShellTreeNode.idl',
|
|
||||||
'nsIDocShellTreeOwner.idl',
|
'nsIDocShellTreeOwner.idl',
|
||||||
'nsIDocumentLoaderFactory.idl',
|
'nsIDocumentLoaderFactory.idl',
|
||||||
'nsIDownloadHistory.idl',
|
'nsIDownloadHistory.idl',
|
||||||
|
|||||||
@@ -974,7 +974,6 @@ NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
|
|||||||
NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDocShell)
|
NS_INTERFACE_MAP_ENTRY(nsIDocShell)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
|
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
||||||
@@ -3608,10 +3607,6 @@ nsDocShell::GetIsInUnload(bool* aIsInUnload)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
|
||||||
// nsDocShell::nsIDocShellTreeNode
|
|
||||||
//*****************************************************************************
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetChildCount(int32_t * aChildCount)
|
nsDocShell::GetChildCount(int32_t * aChildCount)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeNode.h"
|
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIScrollable.h"
|
#include "nsIScrollable.h"
|
||||||
#include "nsITextScroll.h"
|
#include "nsITextScroll.h"
|
||||||
@@ -155,7 +154,6 @@ public:
|
|||||||
|
|
||||||
NS_DECL_NSIDOCSHELL
|
NS_DECL_NSIDOCSHELL
|
||||||
NS_DECL_NSIDOCSHELLTREEITEM
|
NS_DECL_NSIDOCSHELLTREEITEM
|
||||||
NS_DECL_NSIDOCSHELLTREENODE
|
|
||||||
NS_DECL_NSIWEBNAVIGATION
|
NS_DECL_NSIWEBNAVIGATION
|
||||||
NS_DECL_NSIBASEWINDOW
|
NS_DECL_NSIBASEWINDOW
|
||||||
NS_DECL_NSISCROLLABLE
|
NS_DECL_NSISCROLLABLE
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "nsDocShellEnumerator.h"
|
#include "nsDocShellEnumerator.h"
|
||||||
|
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeNode.h"
|
|
||||||
|
|
||||||
nsDocShellEnumerator::nsDocShellEnumerator(int32_t inEnumerationDirection)
|
nsDocShellEnumerator::nsDocShellEnumerator(int32_t inEnumerationDirection)
|
||||||
: mRootItem(nullptr)
|
: mRootItem(nullptr)
|
||||||
@@ -123,8 +122,6 @@ nsresult nsDocShellEnumerator::BuildDocShellArray(nsTArray<nsWeakPtr>& inItemArr
|
|||||||
nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
|
nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIDocShellTreeNode> itemAsNode = do_QueryInterface(inItem, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
int32_t itemType;
|
int32_t itemType;
|
||||||
// add this item to the array
|
// add this item to the array
|
||||||
@@ -136,13 +133,13 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t numChildren;
|
int32_t numChildren;
|
||||||
rv = itemAsNode->GetChildCount(&numChildren);
|
rv = inItem->GetChildCount(&numChildren);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
for (int32_t i = 0; i < numChildren; ++i)
|
for (int32_t i = 0; i < numChildren; ++i)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShellTreeItem> curChild;
|
nsCOMPtr<nsIDocShellTreeItem> curChild;
|
||||||
rv = itemAsNode->GetChildAt(i, getter_AddRefs(curChild));
|
rv = inItem->GetChildAt(i, getter_AddRefs(curChild));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = BuildArrayRecursive(curChild, inItemArray);
|
rv = BuildArrayRecursive(curChild, inItemArray);
|
||||||
@@ -156,17 +153,15 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
|
|||||||
nsresult nsDocShellBackwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
|
nsresult nsDocShellBackwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIDocShellTreeNode> itemAsNode = do_QueryInterface(inItem, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
int32_t numChildren;
|
int32_t numChildren;
|
||||||
rv = itemAsNode->GetChildCount(&numChildren);
|
rv = inItem->GetChildCount(&numChildren);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
for (int32_t i = numChildren - 1; i >= 0; --i)
|
for (int32_t i = numChildren - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShellTreeItem> curChild;
|
nsCOMPtr<nsIDocShellTreeItem> curChild;
|
||||||
rv = itemAsNode->GetChildAt(i, getter_AddRefs(curChild));
|
rv = inItem->GetChildAt(i, getter_AddRefs(curChild));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = BuildArrayRecursive(curChild, inItemArray);
|
rv = BuildArrayRecursive(curChild, inItemArray);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsIDocShellTreeNode.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
interface nsIDocShellTreeOwner;
|
interface nsIDocShellTreeOwner;
|
||||||
|
|
||||||
@@ -15,8 +15,8 @@ interface nsIDocShellTreeOwner;
|
|||||||
* node or a leaf.
|
* node or a leaf.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(e35bbb39-985b-4d62-81da-73c330222e5f)]
|
[scriptable, uuid(cb16a98d-a9e4-4ee2-a450-709b92ad8a89)]
|
||||||
interface nsIDocShellTreeItem : nsIDocShellTreeNode
|
interface nsIDocShellTreeItem : nsISupports
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
name of the DocShellTreeItem
|
name of the DocShellTreeItem
|
||||||
@@ -125,5 +125,54 @@ interface nsIDocShellTreeItem : nsIDocShellTreeNode
|
|||||||
*/
|
*/
|
||||||
readonly attribute nsIDocShellTreeOwner treeOwner;
|
readonly attribute nsIDocShellTreeOwner treeOwner;
|
||||||
[noscript] void setTreeOwner(in nsIDocShellTreeOwner treeOwner);
|
[noscript] void setTreeOwner(in nsIDocShellTreeOwner treeOwner);
|
||||||
|
|
||||||
|
/*
|
||||||
|
The current number of DocShells which are immediate children of the
|
||||||
|
this object.
|
||||||
|
*/
|
||||||
|
readonly attribute long childCount;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add a new child DocShellTreeItem. Adds to the end of the list.
|
||||||
|
Note that this does NOT take a reference to the child. The child stays
|
||||||
|
alive only as long as it's referenced from outside the docshell tree.
|
||||||
|
@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
|
||||||
|
object as this treenode or an ancestor of this treenode
|
||||||
|
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
||||||
|
*/
|
||||||
|
void addChild(in nsIDocShellTreeItem child);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Removes a child DocShellTreeItem.
|
||||||
|
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
||||||
|
*/
|
||||||
|
void removeChild(in nsIDocShellTreeItem child);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the child at the index requested. This is 0-based.
|
||||||
|
*
|
||||||
|
* @throws NS_ERROR_UNEXPECTED if the index is out of range
|
||||||
|
*/
|
||||||
|
nsIDocShellTreeItem getChildAt(in long index);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return the child DocShellTreeItem with the specified name.
|
||||||
|
aName - This is the name of the item that is trying to be found.
|
||||||
|
aRecurse - Is used to tell the function to recurse through children.
|
||||||
|
Note, recursion will only happen through items of the same type.
|
||||||
|
aSameType - If this is set only children of the same type will be returned.
|
||||||
|
aRequestor - This is the docshellTreeItem that is requesting the find. This
|
||||||
|
parameter is used when recursion is being used to avoid searching the same
|
||||||
|
tree again when a child has asked a parent to search for children.
|
||||||
|
aOriginalRequestor - The original treeitem that made the request, if any.
|
||||||
|
This is used to ensure that we don't run into cross-site issues.
|
||||||
|
|
||||||
|
Note the search is depth first when recursing.
|
||||||
|
*/
|
||||||
|
nsIDocShellTreeItem findChildWithName(in wstring aName,
|
||||||
|
in boolean aRecurse,
|
||||||
|
in boolean aSameType,
|
||||||
|
in nsIDocShellTreeItem aRequestor,
|
||||||
|
in nsIDocShellTreeItem aOriginalRequestor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
|
|
||||||
interface nsIDocShellTreeItem;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nsIDocShellTreeNode supplies the methods for interacting with children
|
|
||||||
* of a docshell. These are essentially the methods that turn a single docshell
|
|
||||||
* into a docshell tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Long-term, we probably want to merge this interface into
|
|
||||||
* nsIDocShellTreeItem. Need to eliminate uses of this interface
|
|
||||||
* first.
|
|
||||||
*/
|
|
||||||
|
|
||||||
[scriptable, uuid(37f1ab73-f224-44b1-82f0-d2834ab1cec0)]
|
|
||||||
interface nsIDocShellTreeNode : nsISupports
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
The current number of DocShells which are immediate children of the
|
|
||||||
this object.
|
|
||||||
*/
|
|
||||||
readonly attribute long childCount;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Add a new child DocShellTreeItem. Adds to the end of the list.
|
|
||||||
Note that this does NOT take a reference to the child. The child stays
|
|
||||||
alive only as long as it's referenced from outside the docshell tree.
|
|
||||||
@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
|
|
||||||
object as this treenode or an ancestor of this treenode
|
|
||||||
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
|
||||||
*/
|
|
||||||
void addChild(in nsIDocShellTreeItem child);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Removes a child DocShellTreeItem.
|
|
||||||
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
|
|
||||||
*/
|
|
||||||
void removeChild(in nsIDocShellTreeItem child);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the child at the index requested. This is 0-based.
|
|
||||||
*
|
|
||||||
* @throws NS_ERROR_UNEXPECTED if the index is out of range
|
|
||||||
*/
|
|
||||||
nsIDocShellTreeItem getChildAt(in long index);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return the child DocShellTreeItem with the specified name.
|
|
||||||
aName - This is the name of the item that is trying to be found.
|
|
||||||
aRecurse - Is used to tell the function to recurse through children.
|
|
||||||
Note, recursion will only happen through items of the same type.
|
|
||||||
aSameType - If this is set only children of the same type will be returned.
|
|
||||||
aRequestor - This is the docshellTreeItem that is requesting the find. This
|
|
||||||
parameter is used when recursion is being used to avoid searching the same
|
|
||||||
tree again when a child has asked a parent to search for children.
|
|
||||||
aOriginalRequestor - The original treeitem that made the request, if any.
|
|
||||||
This is used to ensure that we don't run into cross-site issues.
|
|
||||||
|
|
||||||
Note the search is depth first when recursing.
|
|
||||||
*/
|
|
||||||
nsIDocShellTreeItem findChildWithName(in wstring aName,
|
|
||||||
in boolean aRecurse,
|
|
||||||
in boolean aSameType,
|
|
||||||
in nsIDocShellTreeItem aRequestor,
|
|
||||||
in nsIDocShellTreeItem aOriginalRequestor);
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
#include "nsIDocShellLoadInfo.h"
|
#include "nsIDocShellLoadInfo.h"
|
||||||
#include "nsISHContainer.h"
|
#include "nsISHContainer.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeNode.h"
|
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "nsICacheService.h"
|
#include "nsICacheService.h"
|
||||||
@@ -1636,22 +1635,21 @@ nsSHistory::CompareFrames(nsISHEntry * aPrevEntry, nsISHEntry * aNextEntry, nsID
|
|||||||
int32_t pcnt=0, ncnt=0, dsCount=0;
|
int32_t pcnt=0, ncnt=0, dsCount=0;
|
||||||
nsCOMPtr<nsISHContainer> prevContainer(do_QueryInterface(aPrevEntry));
|
nsCOMPtr<nsISHContainer> prevContainer(do_QueryInterface(aPrevEntry));
|
||||||
nsCOMPtr<nsISHContainer> nextContainer(do_QueryInterface(aNextEntry));
|
nsCOMPtr<nsISHContainer> nextContainer(do_QueryInterface(aNextEntry));
|
||||||
nsCOMPtr<nsIDocShellTreeNode> dsTreeNode(do_QueryInterface(aParent));
|
|
||||||
|
|
||||||
if (!dsTreeNode)
|
if (!aParent)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
if (!prevContainer || !nextContainer)
|
if (!prevContainer || !nextContainer)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
prevContainer->GetChildCount(&pcnt);
|
prevContainer->GetChildCount(&pcnt);
|
||||||
nextContainer->GetChildCount(&ncnt);
|
nextContainer->GetChildCount(&ncnt);
|
||||||
dsTreeNode->GetChildCount(&dsCount);
|
aParent->GetChildCount(&dsCount);
|
||||||
|
|
||||||
// Create an array for child docshells.
|
// Create an array for child docshells.
|
||||||
nsCOMArray<nsIDocShell> docshells;
|
nsCOMArray<nsIDocShell> docshells;
|
||||||
for (int32_t i = 0; i < dsCount; ++i) {
|
for (int32_t i = 0; i < dsCount; ++i) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> treeItem;
|
nsCOMPtr<nsIDocShellTreeItem> treeItem;
|
||||||
dsTreeNode->GetChildAt(i, getter_AddRefs(treeItem));
|
aParent->GetChildAt(i, getter_AddRefs(treeItem));
|
||||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(treeItem);
|
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(treeItem);
|
||||||
if (shell) {
|
if (shell) {
|
||||||
docshells.AppendObject(shell);
|
docshells.AppendObject(shell);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ function xpcEnumerateContentWindows(callback) {
|
|||||||
if (/ChromeWindow/.exec(win)) {
|
if (/ChromeWindow/.exec(win)) {
|
||||||
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIDocShellTreeNode);
|
.QueryInterface(Ci.nsIDocShellTreeItem);
|
||||||
var childCount = docshellTreeNode.childCount;
|
var childCount = docshellTreeNode.childCount;
|
||||||
for (var i = 0; i < childCount; ++i) {
|
for (var i = 0; i < childCount; ++i) {
|
||||||
var childTreeNode = docshellTreeNode.getChildAt(i);
|
var childTreeNode = docshellTreeNode.getChildAt(i);
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ NS_INTERFACE_MAP_END
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell)
|
nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
|
mDocShellNode = aDocShell; // Weak Reference
|
||||||
mDocShellNode = docShellAsNode; // Weak Reference
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMWindowCollection.h"
|
#include "nsIDOMWindowCollection.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShell.h"
|
||||||
|
|
||||||
class nsIDocShell;
|
class nsIDocShell;
|
||||||
class nsIDOMWindow;
|
class nsIDOMWindow;
|
||||||
@@ -41,7 +41,7 @@ protected:
|
|||||||
// Note: this function may flush and cause mDocShellNode to become null.
|
// Note: this function may flush and cause mDocShellNode to become null.
|
||||||
void EnsureFresh();
|
void EnsureFresh();
|
||||||
|
|
||||||
nsIDocShellTreeNode* mDocShellNode; //Weak Reference
|
nsIDocShell* mDocShellNode; //Weak Reference
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsDOMWindowList_h___
|
#endif // nsDOMWindowList_h___
|
||||||
|
|||||||
@@ -5468,13 +5468,13 @@ nsGlobalWindow::GetLength(uint32_t* aLength)
|
|||||||
already_AddRefed<nsIDOMWindow>
|
already_AddRefed<nsIDOMWindow>
|
||||||
nsGlobalWindow::GetChildWindow(const nsAString& aName)
|
nsGlobalWindow::GetChildWindow(const nsAString& aName)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(GetDocShell()));
|
nsCOMPtr<nsIDocShell> docShell(GetDocShell());
|
||||||
NS_ENSURE_TRUE(dsn, nullptr);
|
NS_ENSURE_TRUE(docShell, nullptr);
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||||
dsn->FindChildWithName(PromiseFlatString(aName).get(),
|
docShell->FindChildWithName(PromiseFlatString(aName).get(),
|
||||||
false, true, nullptr, nullptr,
|
false, true, nullptr, nullptr,
|
||||||
getter_AddRefs(child));
|
getter_AddRefs(child));
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
|
nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
|
||||||
return child_win.forget();
|
return child_win.forget();
|
||||||
|
|||||||
@@ -1848,14 +1848,13 @@ MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVide
|
|||||||
}
|
}
|
||||||
|
|
||||||
// iterate any children of *this* window (iframes, etc)
|
// iterate any children of *this* window (iframes, etc)
|
||||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
|
||||||
do_QueryInterface(piWin->GetDocShell());
|
if (docShell) {
|
||||||
if (node) {
|
|
||||||
int32_t i, count;
|
int32_t i, count;
|
||||||
node->GetChildCount(&count);
|
docShell->GetChildCount(&count);
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||||
node->GetChildAt(i, getter_AddRefs(item));
|
docShell->GetChildAt(i, getter_AddRefs(item));
|
||||||
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(item);
|
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(item);
|
||||||
|
|
||||||
MediaCaptureWindowStateInternal(win, aVideo, aAudio);
|
MediaCaptureWindowStateInternal(win, aVideo, aAudio);
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ NS_INTERFACE_MAP_BEGIN(nsWebBrowser)
|
|||||||
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsITextScroll)
|
NS_INTERFACE_MAP_ENTRY(nsITextScroll)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSetup)
|
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSetup)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersist)
|
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersist)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeNode.h"
|
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
#include "nsIScrollable.h"
|
#include "nsIScrollable.h"
|
||||||
@@ -96,7 +95,6 @@ public:
|
|||||||
|
|
||||||
NS_DECL_NSIBASEWINDOW
|
NS_DECL_NSIBASEWINDOW
|
||||||
NS_DECL_NSIDOCSHELLTREEITEM
|
NS_DECL_NSIDOCSHELLTREEITEM
|
||||||
NS_DECL_NSIDOCSHELLTREENODE
|
|
||||||
NS_DECL_NSIINTERFACEREQUESTOR
|
NS_DECL_NSIINTERFACEREQUESTOR
|
||||||
NS_DECL_NSISCROLLABLE
|
NS_DECL_NSISCROLLABLE
|
||||||
NS_DECL_NSITEXTSCROLL
|
NS_DECL_NSITEXTSCROLL
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ private:
|
|||||||
#ifdef NS_PRINTING
|
#ifdef NS_PRINTING
|
||||||
// Called when the DocViewer is notified that the state
|
// Called when the DocViewer is notified that the state
|
||||||
// of Printing or PP has changed
|
// of Printing or PP has changed
|
||||||
void SetIsPrintingInDocShellTree(nsIDocShellTreeNode* aParentNode,
|
void SetIsPrintingInDocShellTree(nsIDocShellTreeItem* aParentNode,
|
||||||
bool aIsPrintingOrPP,
|
bool aIsPrintingOrPP,
|
||||||
bool aStartAtTop);
|
bool aStartAtTop);
|
||||||
#endif // NS_PRINTING
|
#endif // NS_PRINTING
|
||||||
@@ -1147,14 +1147,14 @@ nsDocumentViewer::PermitUnloadInternal(bool aCallerClosesWindow,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellNode(mContainer);
|
nsCOMPtr<nsIDocShell> docShell(mContainer);
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
beforeUnload->GetReturnValue(text);
|
beforeUnload->GetReturnValue(text);
|
||||||
if (*aShouldPrompt && (event->GetInternalNSEvent()->mFlags.mDefaultPrevented ||
|
if (*aShouldPrompt && (event->GetInternalNSEvent()->mFlags.mDefaultPrevented ||
|
||||||
!text.IsEmpty())) {
|
!text.IsEmpty())) {
|
||||||
// Ask the user if it's ok to unload the current page
|
// Ask the user if it's ok to unload the current page
|
||||||
|
|
||||||
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(docShellNode);
|
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(docShell);
|
||||||
|
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
nsXPIDLString title, message, stayLabel, leaveLabel;
|
nsXPIDLString title, message, stayLabel, leaveLabel;
|
||||||
@@ -1211,13 +1211,13 @@ nsDocumentViewer::PermitUnloadInternal(bool aCallerClosesWindow,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (docShellNode) {
|
if (docShell) {
|
||||||
int32_t childCount;
|
int32_t childCount;
|
||||||
docShellNode->GetChildCount(&childCount);
|
docShell->GetChildCount(&childCount);
|
||||||
|
|
||||||
for (int32_t i = 0; i < childCount && *aPermitUnload; ++i) {
|
for (int32_t i = 0; i < childCount && *aPermitUnload; ++i) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||||
docShellNode->GetChildAt(i, getter_AddRefs(item));
|
docShell->GetChildAt(i, getter_AddRefs(item));
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(item));
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(item));
|
||||||
|
|
||||||
@@ -1244,14 +1244,14 @@ nsDocumentViewer::ResetCloseWindow()
|
|||||||
{
|
{
|
||||||
mCallerIsClosingWindow = false;
|
mCallerIsClosingWindow = false;
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellNode(mContainer);
|
nsCOMPtr<nsIDocShell> docShell(mContainer);
|
||||||
if (docShellNode) {
|
if (docShell) {
|
||||||
int32_t childCount;
|
int32_t childCount;
|
||||||
docShellNode->GetChildCount(&childCount);
|
docShell->GetChildCount(&childCount);
|
||||||
|
|
||||||
for (int32_t i = 0; i < childCount; ++i) {
|
for (int32_t i = 0; i < childCount; ++i) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||||
docShellNode->GetChildAt(i, getter_AddRefs(item));
|
docShell->GetChildAt(i, getter_AddRefs(item));
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(item));
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(item));
|
||||||
|
|
||||||
@@ -1770,7 +1770,7 @@ nsDocumentViewer::SetDocumentInternal(nsIDocument* aDocument,
|
|||||||
// Clear the list of old child docshells. Child docshells for the new
|
// Clear the list of old child docshells. Child docshells for the new
|
||||||
// document will be constructed as frames are created.
|
// document will be constructed as frames are created.
|
||||||
if (!aDocument->IsStaticDocument()) {
|
if (!aDocument->IsStaticDocument()) {
|
||||||
nsCOMPtr<nsIDocShellTreeNode> node(mContainer);
|
nsCOMPtr<nsIDocShell> node(mContainer);
|
||||||
if (node) {
|
if (node) {
|
||||||
int32_t count;
|
int32_t count;
|
||||||
node->GetChildCount(&count);
|
node->GetChildCount(&count);
|
||||||
@@ -2690,16 +2690,16 @@ NS_IMETHODIMP nsDocumentViewer::ScrollToNode(nsIDOMNode* aNode)
|
|||||||
void
|
void
|
||||||
nsDocumentViewer::CallChildren(CallChildFunc aFunc, void* aClosure)
|
nsDocumentViewer::CallChildren(CallChildFunc aFunc, void* aClosure)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellNode(mContainer);
|
nsCOMPtr<nsIDocShell> docShell(mContainer);
|
||||||
if (docShellNode)
|
if (docShell)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
int32_t n;
|
int32_t n;
|
||||||
docShellNode->GetChildCount(&n);
|
docShell->GetChildCount(&n);
|
||||||
for (i=0; i < n; i++)
|
for (i=0; i < n; i++)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||||
docShellNode->GetChildAt(i, getter_AddRefs(child));
|
docShell->GetChildAt(i, getter_AddRefs(child));
|
||||||
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
|
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
|
||||||
NS_ASSERTION(childAsShell, "null child in docshell");
|
NS_ASSERTION(childAsShell, "null child in docshell");
|
||||||
if (childAsShell)
|
if (childAsShell)
|
||||||
@@ -3961,7 +3961,7 @@ nsDocumentViewer::GetIsRangeSelection(bool *aIsRangeSelection)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Walks the document tree and tells each DocShell whether Printing/PP is happening
|
// Walks the document tree and tells each DocShell whether Printing/PP is happening
|
||||||
void
|
void
|
||||||
nsDocumentViewer::SetIsPrintingInDocShellTree(nsIDocShellTreeNode* aParentNode,
|
nsDocumentViewer::SetIsPrintingInDocShellTree(nsIDocShellTreeItem* aParentNode,
|
||||||
bool aIsPrintingOrPP,
|
bool aIsPrintingOrPP,
|
||||||
bool aStartAtTop)
|
bool aStartAtTop)
|
||||||
{
|
{
|
||||||
@@ -4000,10 +4000,9 @@ nsDocumentViewer::SetIsPrintingInDocShellTree(nsIDocShellTreeNode* aParentNode,
|
|||||||
for (int32_t i=0; i < n; i++) {
|
for (int32_t i=0; i < n; i++) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||||
aParentNode->GetChildAt(i, getter_AddRefs(child));
|
aParentNode->GetChildAt(i, getter_AddRefs(child));
|
||||||
nsCOMPtr<nsIDocShellTreeNode> childAsNode(do_QueryInterface(child));
|
NS_ASSERTION(child, "child isn't nsIDocShell");
|
||||||
NS_ASSERTION(childAsNode, "child isn't nsIDocShellTreeNode");
|
if (child) {
|
||||||
if (childAsNode) {
|
SetIsPrintingInDocShellTree(child, aIsPrintingOrPP, false);
|
||||||
SetIsPrintingInDocShellTree(childAsNode, aIsPrintingOrPP, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4084,9 +4083,9 @@ nsDocumentViewer::SetIsPrinting(bool aIsPrinting)
|
|||||||
#ifdef NS_PRINTING
|
#ifdef NS_PRINTING
|
||||||
// Set all the docShells in the docshell tree to be printing.
|
// Set all the docShells in the docshell tree to be printing.
|
||||||
// that way if anyone of them tries to "navigate" it can't
|
// that way if anyone of them tries to "navigate" it can't
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellTreeNode(mContainer);
|
nsCOMPtr<nsIDocShell> docShell(mContainer);
|
||||||
if (docShellTreeNode || !aIsPrinting) {
|
if (docShell || !aIsPrinting) {
|
||||||
SetIsPrintingInDocShellTree(docShellTreeNode, aIsPrinting, true);
|
SetIsPrintingInDocShellTree(docShell, aIsPrinting, true);
|
||||||
} else {
|
} else {
|
||||||
NS_WARNING("Did you close a window before printing?");
|
NS_WARNING("Did you close a window before printing?");
|
||||||
}
|
}
|
||||||
@@ -4120,9 +4119,9 @@ nsDocumentViewer::SetIsPrintPreview(bool aIsPrintPreview)
|
|||||||
#ifdef NS_PRINTING
|
#ifdef NS_PRINTING
|
||||||
// Set all the docShells in the docshell tree to be printing.
|
// Set all the docShells in the docshell tree to be printing.
|
||||||
// that way if anyone of them tries to "navigate" it can't
|
// that way if anyone of them tries to "navigate" it can't
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellTreeNode(mContainer);
|
nsCOMPtr<nsIDocShell> docShell(mContainer);
|
||||||
if (docShellTreeNode || !aIsPrintPreview) {
|
if (docShell || !aIsPrintPreview) {
|
||||||
SetIsPrintingInDocShellTree(docShellTreeNode, aIsPrintPreview, true);
|
SetIsPrintingInDocShellTree(docShell, aIsPrintPreview, true);
|
||||||
}
|
}
|
||||||
if (!aIsPrintPreview) {
|
if (!aIsPrintPreview) {
|
||||||
mBeforeAndAfterPrint = nullptr;
|
mBeforeAndAfterPrint = nullptr;
|
||||||
|
|||||||
@@ -1159,7 +1159,7 @@ nsPrintEngine::IsParentAFrameSet(nsIDocShell * aParent)
|
|||||||
// Recursively build a list of sub documents to be printed
|
// Recursively build a list of sub documents to be printed
|
||||||
// that mirrors the document tree
|
// that mirrors the document tree
|
||||||
void
|
void
|
||||||
nsPrintEngine::BuildDocTree(nsIDocShellTreeNode * aParentNode,
|
nsPrintEngine::BuildDocTree(nsIDocShell * aParentNode,
|
||||||
nsTArray<nsPrintObject*> * aDocList,
|
nsTArray<nsPrintObject*> * aDocList,
|
||||||
nsPrintObject * aPO)
|
nsPrintObject * aPO)
|
||||||
{
|
{
|
||||||
@@ -1180,17 +1180,15 @@ nsPrintEngine::BuildDocTree(nsIDocShellTreeNode * aParentNode,
|
|||||||
if (viewer) {
|
if (viewer) {
|
||||||
nsCOMPtr<nsIContentViewerFile> viewerFile(do_QueryInterface(viewer));
|
nsCOMPtr<nsIContentViewerFile> viewerFile(do_QueryInterface(viewer));
|
||||||
if (viewerFile) {
|
if (viewerFile) {
|
||||||
nsCOMPtr<nsIDocShell> childDocShell(do_QueryInterface(child));
|
nsCOMPtr<nsIDOMDocument> doc = do_GetInterface(childAsShell);
|
||||||
nsCOMPtr<nsIDocShellTreeNode> childNode(do_QueryInterface(child));
|
|
||||||
nsCOMPtr<nsIDOMDocument> doc = do_GetInterface(childDocShell);
|
|
||||||
nsPrintObject * po = new nsPrintObject();
|
nsPrintObject * po = new nsPrintObject();
|
||||||
po->mParent = aPO;
|
po->mParent = aPO;
|
||||||
nsresult rv = po->Init(childDocShell, doc, aPO->mPrintPreview);
|
nsresult rv = po->Init(childAsShell, doc, aPO->mPrintPreview);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
NS_NOTREACHED("Init failed?");
|
NS_NOTREACHED("Init failed?");
|
||||||
aPO->mKids.AppendElement(po);
|
aPO->mKids.AppendElement(po);
|
||||||
aDocList->AppendElement(po);
|
aDocList->AppendElement(po);
|
||||||
BuildDocTree(childNode, aDocList, po);
|
BuildDocTree(childAsShell, aDocList, po);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3757,11 +3755,10 @@ DumpViews(nsIDocShell* aDocShell, FILE* out)
|
|||||||
|
|
||||||
// dump the views of the sub documents
|
// dump the views of the sub documents
|
||||||
int32_t i, n;
|
int32_t i, n;
|
||||||
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
|
aDocShell->GetChildCount(&n);
|
||||||
docShellAsNode->GetChildCount(&n);
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||||
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
|
aDocShell->GetChildAt(i, getter_AddRefs(child));
|
||||||
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
|
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
|
||||||
if (childAsShell) {
|
if (childAsShell) {
|
||||||
DumpViews(childAsShell, out);
|
DumpViews(childAsShell, out);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
// Classes
|
// Classes
|
||||||
class nsPagePrintTimer;
|
class nsPagePrintTimer;
|
||||||
class nsIDocShellTreeNode;
|
class nsIDocShell;
|
||||||
class nsDeviceContext;
|
class nsDeviceContext;
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
class nsIDocumentViewerPrint;
|
class nsIDocumentViewerPrint;
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
bool DonePrintingPages(nsPrintObject* aPO, nsresult aResult);
|
bool DonePrintingPages(nsPrintObject* aPO, nsresult aResult);
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
void BuildDocTree(nsIDocShellTreeNode * aParentNode,
|
void BuildDocTree(nsIDocShell * aParentNode,
|
||||||
nsTArray<nsPrintObject*> * aDocList,
|
nsTArray<nsPrintObject*> * aDocList,
|
||||||
nsPrintObject * aPO);
|
nsPrintObject * aPO);
|
||||||
nsresult ReflowDocList(nsPrintObject * aPO, bool aSetPixelScale);
|
nsresult ReflowDocList(nsPrintObject * aPO, bool aSetPixelScale);
|
||||||
|
|||||||
@@ -320,11 +320,10 @@ static void DumpAWebShell(nsIDocShellTreeItem* aShellItem, FILE* out, int32_t aI
|
|||||||
fprintf(out, "' parent=%p <\n", static_cast<void*>(parent));
|
fprintf(out, "' parent=%p <\n", static_cast<void*>(parent));
|
||||||
|
|
||||||
++aIndent;
|
++aIndent;
|
||||||
nsCOMPtr<nsIDocShellTreeNode> shellAsNode(do_QueryInterface(aShellItem));
|
aShellItem->GetChildCount(&n);
|
||||||
shellAsNode->GetChildCount(&n);
|
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||||
shellAsNode->GetChildAt(i, getter_AddRefs(child));
|
aShellItem->GetChildAt(i, getter_AddRefs(child));
|
||||||
if (child) {
|
if (child) {
|
||||||
DumpAWebShell(child, out, aIndent);
|
DumpAWebShell(child, out, aIndent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -511,7 +511,7 @@
|
|||||||
.currentURI.spec == aSoughtURI.spec)
|
.currentURI.spec == aSoughtURI.spec)
|
||||||
return aDocShell;
|
return aDocShell;
|
||||||
var node = aDocShell.QueryInterface(
|
var node = aDocShell.QueryInterface(
|
||||||
Components.interfaces.nsIDocShellTreeNode);
|
Components.interfaces.nsIDocShellTreeItem);
|
||||||
for (var i = 0; i < node.childCount; ++i) {
|
for (var i = 0; i < node.childCount; ++i) {
|
||||||
var docShell = node.getChildAt(i);
|
var docShell = node.getChildAt(i);
|
||||||
docShell = this.findChildShell(docShell, aSoughtURI);
|
docShell = this.findChildShell(docShell, aSoughtURI);
|
||||||
|
|||||||
@@ -65,7 +65,6 @@
|
|||||||
|
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIDocShellTreeNode.h"
|
|
||||||
|
|
||||||
#include "nsIMarkupDocumentViewer.h"
|
#include "nsIMarkupDocumentViewer.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user