зеркало из https://github.com/mozilla/gecko-dev.git
Bug 509828 - Specifying left and top features in openWindow doesn't work when screenX and screenY attributes are set on the <window> element and are set to be persisted. r=bz
This commit is contained in:
Родитель
e1ceff4347
Коммит
22321f22ac
|
@ -149,7 +149,9 @@ nsXULWindow::nsXULWindow(PRUint32 aChromeFlags)
|
|||
mPersistentAttributesMask(0),
|
||||
mChromeFlags(aChromeFlags),
|
||||
// best guess till we have a widget
|
||||
mAppPerDev(nsPresContext::AppUnitsPerCSSPixel())
|
||||
mAppPerDev(nsPresContext::AppUnitsPerCSSPixel()),
|
||||
mIgnoreXULSize(PR_FALSE),
|
||||
mIgnoreXULPosition(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -573,8 +575,14 @@ NS_IMETHODIMP nsXULWindow::SetPosition(PRInt32 aX, PRInt32 aY)
|
|||
zoom state. this is important when these two states are competing while
|
||||
the window is being opened. but it should probably just always be so. */
|
||||
mWindow->SetSizeMode(nsSizeMode_Normal);
|
||||
|
||||
|
||||
NS_ENSURE_SUCCESS(mWindow->Move(aX, aY), NS_ERROR_FAILURE);
|
||||
if (!mChromeLoaded) {
|
||||
// If we're called before the chrome is loaded someone obviously wants this
|
||||
// window at this position. We don't persist this one-time position.
|
||||
mIgnoreXULPosition = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
PersistentAttributesDirty(PAD_POSITION);
|
||||
SavePersistentAttributes();
|
||||
return NS_OK;
|
||||
|
@ -595,6 +603,12 @@ NS_IMETHODIMP nsXULWindow::SetSize(PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
|
|||
mIntrinsicallySized = PR_FALSE;
|
||||
|
||||
NS_ENSURE_SUCCESS(mWindow->Resize(aCX, aCY, aRepaint), NS_ERROR_FAILURE);
|
||||
if (!mChromeLoaded) {
|
||||
// If we're called before the chrome is loaded someone obviously wants this
|
||||
// window at this size. We don't persist this one-time size.
|
||||
mIgnoreXULSize = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
PersistentAttributesDirty(PAD_SIZE);
|
||||
SavePersistentAttributes();
|
||||
return NS_OK;
|
||||
|
@ -616,6 +630,13 @@ NS_IMETHODIMP nsXULWindow::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
|
|||
mIntrinsicallySized = PR_FALSE;
|
||||
|
||||
NS_ENSURE_SUCCESS(mWindow->Resize(aX, aY, aCX, aCY, aRepaint), NS_ERROR_FAILURE);
|
||||
if (!mChromeLoaded) {
|
||||
// If we're called before the chrome is loaded someone obviously wants this
|
||||
// window at this size and position. We don't persist this one-time setting.
|
||||
mIgnoreXULPosition = PR_TRUE;
|
||||
mIgnoreXULSize = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
PersistentAttributesDirty(PAD_POSITION | PAD_SIZE);
|
||||
SavePersistentAttributes();
|
||||
return NS_OK;
|
||||
|
@ -978,7 +999,8 @@ void nsXULWindow::OnChromeLoaded()
|
|||
mChromeLoaded = PR_TRUE;
|
||||
ApplyChromeFlags();
|
||||
SyncAttributesToWidget();
|
||||
LoadSizeFromXUL();
|
||||
if (!mIgnoreXULSize)
|
||||
LoadSizeFromXUL();
|
||||
if (mIntrinsicallySized) {
|
||||
// (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false)
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
|
@ -988,7 +1010,7 @@ void nsXULWindow::OnChromeLoaded()
|
|||
markupViewer->SizeToContent();
|
||||
}
|
||||
|
||||
PRBool positionSet = PR_TRUE;
|
||||
PRBool positionSet = !mIgnoreXULPosition;
|
||||
nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
// don't override WM placement on unix for independent, top-level windows
|
||||
|
|
|
@ -169,6 +169,8 @@ protected:
|
|||
PRPackedBool mCenterAfterLoad;
|
||||
PRPackedBool mIsHiddenWindow;
|
||||
PRPackedBool mLockedUntilChromeLoad;
|
||||
PRPackedBool mIgnoreXULSize;
|
||||
PRPackedBool mIgnoreXULPosition;
|
||||
PRUint32 mContextFlags;
|
||||
PRUint32 mBlurSuppressionLevel;
|
||||
PRUint32 mPersistentAttributesDirty; // persistentAttributes
|
||||
|
|
Загрузка…
Ссылка в новой задаче