Don't call GetViewManager() if 'mShell' is null. b=408216 r+sr=roc a=blocking1.9

This commit is contained in:
mats.palmgren@bredband.net 2007-12-16 20:59:59 -08:00
Родитель db9caefa16
Коммит 23d8566024
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -739,17 +739,18 @@ void
nsPresContext::PreferenceChanged(const char* aPrefName)
{
if (!nsCRT::strcmp(aPrefName, "layout.css.dpi")) {
// Re-fetch the view manager's window dimensions in case there's a deferred
// resize which hasn't affected our mVisibleArea yet
nscoord oldWidthAppUnits, oldHeightAppUnits;
nsIViewManager* vm = GetViewManager();
vm->GetWindowDimensions(&oldWidthAppUnits, &oldHeightAppUnits);
float oldWidthDevPixels = oldWidthAppUnits/AppUnitsPerDevPixel();
float oldHeightDevPixels = oldHeightAppUnits/AppUnitsPerDevPixel();
PRInt32 oldAppUnitsPerDevPixel = AppUnitsPerDevPixel();
if (mDeviceContext->CheckDPIChange() && mShell) {
mDeviceContext->FlushFontCache();
// Re-fetch the view manager's window dimensions in case there's a deferred
// resize which hasn't affected our mVisibleArea yet
nscoord oldWidthAppUnits, oldHeightAppUnits;
nsIViewManager* vm = GetViewManager();
vm->GetWindowDimensions(&oldWidthAppUnits, &oldHeightAppUnits);
float oldWidthDevPixels = oldWidthAppUnits/oldAppUnitsPerDevPixel;
float oldHeightDevPixels = oldHeightAppUnits/oldAppUnitsPerDevPixel;
nscoord width = NSToCoordRound(oldWidthDevPixels*AppUnitsPerDevPixel());
nscoord height = NSToCoordRound(oldHeightDevPixels*AppUnitsPerDevPixel());
vm->SetWindowDimensions(width, height);