mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1020163 - Replace some callers of GetParent() with GetParentDocshell() in nsDocShell. r=jst
This allows simplifying the callers and avoiding some QI calls.
This commit is contained in:
parent
c11e1e336c
commit
362740420c
@ -2474,17 +2474,14 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
|
||||
// If we have no parent then we're the root docshell; no ancestor of the
|
||||
// original docshell doesn't have a allowfullscreen attribute, so
|
||||
// report fullscreen as allowed.
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
GetParent(getter_AddRefs(parentTreeItem));
|
||||
if (!parentTreeItem) {
|
||||
nsRefPtr<nsDocShell> parent = GetParentDocshell();
|
||||
if (!parent) {
|
||||
*aFullscreenAllowed = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise, we have a parent, continue the checking for
|
||||
// mozFullscreenAllowed in the parent docshell's ancestors.
|
||||
nsCOMPtr<nsIDocShell> parent = do_QueryInterface(parentTreeItem);
|
||||
NS_ENSURE_TRUE(parent, NS_OK);
|
||||
|
||||
return parent->GetFullscreenAllowed(aFullscreenAllowed);
|
||||
}
|
||||
|
||||
@ -3132,16 +3129,15 @@ NS_IMETHODIMP
|
||||
nsDocShell::GetRootTreeItem(nsIDocShellTreeItem ** aRootTreeItem)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootTreeItem);
|
||||
*aRootTreeItem = static_cast<nsIDocShellTreeItem *>(this);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
NS_ENSURE_SUCCESS(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
|
||||
nsRefPtr<nsDocShell> root = this;
|
||||
nsRefPtr<nsDocShell> parent = root->GetParentDocshell();
|
||||
while (parent) {
|
||||
*aRootTreeItem = parent;
|
||||
NS_ENSURE_SUCCESS((*aRootTreeItem)->GetParent(getter_AddRefs(parent)),
|
||||
NS_ERROR_FAILURE);
|
||||
root = parent;
|
||||
parent = root->GetParentDocshell();
|
||||
}
|
||||
NS_ADDREF(*aRootTreeItem);
|
||||
|
||||
root.forget(aRootTreeItem);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -5556,15 +5552,12 @@ nsDocShell::GetVisibility(bool * aVisibility)
|
||||
// for a hidden view, unless we're an off screen browser, which
|
||||
// would make this test meaningless.
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = this;
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentItem));
|
||||
nsRefPtr<nsDocShell> docShell = this;
|
||||
nsRefPtr<nsDocShell> parentItem = docShell->GetParentDocshell();
|
||||
while (parentItem) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(treeItem));
|
||||
presShell = docShell->GetPresShell();
|
||||
|
||||
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parentItem);
|
||||
nsCOMPtr<nsIPresShell> pPresShell = parentDS->GetPresShell();
|
||||
nsCOMPtr<nsIPresShell> pPresShell = parentItem->GetPresShell();
|
||||
|
||||
// Null-check for crash in bug 267804
|
||||
if (!pPresShell) {
|
||||
@ -5593,8 +5586,8 @@ nsDocShell::GetVisibility(bool * aVisibility)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
treeItem = parentItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentItem));
|
||||
docShell = parentItem;
|
||||
parentItem = docShell->GetParentDocshell();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin(do_QueryInterface(mTreeOwner));
|
||||
@ -8019,8 +8012,7 @@ nsDocShell::RestoreFromHistory()
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(domDoc);
|
||||
uint32_t parentSuspendCount = 0;
|
||||
if (document) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetParent(getter_AddRefs(parent));
|
||||
nsRefPtr<nsDocShell> parent = GetParentDocshell();
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIDocument> d = parent->GetDocument();
|
||||
if (d) {
|
||||
@ -9225,8 +9217,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
|
||||
// If this docshell is owned by a frameloader, make sure to cancel
|
||||
// possible frameloader initialization before loading a new page.
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetParent(getter_AddRefs(parent));
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent = GetParentDocshell();
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIDocument> doc = do_GetInterface(parent);
|
||||
if (doc) {
|
||||
@ -12302,7 +12293,7 @@ nsDocShell::GetNestedFrameId(uint64_t* aId)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::IsAppOfType(uint32_t aAppType, bool *aIsOfType)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> shell = this;
|
||||
nsRefPtr<nsDocShell> shell = this;
|
||||
while (shell) {
|
||||
uint32_t type;
|
||||
shell->GetAppType(&type);
|
||||
@ -12310,10 +12301,7 @@ nsDocShell::IsAppOfType(uint32_t aAppType, bool *aIsOfType)
|
||||
*aIsOfType = true;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(shell);
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
item->GetParent(getter_AddRefs(parent));
|
||||
shell = do_QueryInterface(parent);
|
||||
shell = shell->GetParentDocshell();
|
||||
}
|
||||
|
||||
*aIsOfType = false;
|
||||
@ -13076,19 +13064,14 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||
bool
|
||||
nsDocShell::HasUnloadedParent()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> currentTreeItem = this;
|
||||
while (currentTreeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
currentTreeItem->GetParent(getter_AddRefs(parentTreeItem));
|
||||
nsCOMPtr<nsIDocShell> parent = do_QueryInterface(parentTreeItem);
|
||||
if (parent) {
|
||||
bool inUnload = false;
|
||||
parent->GetIsInUnload(&inUnload);
|
||||
if (inUnload) {
|
||||
return true;
|
||||
}
|
||||
nsRefPtr<nsDocShell> parent = GetParentDocshell();
|
||||
while (parent) {
|
||||
bool inUnload = false;
|
||||
parent->GetIsInUnload(&inUnload);
|
||||
if (inUnload) {
|
||||
return true;
|
||||
}
|
||||
currentTreeItem.swap(parentTreeItem);
|
||||
parent = parent->GetParentDocshell();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user