Bug 1034179 - Use the right resolution when generating a FrameMetrics object for GetOrMaybeCreateDisplayport. r=tn a=2.0+
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 03 Jul 2014 15:22:22 -0400
changeset 207747 b8dfb6b7b99a6fa1953b2caf66336e0cff816a60
parent 207746 11b6493a7d8f8ea69b2d9d9170d8d169cd77d097
child 207748 cfd8acd59ca204ef0b0acb700268951a67adb1a7
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn, 2
bugs1034179
milestone32.0a2
Bug 1034179 - Use the right resolution when generating a FrameMetrics object for GetOrMaybeCreateDisplayport. r=tn a=2.0+
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2625,17 +2625,23 @@ CalculateFrameMetricsForDisplayPort(nsIF
   // Calculate the metrics necessary for calculating the displayport.
   // This code has a lot in common with the code in RecordFrameMetrics();
   // we may want to refactor this at some point.
   FrameMetrics metrics;
   nsPresContext* presContext = aScrollFrame->PresContext();
   nsIPresShell* presShell = presContext->PresShell();
   CSSToLayoutDeviceScale deviceScale(float(nsPresContext::AppUnitsPerCSSPixel())
                                      / presContext->AppUnitsPerDevPixel());
-  ParentLayerToLayerScale resolution(presShell->GetResolution().width);
+  ParentLayerToLayerScale resolution;
+  if (aScrollFrame == presShell->GetRootScrollFrame()) {
+    // Only the root scrollable frame for a given presShell should pick up
+    // the presShell's resolution. All the other frames are 1.0.
+    resolution = ParentLayerToLayerScale(presShell->GetXResolution(),
+                                         presShell->GetYResolution());
+  }
   LayoutDeviceToLayerScale cumulativeResolution(presShell->GetCumulativeResolution().width);
 
   metrics.mDevPixelsPerCSSPixel = deviceScale;
   metrics.mResolution = resolution;
   metrics.mCumulativeResolution = cumulativeResolution;
   metrics.SetZoom(deviceScale * cumulativeResolution * LayerToScreenScale(1));
 
   // Only the size of the composition bounds is relevant to the