зеркало из https://github.com/mozilla/pjs.git
Bug 482687. Remember the appunits-per-devpixel ratio and use it if the window is gone, instead of crashing. r+sr=roc
This commit is contained in:
Родитель
11f2858a67
Коммит
6e8b27bc7b
|
@ -146,7 +146,9 @@ nsXULWindow::nsXULWindow()
|
||||||
mBlurSuppressionLevel(0),
|
mBlurSuppressionLevel(0),
|
||||||
mPersistentAttributesDirty(0),
|
mPersistentAttributesDirty(0),
|
||||||
mPersistentAttributesMask(0),
|
mPersistentAttributesMask(0),
|
||||||
mChromeFlags(nsIWebBrowserChrome::CHROME_ALL)
|
mChromeFlags(nsIWebBrowserChrome::CHROME_ALL),
|
||||||
|
// best guess till we have a widget
|
||||||
|
mAppPerDev(nsPresContext::AppUnitsPerCSSPixel())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,7 +1055,7 @@ PRBool nsXULWindow::LoadPositionFromXUL()
|
||||||
PRInt32 specX = currX;
|
PRInt32 specX = currX;
|
||||||
PRInt32 specY = currY;
|
PRInt32 specY = currY;
|
||||||
nsAutoString posString;
|
nsAutoString posString;
|
||||||
PRInt32 appPerDev = mWindow->GetDeviceContext()->AppUnitsPerDevPixel();
|
PRInt32 appPerDev = AppUnitsPerDevPixel();
|
||||||
|
|
||||||
rv = windowElement->GetAttribute(NS_LITERAL_STRING("screenX"), posString);
|
rv = windowElement->GetAttribute(NS_LITERAL_STRING("screenX"), posString);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -1120,7 +1122,7 @@ PRBool nsXULWindow::LoadSizeFromXUL()
|
||||||
PRInt32 specWidth = currWidth;
|
PRInt32 specWidth = currWidth;
|
||||||
PRInt32 specHeight = currHeight;
|
PRInt32 specHeight = currHeight;
|
||||||
nsAutoString sizeString;
|
nsAutoString sizeString;
|
||||||
PRInt32 appPerDev = mWindow->GetDeviceContext()->AppUnitsPerDevPixel();
|
PRInt32 appPerDev = AppUnitsPerDevPixel();
|
||||||
|
|
||||||
rv = windowElement->GetAttribute(NS_LITERAL_STRING("width"), sizeString);
|
rv = windowElement->GetAttribute(NS_LITERAL_STRING("width"), sizeString);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -1463,7 +1465,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
|
||||||
nsAutoString sizeString;
|
nsAutoString sizeString;
|
||||||
nsAutoString windowElementId;
|
nsAutoString windowElementId;
|
||||||
nsCOMPtr<nsIDOMXULDocument> ownerXULDoc;
|
nsCOMPtr<nsIDOMXULDocument> ownerXULDoc;
|
||||||
PRInt32 appPerDev = mWindow->GetDeviceContext()->AppUnitsPerDevPixel();
|
PRInt32 appPerDev = AppUnitsPerDevPixel();
|
||||||
|
|
||||||
{ // fetch docShellElement's ID and XUL owner document
|
{ // fetch docShellElement's ID and XUL owner document
|
||||||
nsCOMPtr<nsIDOMDocument> ownerDoc;
|
nsCOMPtr<nsIDOMDocument> ownerDoc;
|
||||||
|
@ -2130,6 +2132,17 @@ NS_IMETHODIMP nsXULWindow::SetXULBrowserWindow(nsIXULBrowserWindow * aXULBrowser
|
||||||
// nsXULWindow: Accessors
|
// nsXULWindow: Accessors
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
|
PRInt32 nsXULWindow::AppUnitsPerDevPixel()
|
||||||
|
{
|
||||||
|
if (mWindow && mWindow->GetDeviceContext()) {
|
||||||
|
mAppPerDev = mWindow->GetDeviceContext()->AppUnitsPerDevPixel();
|
||||||
|
} else {
|
||||||
|
NS_ERROR("nsXULWindow::AppUnitsPerDevPixel called with no window "
|
||||||
|
"or no dev context");
|
||||||
|
}
|
||||||
|
return mAppPerDev;
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*** nsContentShellInfo: Object Management
|
//*** nsContentShellInfo: Object Management
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
|
@ -150,6 +150,7 @@ protected:
|
||||||
void SetContentScrollbarVisibility(PRBool aVisible);
|
void SetContentScrollbarVisibility(PRBool aVisible);
|
||||||
PRBool GetContentScrollbarVisibility();
|
PRBool GetContentScrollbarVisibility();
|
||||||
void PersistentAttributesDirty(PRUint32 aDirtyFlags);
|
void PersistentAttributesDirty(PRUint32 aDirtyFlags);
|
||||||
|
PRInt32 AppUnitsPerDevPixel();
|
||||||
|
|
||||||
nsChromeTreeOwner* mChromeTreeOwner;
|
nsChromeTreeOwner* mChromeTreeOwner;
|
||||||
nsContentTreeOwner* mContentTreeOwner;
|
nsContentTreeOwner* mContentTreeOwner;
|
||||||
|
@ -177,6 +178,8 @@ protected:
|
||||||
PRUint32 mPersistentAttributesDirty; // persistentAttributes
|
PRUint32 mPersistentAttributesDirty; // persistentAttributes
|
||||||
PRUint32 mPersistentAttributesMask;
|
PRUint32 mPersistentAttributesMask;
|
||||||
PRUint32 mChromeFlags;
|
PRUint32 mChromeFlags;
|
||||||
|
PRUint32 mAppPerDev; // sometimes needed when we can't get
|
||||||
|
// it from the widget
|
||||||
nsString mTitle;
|
nsString mTitle;
|
||||||
|
|
||||||
nsCOMArray<nsIWeakReference> mTargetableShells; // targetable shells only
|
nsCOMArray<nsIWeakReference> mTargetableShells; // targetable shells only
|
||||||
|
|
Загрузка…
Ссылка в новой задаче