зеркало из 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: Object Management
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
nsContentTreeOwner::nsContentTreeOwner() : mXULWindow(nsnull)
|
nsContentTreeOwner::nsContentTreeOwner(PRBool fPrimary) : mXULWindow(nsnull),
|
||||||
|
mPrimary(fPrimary)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -306,6 +307,10 @@ NS_IMETHODIMP nsContentTreeOwner::GetTitle(PRUnichar** aTitle)
|
||||||
|
|
||||||
NS_IMETHODIMP nsContentTreeOwner::SetTitle(const 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
|
// Get the window title modifiers
|
||||||
nsCOMPtr<nsIDOMElement> docShellElement;
|
nsCOMPtr<nsIDOMElement> docShellElement;
|
||||||
mXULWindow->GetDOMElementFromDocShell(mXULWindow->mDocShell,
|
mXULWindow->GetDOMElementFromDocShell(mXULWindow->mDocShell,
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
NS_DECL_NSIDOCSHELLTREEOWNER
|
NS_DECL_NSIDOCSHELLTREEOWNER
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsContentTreeOwner();
|
nsContentTreeOwner(PRBool fPrimary);
|
||||||
virtual ~nsContentTreeOwner();
|
virtual ~nsContentTreeOwner();
|
||||||
|
|
||||||
void XULWindow(nsXULWindow* aXULWindow);
|
void XULWindow(nsXULWindow* aXULWindow);
|
||||||
|
@ -49,6 +49,7 @@ protected:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsXULWindow* mXULWindow;
|
nsXULWindow* mXULWindow;
|
||||||
|
PRBool mPrimary;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsContentTreeOwner_h__ */
|
#endif /* nsContentTreeOwner_h__ */
|
||||||
|
|
|
@ -46,8 +46,9 @@ static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
||||||
//*** nsXULWindow: Object Management
|
//*** nsXULWindow: Object Management
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
nsXULWindow::nsXULWindow() : mContentTreeOwner(nsnull),
|
nsXULWindow::nsXULWindow() : mChromeTreeOwner(nsnull),
|
||||||
mChromeTreeOwner(nsnull)
|
mContentTreeOwner(nsnull), mPrimaryContentTreeOwner(nsnull)
|
||||||
|
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -260,6 +261,11 @@ NS_IMETHODIMP nsXULWindow::Destroy()
|
||||||
mContentTreeOwner->XULWindow(nsnull);
|
mContentTreeOwner->XULWindow(nsnull);
|
||||||
NS_RELEASE(mContentTreeOwner);
|
NS_RELEASE(mContentTreeOwner);
|
||||||
}
|
}
|
||||||
|
if(mPrimaryContentTreeOwner)
|
||||||
|
{
|
||||||
|
mPrimaryContentTreeOwner->XULWindow(nsnull);
|
||||||
|
NS_RELEASE(mPrimaryContentTreeOwner);
|
||||||
|
}
|
||||||
if(mChromeTreeOwner)
|
if(mChromeTreeOwner)
|
||||||
{
|
{
|
||||||
mChromeTreeOwner->XULWindow(nsnull);
|
mChromeTreeOwner->XULWindow(nsnull);
|
||||||
|
@ -461,7 +467,7 @@ NS_IMETHODIMP nsXULWindow::EnsureContentTreeOwner()
|
||||||
if(mContentTreeOwner)
|
if(mContentTreeOwner)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
mContentTreeOwner = new nsContentTreeOwner();
|
mContentTreeOwner = new nsContentTreeOwner(PR_FALSE);
|
||||||
NS_ENSURE_TRUE(mContentTreeOwner, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mContentTreeOwner, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
NS_ADDREF(mContentTreeOwner);
|
NS_ADDREF(mContentTreeOwner);
|
||||||
|
@ -470,6 +476,20 @@ NS_IMETHODIMP nsXULWindow::EnsureContentTreeOwner()
|
||||||
return NS_OK;
|
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,
|
NS_IMETHODIMP nsXULWindow::GetDOMElementFromDocShell(nsIDocShell* aDocShell,
|
||||||
nsIDOMElement** aDOMElement)
|
nsIDOMElement** aDOMElement)
|
||||||
{
|
{
|
||||||
|
@ -572,8 +592,16 @@ NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
||||||
|
|
||||||
if(!treeOwner)
|
if(!treeOwner)
|
||||||
{
|
{
|
||||||
NS_ENSURE_SUCCESS(EnsureContentTreeOwner(), NS_ERROR_FAILURE);
|
if(aPrimary)
|
||||||
aContentShell->SetTreeOwner(mContentTreeOwner);
|
{
|
||||||
|
NS_ENSURE_SUCCESS(EnsurePrimaryContentTreeOwner(), NS_ERROR_FAILURE);
|
||||||
|
aContentShell->SetTreeOwner(mPrimaryContentTreeOwner);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NS_ENSURE_SUCCESS(EnsureContentTreeOwner(), NS_ERROR_FAILURE);
|
||||||
|
aContentShell->SetTreeOwner(mContentTreeOwner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -58,6 +58,7 @@ protected:
|
||||||
|
|
||||||
NS_IMETHOD EnsureChromeTreeOwner();
|
NS_IMETHOD EnsureChromeTreeOwner();
|
||||||
NS_IMETHOD EnsureContentTreeOwner();
|
NS_IMETHOD EnsureContentTreeOwner();
|
||||||
|
NS_IMETHOD EnsurePrimaryContentTreeOwner();
|
||||||
|
|
||||||
NS_IMETHOD GetDOMElementFromDocShell(nsIDocShell* aDocShell,
|
NS_IMETHOD GetDOMElementFromDocShell(nsIDocShell* aDocShell,
|
||||||
nsIDOMElement** aDOMElement);
|
nsIDOMElement** aDOMElement);
|
||||||
|
@ -68,6 +69,7 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
nsChromeTreeOwner* mChromeTreeOwner;
|
nsChromeTreeOwner* mChromeTreeOwner;
|
||||||
nsContentTreeOwner* mContentTreeOwner;
|
nsContentTreeOwner* mContentTreeOwner;
|
||||||
|
nsContentTreeOwner* mPrimaryContentTreeOwner;
|
||||||
nsCOMPtr<nsIWidget> mWindow;
|
nsCOMPtr<nsIWidget> mWindow;
|
||||||
nsCOMPtr<nsIDocShell> mDocShell;
|
nsCOMPtr<nsIDocShell> mDocShell;
|
||||||
nsVoidArray mContentShells;
|
nsVoidArray mContentShells;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче