diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 8f7797e4940..4977d417826 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -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. diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index f8dabdd427c..2e57d934ccf 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -4902,6 +4902,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument, return aDocument->GetViewportInfo(aDisplayWidth, aDisplayHeight); } +#ifdef MOZ_WIDGET_ANDROID /* static */ double nsContentUtils::GetDevicePixelsPerMetaViewportPixel(nsIWidget* aWidget) @@ -4923,6 +4924,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 diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 1afabe69316..8b59063f0c2 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -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;