Bug 343515 - need API for tabbrowsers to tell docshells they're visible/hidden.r=gavin,sr=bz,a=blocker
This commit is contained in:
@@ -703,6 +703,7 @@ nsDocShell::nsDocShell():
|
||||
mAllowAuth(PR_TRUE),
|
||||
mAllowKeywordFixup(PR_FALSE),
|
||||
mIsOffScreenBrowser(PR_FALSE),
|
||||
mIsActive(PR_TRUE),
|
||||
mFiredUnloadEvent(PR_FALSE),
|
||||
mEODForCurrentDocument(PR_FALSE),
|
||||
mURIResultedInDocument(PR_FALSE),
|
||||
@@ -2496,6 +2497,10 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
|
||||
{
|
||||
SetAllowImages(value);
|
||||
}
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value)))
|
||||
{
|
||||
SetIsActive(value);
|
||||
}
|
||||
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
|
||||
value = PR_FALSE;
|
||||
}
|
||||
@@ -4618,6 +4623,40 @@ nsDocShell::GetIsOffScreenBrowser(PRBool *aIsOffScreen)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetIsActive(PRBool aIsActive)
|
||||
{
|
||||
// We disallow setting active on chrome docshells.
|
||||
if (mItemType == nsIDocShellTreeItem::typeChrome)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Keep track ourselves.
|
||||
mIsActive = aIsActive;
|
||||
|
||||
// Tell the PresShell about it.
|
||||
nsCOMPtr<nsIPresShell> pshell;
|
||||
GetPresShell(getter_AddRefs(pshell));
|
||||
if (pshell)
|
||||
pshell->SetIsActive(aIsActive);
|
||||
|
||||
// Recursively tell all of our children
|
||||
PRInt32 n = mChildList.Count();
|
||||
for (PRInt32 i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> docshell = do_QueryInterface(ChildAt(i));
|
||||
if (docshell)
|
||||
docshell->SetIsActive(aIsActive);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsActive(PRBool *aIsActive)
|
||||
{
|
||||
*aIsActive = mIsActive;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
@@ -6909,7 +6948,10 @@ nsDocShell::RestoreFromHistory()
|
||||
|
||||
PRBool allowDNSPrefetch;
|
||||
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
|
||||
|
||||
|
||||
// this.AddChild(child) calls child.SetDocLoaderParent(this), meaning
|
||||
// that the child inherits our state. Among other things, this means
|
||||
// that the child inherits our mIsActive, which is what we want.
|
||||
AddChild(childItem);
|
||||
|
||||
childShell->SetAllowPlugins(allowPlugins);
|
||||
|
||||
Reference in New Issue
Block a user