Bug 874295. On non-Android platforms (and eventually for Android), use call GetDefaultScale instead of GetDevicePixelsPerMetaViewportPixel. r=mbrubeck

--HG--
extra : rebase_source : 9c0544baccfe277e9340d185f189eda174923eb4
This commit is contained in:
Robert O'Callahan 2013-05-30 16:34:32 +12:00
Родитель f68e311176
Коммит 072bee6956
3 изменённых файлов: 11 добавлений и 0 удалений

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

@ -1560,10 +1560,14 @@ public:
uint32_t aDisplayWidth,
uint32_t aDisplayHeight);
#ifdef MOZ_WIDGET_ANDROID
/**
* The device-pixel-to-CSS-px ratio used to adjust meta viewport values.
* XXX Not to be used --- use nsIWidget::GetDefaultScale instead. Will be
* removed when bug 803207 is fixed.
*/
static double GetDevicePixelsPerMetaViewportPixel(nsIWidget* aWidget);
#endif
// Call EnterMicroTask when you're entering JS execution.
// Usually the best way to do this is to use nsAutoMicroTask.

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

@ -4905,6 +4905,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument,
return aDocument->GetViewportInfo(aDisplayWidth, aDisplayHeight);
}
#ifdef MOZ_WIDGET_ANDROID
/* static */
double
nsContentUtils::GetDevicePixelsPerMetaViewportPixel(nsIWidget* aWidget)
@ -4926,6 +4927,7 @@ nsContentUtils::GetDevicePixelsPerMetaViewportPixel(nsIWidget* aWidget)
// For very high-density displays like the iPhone 4, use an integer ratio.
return floor(dpi / 150.0);
}
#endif
/* static */
nsresult

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

@ -6892,7 +6892,12 @@ nsDocument::GetViewportInfo(uint32_t aDisplayWidth,
}
// Now convert the scale into device pixels per CSS pixel.
nsIWidget *widget = nsContentUtils::WidgetForDocument(this);
#ifdef MOZ_WIDGET_ANDROID
// Temporarily use special Android code until bug 803207 is fixed
double pixelRatio = widget ? nsContentUtils::GetDevicePixelsPerMetaViewportPixel(widget) : 1.0;
#else
double pixelRatio = widget ? widget->GetDefaultScale() : 1.0;
#endif
float scaleFloat = mScaleFloat * pixelRatio;
float scaleMinFloat= mScaleMinFloat * pixelRatio;
float scaleMaxFloat = mScaleMaxFloat * pixelRatio;