зеркало из https://github.com/mozilla/gecko-dev.git
moving [GS]etPersistence from nsIWebBrowserChrome to nsIDocShellTreeOwner. embedding API review meeting made me do it. bug 69918 r=ccarlen,hyatt
This commit is contained in:
Родитель
3820e09600
Коммит
1c99ca8f94
|
@ -92,4 +92,18 @@ interface nsIDocShellTreeOwner : nsISupports
|
|||
a need for a new JS window, etc.
|
||||
*/
|
||||
nsIDocShellTreeItem getNewWindow(in long aChromeFlags);
|
||||
|
||||
/*
|
||||
Sets the persistence of different attributes of the window.
|
||||
*/
|
||||
void setPersistence(in boolean aPersistPosition,
|
||||
in boolean aPersistSize,
|
||||
in boolean aPersistSizeMode);
|
||||
|
||||
/*
|
||||
Gets the current persistence states of the window.
|
||||
*/
|
||||
void getPersistence(out boolean aPersistPosition,
|
||||
out boolean aPersistSize,
|
||||
out boolean aPersistSizeMode);
|
||||
};
|
||||
|
|
|
@ -535,6 +535,22 @@ NS_IMETHODIMP CWebBrowserContainer::GetNewWindow(PRInt32 aChromeFlags,
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetPersistence(PRBool aPersistPosition,
|
||||
PRBool aPersistSize,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetPersistence(PRBool* aPersistPosition,
|
||||
PRBool* aPersistSize,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebBrowserSiteWindow
|
||||
|
||||
|
@ -692,23 +708,6 @@ CWebBrowserContainer::ExitModalEventLoop(nsresult aStatus)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamObserver implementation
|
||||
|
||||
|
|
|
@ -219,22 +219,6 @@ EmbedWindow::ExitModalEventLoop(nsresult aStatus)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedWindow::GetPersistence(PRBool *aPersistX, PRBool *aPersistY,
|
||||
PRBool *aPersistCX, PRBool *aPersistCY,
|
||||
PRBool *aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIWebBrowserSiteWindow
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -726,6 +726,22 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetNewWindow(PRInt32 aChromeFlags,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GtkMozEmbedChrome::SetPersistence(PRBool aPersistPosition,
|
||||
PRBool aPersistSize,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GtkMozEmbedChrome::GetPersistence(PRBool* aPersistPosition,
|
||||
PRBool* aPersistSize,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIWebBrowserSiteWindow interface
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::Destroy(void)
|
||||
|
@ -836,22 +852,6 @@ NS_IMETHODIMP GtkMozEmbedChrome::SetTitle(const PRUnichar * aTitle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GtkMozEmbedChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GtkMozEmbedChrome::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIPrompt
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -637,6 +637,22 @@ NS_IMETHODIMP PhMozEmbedChrome::GetNewWindow(PRInt32 aChromeFlags,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PhMozEmbedChrome::SetPersistence(PRBool aPersistPosition,
|
||||
PRBool aPersistSize,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentTreeOwner::GetPersistence(PRBool* aPersistPosition,
|
||||
PRBool* aPersistSize,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIBaseWindow interface
|
||||
|
||||
NS_IMETHODIMP PhMozEmbedChrome::InitWindow(nativeWindow parentNativeWindow,
|
||||
|
@ -815,19 +831,3 @@ NS_IMETHODIMP PhMozEmbedChrome::SetTitle(const PRUnichar * aTitle)
|
|||
mChromeListener->Message(PhEmbedListener::MessageTitle, mTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PhMozEmbedChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PhMozEmbedChrome::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -299,22 +299,6 @@ NS_IMETHODIMP CWebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserChrome::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CWebBrowserChrome::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -421,6 +421,21 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::SetPersistence(PRBool aPersistPosition,
|
||||
PRBool aPersistSize,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::GetPersistence(PRBool* aPersistPosition,
|
||||
PRBool* aPersistSize,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShellTreeOwner::nsIBaseWindow
|
||||
|
|
|
@ -126,19 +126,4 @@ interface nsIWebBrowserChrome : nsISupports
|
|||
@param aStatus - the result code to return from showAsModal
|
||||
*/
|
||||
void exitModalEventLoop(in nsresult aStatus);
|
||||
|
||||
/*
|
||||
Sets the persistence of different dimensions of the window.
|
||||
*/
|
||||
void setPersistence(in boolean persistX, in boolean persistY,
|
||||
in boolean persistCX, in boolean persistCY,
|
||||
in boolean persistSizeMode);
|
||||
|
||||
/*
|
||||
Gets the current persistence states of the window.
|
||||
*/
|
||||
void getPersistence(out boolean persistX, out boolean persistY,
|
||||
out boolean persistCX, out boolean persistCY,
|
||||
out boolean persistSizeMode);
|
||||
|
||||
};
|
||||
|
|
|
@ -479,22 +479,21 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent,
|
|||
return rv;
|
||||
|
||||
/* disable persistence of size/position in popups (determined by
|
||||
looking for the outerWidth/outerHeight features. seems backward
|
||||
though -- it's a popup if both features are lacking? */
|
||||
determining whether the features parameter specifies width or height
|
||||
in any way). We consider any overriding of the window's size or position
|
||||
in the open call as disabling persistence of those attributes.
|
||||
Popup windows (which should not persist size or position) generally set
|
||||
the size. */
|
||||
if (windowIsNew) {
|
||||
PRBool present = PR_FALSE;
|
||||
/* at the moment, the strings "height=" or "width=" never happen
|
||||
outside a size specification, so we can do this the Q&D way. */
|
||||
|
||||
if (!(WinHasOption(features, "outerWidth", 0, &present) || present) &&
|
||||
!(WinHasOption(features, "outerHeight", 0, &present) || present)) {
|
||||
if (PL_strcasestr(features, "width=") || PL_strcasestr(features, "height=")) {
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> newTreeOwner;
|
||||
newDocShellItem->GetTreeOwner(getter_AddRefs(newTreeOwner));
|
||||
if (newTreeOwner) {
|
||||
nsCOMPtr<nsIWebBrowserChrome> newChrome = do_GetInterface(newTreeOwner);
|
||||
if (newChrome)
|
||||
newChrome->SetPersistence(PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE,
|
||||
PR_FALSE);
|
||||
}
|
||||
if (newTreeOwner)
|
||||
newTreeOwner->SetPersistence(PR_FALSE, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -202,22 +202,6 @@ NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebBrowserChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebBrowserChrome::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// WebBrowserChrome::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -262,22 +262,6 @@ NS_IMETHODIMP CBrowserImpl::ExitModalEventLoop(nsresult aStatus)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CBrowserImpl::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CBrowserImpl::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserImpl::nsIWebBrowserSiteWindow
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -232,23 +232,6 @@ NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebBrowserChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebBrowserChrome::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// WebBrowserChrome::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -205,22 +205,6 @@ NS_IMETHODIMP nsWebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowserChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowserChrome::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowserChrome::nsIWebBrowserSiteWindow
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -199,6 +199,22 @@ NS_IMETHODIMP nsChromeTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
|
|||
return mXULWindow->GetNewWindow(aChromeFlags, aDocShellTreeItem);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeTreeOwner::SetPersistence(PRBool aPersistPosition,
|
||||
PRBool aPersistSize,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeTreeOwner::GetPersistence(PRBool* aPersistPosition,
|
||||
PRBool* aPersistSize,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsChromeTreeOwner::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -228,6 +228,99 @@ NS_IMETHODIMP nsContentTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
|
|||
return mXULWindow->GetNewWindow(aChromeFlags, aDocShellTreeItem);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentTreeOwner::SetPersistence(PRBool aPersistPosition,
|
||||
PRBool aPersistSize,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> docShellElement;
|
||||
mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
|
||||
if(!docShellElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString persistString;
|
||||
docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString);
|
||||
|
||||
PRBool saveString = PR_FALSE;
|
||||
PRInt32 index;
|
||||
|
||||
// Set X
|
||||
index = persistString.Find("screenX");
|
||||
if (!aPersistPosition && index >= 0) {
|
||||
persistString.Cut(index, 7);
|
||||
saveString = PR_TRUE;
|
||||
} else if (aPersistPosition && index < 0) {
|
||||
persistString.AppendWithConversion(" screenX");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set Y
|
||||
index = persistString.Find("screenY");
|
||||
if (!aPersistPosition && index >= 0) {
|
||||
persistString.Cut(index, 7);
|
||||
saveString = PR_TRUE;
|
||||
} else if (aPersistPosition && index < 0) {
|
||||
persistString.AppendWithConversion(" screenY");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set CX
|
||||
index = persistString.Find("width");
|
||||
if (!aPersistSize && index >= 0) {
|
||||
persistString.Cut(index, 5);
|
||||
saveString = PR_TRUE;
|
||||
} else if (aPersistSize && index < 0) {
|
||||
persistString.AppendWithConversion(" width");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set CY
|
||||
index = persistString.Find("height");
|
||||
if (!aPersistSize && index >= 0) {
|
||||
persistString.Cut(index, 6);
|
||||
saveString = PR_TRUE;
|
||||
} else if (aPersistSize && index < 0) {
|
||||
persistString.AppendWithConversion(" height");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set SizeMode
|
||||
index = persistString.Find("sizemode");
|
||||
if (!aPersistSizeMode && (index >= 0)) {
|
||||
persistString.Cut(index, 8);
|
||||
saveString = PR_TRUE;
|
||||
} else if (aPersistSizeMode && (index < 0)) {
|
||||
persistString.AppendWithConversion(" sizemode");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
|
||||
if(saveString)
|
||||
docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentTreeOwner::GetPersistence(PRBool* aPersistPosition,
|
||||
PRBool* aPersistSize,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> docShellElement;
|
||||
mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
|
||||
if(!docShellElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString persistString;
|
||||
docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString);
|
||||
|
||||
// data structure doesn't quite match the question, but it's close enough
|
||||
// for what we want (since this method is never actually called...)
|
||||
if (aPersistPosition)
|
||||
*aPersistPosition = persistString.Find("screenX") >= 0 || persistString.Find("screenY") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
if (aPersistSize)
|
||||
*aPersistSize = persistString.Find("width") >= 0 || persistString.Find("height") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
if (aPersistSizeMode)
|
||||
*aPersistSizeMode = persistString.Find("sizemode") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsContentTreeOwner::nsIWebBrowserChrome
|
||||
//*****************************************************************************
|
||||
|
@ -320,101 +413,6 @@ NS_IMETHODIMP nsContentTreeOwner::ExitModalEventLoop(nsresult aStatus)
|
|||
return ExitModalLoop(aStatus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentTreeOwner::SetPersistence(PRBool aPersistX, PRBool aPersistY,
|
||||
PRBool aPersistCX, PRBool aPersistCY,
|
||||
PRBool aPersistSizeMode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> docShellElement;
|
||||
mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
|
||||
if(!docShellElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString persistString;
|
||||
docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString);
|
||||
|
||||
PRBool saveString = PR_FALSE;
|
||||
PRInt32 index;
|
||||
|
||||
// Set X
|
||||
index = persistString.Find("screenX");
|
||||
if(!aPersistX && (index >= 0)) {
|
||||
persistString.Cut(index, 7);
|
||||
saveString = PR_TRUE;
|
||||
} else if(aPersistX && (index < 0 )) {
|
||||
persistString.AppendWithConversion(" screenX");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set Y
|
||||
index = persistString.Find("screenY");
|
||||
if(!aPersistY && (index >= 0)) {
|
||||
persistString.Cut(index, 7);
|
||||
saveString = PR_TRUE;
|
||||
} else if(aPersistY && (index < 0 )) {
|
||||
persistString.AppendWithConversion(" screenY");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set CX
|
||||
index = persistString.Find("width");
|
||||
if(!aPersistCX && (index >= 0)) {
|
||||
persistString.Cut(index, 5);
|
||||
saveString = PR_TRUE;
|
||||
} else if(aPersistCX && (index < 0 )) {
|
||||
persistString.AppendWithConversion(" width");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set CY
|
||||
index = persistString.Find("height");
|
||||
if(!aPersistCY && (index >= 0)) {
|
||||
persistString.Cut(index, 6);
|
||||
saveString = PR_TRUE;
|
||||
} else if(aPersistCY && (index < 0 )) {
|
||||
persistString.AppendWithConversion(" height");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
// Set SizeMode
|
||||
index = persistString.Find("sizemode");
|
||||
if (!aPersistSizeMode && (index >= 0)) {
|
||||
persistString.Cut(index, 8);
|
||||
saveString = PR_TRUE;
|
||||
} else if (aPersistSizeMode && (index < 0)) {
|
||||
persistString.AppendWithConversion(" sizemode");
|
||||
saveString = PR_TRUE;
|
||||
}
|
||||
|
||||
if(saveString)
|
||||
docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentTreeOwner::GetPersistence(PRBool* aPersistX, PRBool* aPersistY,
|
||||
PRBool* aPersistCX, PRBool* aPersistCY,
|
||||
PRBool* aPersistSizeMode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> docShellElement;
|
||||
mXULWindow->GetWindowDOMElement(getter_AddRefs(docShellElement));
|
||||
if(!docShellElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString persistString;
|
||||
docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString);
|
||||
|
||||
if(aPersistX)
|
||||
*aPersistX = persistString.Find("screenX") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
if(aPersistY)
|
||||
*aPersistY = persistString.Find("screenY") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
if(aPersistCX)
|
||||
*aPersistCX = persistString.Find("width") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
if(aPersistCY)
|
||||
*aPersistCY = persistString.Find("height") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
if(aPersistSizeMode)
|
||||
*aPersistSizeMode = persistString.Find("sizemode") >= 0 ? PR_TRUE : PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsContentTreeOwner::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -1397,16 +1397,6 @@ void nsWebShellWindow::StoreBoundsToXUL(PRBool aPosition, PRBool aSize, PRBool a
|
|||
PersistPositionAndSize(aPosition, aSize, aSizeMode);
|
||||
} // StoreBoundsToXUL
|
||||
|
||||
|
||||
void nsWebShellWindow::KillPersistentSize()
|
||||
{
|
||||
PRBool persistX, persistY;
|
||||
|
||||
mContentTreeOwner->GetPersistence(&persistX, &persistY, nsnull, nsnull, nsnull);
|
||||
mContentTreeOwner->SetPersistence(persistX, persistY, PR_FALSE, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
// if the main document URL specified URLs for any content areas, start them loading
|
||||
void nsWebShellWindow::LoadContentAreas() {
|
||||
|
||||
|
|
|
@ -180,7 +180,6 @@ protected:
|
|||
nsCOMPtr<nsIDOMNode> GetDOMNodeFromWebShell(nsIWebShell *aShell);
|
||||
void ExecuteStartupCode();
|
||||
void StoreBoundsToXUL(PRBool aPosition, PRBool aSize, PRBool aSizeMode);
|
||||
void KillPersistentSize();
|
||||
void LoadContentAreas();
|
||||
PRBool ExecuteCloseHandler();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче