mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1224105 - Allow windowless chrome docshells containing content docshells (r=smaug)
This commit is contained in:
parent
a4a149fd8d
commit
ecabf2935c
@ -326,6 +326,24 @@ nsDocShellTreeOwner::RemoveFromWatcher()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShellTreeOwner::EnsureContentTreeOwner()
|
||||
{
|
||||
if (mContentTreeOwner) {
|
||||
return;
|
||||
}
|
||||
|
||||
mContentTreeOwner = new nsDocShellTreeOwner();
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetWebBrowserChrome();
|
||||
if (browserChrome) {
|
||||
mContentTreeOwner->SetWebBrowserChrome(browserChrome);
|
||||
}
|
||||
|
||||
if (mWebBrowser) {
|
||||
mContentTreeOwner->WebBrowser(mWebBrowser);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
||||
bool aPrimary, bool aTargetable,
|
||||
@ -335,6 +353,9 @@ nsDocShellTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
||||
return mTreeOwner->ContentShellAdded(aContentShell, aPrimary, aTargetable,
|
||||
aID);
|
||||
|
||||
EnsureContentTreeOwner();
|
||||
aContentShell->SetTreeOwner(mContentTreeOwner);
|
||||
|
||||
if (aPrimary) {
|
||||
mPrimaryContentShell = aContentShell;
|
||||
mPrimaryTabParent = nullptr;
|
||||
@ -791,6 +812,13 @@ nsDocShellTreeOwner::WebBrowser(nsWebBrowser* aWebBrowser)
|
||||
}
|
||||
|
||||
mWebBrowser = aWebBrowser;
|
||||
|
||||
if (mContentTreeOwner) {
|
||||
mContentTreeOwner->WebBrowser(aWebBrowser);
|
||||
if (!aWebBrowser) {
|
||||
mContentTreeOwner = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsWebBrowser*
|
||||
@ -844,6 +872,11 @@ nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWebBrowserChrome)
|
||||
mOwnerRequestor = requestor;
|
||||
}
|
||||
}
|
||||
|
||||
if (mContentTreeOwner) {
|
||||
mContentTreeOwner->SetWebBrowserChrome(aWebBrowserChrome);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,8 @@ protected:
|
||||
void AddToWatcher();
|
||||
void RemoveFromWatcher();
|
||||
|
||||
void EnsureContentTreeOwner();
|
||||
|
||||
// These helper functions return the correct instances of the requested
|
||||
// interfaces. If the object passed to SetWebBrowserChrome() implements
|
||||
// nsISupportsWeakReference, then these functions call QueryReferent on
|
||||
@ -128,6 +130,8 @@ protected:
|
||||
RefPtr<ChromeTooltipListener> mChromeTooltipListener;
|
||||
RefPtr<ChromeContextMenuListener> mChromeContextMenuListener;
|
||||
|
||||
RefPtr<nsDocShellTreeOwner> mContentTreeOwner;
|
||||
|
||||
nsCOMPtr<nsIPrompt> mPrompter;
|
||||
nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
|
||||
nsCOMPtr<nsITabParent> mPrimaryTabParent;
|
||||
|
Loading…
Reference in New Issue
Block a user