зеркало из https://github.com/mozilla/gecko-dev.git
The default content tree owner now has a separation of primary versus normal content areas. Primary areas are the only content areas that actually react to and set the title.
This commit is contained in:
Родитель
a5383448c8
Коммит
7c45f8716d
|
@ -40,7 +40,8 @@ static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
|||
//*** nsContentTreeOwner: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsContentTreeOwner::nsContentTreeOwner() : mXULWindow(nsnull)
|
||||
nsContentTreeOwner::nsContentTreeOwner(PRBool fPrimary) : mXULWindow(nsnull),
|
||||
mPrimary(fPrimary)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
@ -306,6 +307,10 @@ NS_IMETHODIMP nsContentTreeOwner::GetTitle(PRUnichar** aTitle)
|
|||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle)
|
||||
{
|
||||
// We only allow the title to be set from the primary content shell
|
||||
if(!mPrimary)
|
||||
return NS_OK;
|
||||
|
||||
// Get the window title modifiers
|
||||
nsCOMPtr<nsIDOMElement> docShellElement;
|
||||
mXULWindow->GetDOMElementFromDocShell(mXULWindow->mDocShell,
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
NS_DECL_NSIDOCSHELLTREEOWNER
|
||||
|
||||
protected:
|
||||
nsContentTreeOwner();
|
||||
nsContentTreeOwner(PRBool fPrimary);
|
||||
virtual ~nsContentTreeOwner();
|
||||
|
||||
void XULWindow(nsXULWindow* aXULWindow);
|
||||
|
@ -49,6 +49,7 @@ protected:
|
|||
|
||||
protected:
|
||||
nsXULWindow* mXULWindow;
|
||||
PRBool mPrimary;
|
||||
};
|
||||
|
||||
#endif /* nsContentTreeOwner_h__ */
|
||||
|
|
|
@ -46,8 +46,9 @@ static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
|||
//*** nsXULWindow: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsXULWindow::nsXULWindow() : mContentTreeOwner(nsnull),
|
||||
mChromeTreeOwner(nsnull)
|
||||
nsXULWindow::nsXULWindow() : mChromeTreeOwner(nsnull),
|
||||
mContentTreeOwner(nsnull), mPrimaryContentTreeOwner(nsnull)
|
||||
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
@ -260,6 +261,11 @@ NS_IMETHODIMP nsXULWindow::Destroy()
|
|||
mContentTreeOwner->XULWindow(nsnull);
|
||||
NS_RELEASE(mContentTreeOwner);
|
||||
}
|
||||
if(mPrimaryContentTreeOwner)
|
||||
{
|
||||
mPrimaryContentTreeOwner->XULWindow(nsnull);
|
||||
NS_RELEASE(mPrimaryContentTreeOwner);
|
||||
}
|
||||
if(mChromeTreeOwner)
|
||||
{
|
||||
mChromeTreeOwner->XULWindow(nsnull);
|
||||
|
@ -461,7 +467,7 @@ NS_IMETHODIMP nsXULWindow::EnsureContentTreeOwner()
|
|||
if(mContentTreeOwner)
|
||||
return NS_OK;
|
||||
|
||||
mContentTreeOwner = new nsContentTreeOwner();
|
||||
mContentTreeOwner = new nsContentTreeOwner(PR_FALSE);
|
||||
NS_ENSURE_TRUE(mContentTreeOwner, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ADDREF(mContentTreeOwner);
|
||||
|
@ -470,6 +476,20 @@ NS_IMETHODIMP nsXULWindow::EnsureContentTreeOwner()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::EnsurePrimaryContentTreeOwner()
|
||||
{
|
||||
if(mPrimaryContentTreeOwner)
|
||||
return NS_OK;
|
||||
|
||||
mPrimaryContentTreeOwner = new nsContentTreeOwner(PR_TRUE);
|
||||
NS_ENSURE_TRUE(mPrimaryContentTreeOwner, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ADDREF(mPrimaryContentTreeOwner);
|
||||
mPrimaryContentTreeOwner->XULWindow(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::GetDOMElementFromDocShell(nsIDocShell* aDocShell,
|
||||
nsIDOMElement** aDOMElement)
|
||||
{
|
||||
|
@ -571,10 +591,18 @@ NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
|||
aContentShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
|
||||
if(!treeOwner)
|
||||
{
|
||||
if(aPrimary)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(EnsurePrimaryContentTreeOwner(), NS_ERROR_FAILURE);
|
||||
aContentShell->SetTreeOwner(mPrimaryContentTreeOwner);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ENSURE_SUCCESS(EnsureContentTreeOwner(), NS_ERROR_FAILURE);
|
||||
aContentShell->SetTreeOwner(mContentTreeOwner);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ protected:
|
|||
|
||||
NS_IMETHOD EnsureChromeTreeOwner();
|
||||
NS_IMETHOD EnsureContentTreeOwner();
|
||||
NS_IMETHOD EnsurePrimaryContentTreeOwner();
|
||||
|
||||
NS_IMETHOD GetDOMElementFromDocShell(nsIDocShell* aDocShell,
|
||||
nsIDOMElement** aDOMElement);
|
||||
|
@ -68,6 +69,7 @@ protected:
|
|||
protected:
|
||||
nsChromeTreeOwner* mChromeTreeOwner;
|
||||
nsContentTreeOwner* mContentTreeOwner;
|
||||
nsContentTreeOwner* mPrimaryContentTreeOwner;
|
||||
nsCOMPtr<nsIWidget> mWindow;
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
nsVoidArray mContentShells;
|
||||
|
|
Загрузка…
Ссылка в новой задаче