Bug 912806 - Special-case the resolution behaviour on Fennec to work around other bugs. r=tn
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 11 Sep 2013 18:17:20 -0400
changeset 146653 ce483735e803a650b37b8a334271b304bca93c1d
parent 146652 1002b028b6c4dbed76528685ff649d9327ea1cc1
child 146654 988953e0c2080e3e829666239e2455015a6b6e27
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerstn
bugs912806
milestone26.0a1
Bug 912806 - Special-case the resolution behaviour on Fennec to work around other bugs. r=tn
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -675,16 +675,25 @@ static void RecordFrameMetrics(nsIFrame*
   nsIPresShell* curPresShell = presShell;
   while (curPresShell != nullptr) {
     ParentLayerToLayerScale presShellResolution(curPresShell->GetXResolution(),
                                                 curPresShell->GetYResolution());
     metrics.mCumulativeResolution.scale *= presShellResolution.scale;
     nsPresContext* parentContext = curPresShell->GetPresContext()->GetParentPresContext();
     curPresShell = parentContext ? parentContext->GetPresShell() : nullptr;
   }
+#ifdef MOZ_WIDGET_ANDROID
+  if (presContext->IsRootContentDocument() && aScrollFrame == presShell->GetRootScrollFrame()) {
+    // On Android we set the resolution on a different presshell (bug 732971) so we
+    // need some special handling here to make things work properly. Once bug 732971 is
+    // fixed we should remove this ifdef block, and adjust any other pieces that need
+    // adjusting to make this work properly.
+    metrics.mResolution.scale = metrics.mCumulativeResolution.scale;
+  }
+#endif
 
   metrics.mDevPixelsPerCSSPixel = CSSToLayoutDeviceScale(
     (float)nsPresContext::AppUnitsPerCSSPixel() / auPerDevPixel);
 
   // Initially, AsyncPanZoomController should render the content to the screen
   // at the painted resolution.
   const LayerToScreenScale layerToScreenScale(1.0f);
   metrics.mZoom = metrics.mCumulativeResolution * metrics.mDevPixelsPerCSSPixel