Bug 1166382 - Use the adjusted full zoom in nsDocument::GetViewportInfo(). r=tn
authorBotond Ballo <botond@mozilla.com>
Fri, 29 May 2015 14:28:05 -0400
changeset 246565 8095c9256ae27c4bde8cd6a0cb93d3993d0bcd24
parent 246564 e7f1e7b7e095bdf7b50e0bd36a884a9a4c176d1c
child 246566 14d7c8dce3e4bf76923e5353a55d7c02e881c904
push id60476
push userbballo@mozilla.com
push dateMon, 01 Jun 2015 21:08:34 +0000
treeherdermozilla-inbound@8095c9256ae2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1166382
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1166382 - Use the adjusted full zoom in nsDocument::GetViewportInfo(). r=tn
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -7874,17 +7874,21 @@ nsIDocument::AdoptNode(nsINode& aAdopted
 }
 
 nsViewportInfo
 nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
 {
   // Compute the CSS-to-LayoutDevice pixel scale as the product of the
   // widget scale and the full zoom.
   nsPresContext* context = mPresShell->GetPresContext();
-  float fullZoom = context ? context->GetFullZoom() : 1.0;
+  // When querying the full zoom, get it from the device context rather than
+  // directly from the pres context, because the device context's value can
+  // include an adjustment necessay to keep the number of app units per device
+  // pixel an integer, and we want the adjusted value.
+  float fullZoom = context ? context->DeviceContext()->GetFullZoom() : 1.0;
   fullZoom = (fullZoom == 0.0) ? 1.0 : fullZoom;
   nsIWidget *widget = nsContentUtils::WidgetForDocument(this);
   float widgetScale = widget ? widget->GetDefaultScale().scale : 1.0f;
   CSSToLayoutDeviceScale layoutDeviceScale(widgetScale * fullZoom);
 
   CSSToScreenScale defaultScale = layoutDeviceScale
                                 * LayoutDeviceToScreenScale(1.0);
   // Get requested Desktopmode