Bug 1511375 - Update the visual viewport size in UpdateResolution() if either the zoom or the display size might have changed. r=kats
authorBotond Ballo <botond@mozilla.com>
Sat, 01 Dec 2018 05:34:57 +0000
changeset 508299 b12e6afd5831cc692e666d4295cbb260613fd8ad
parent 508298 a5b0559c23721f0d6a54242afa17bf0124b10c5d
child 508304 b3085cd7b7c20a55894eb3dcd8c92ab2bc0f03f3
child 508305 2f15c3366bf0c1993c63c46e3e3efc4a2c9a4842
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1511375
milestone65.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 1511375 - Update the visual viewport size in UpdateResolution() if either the zoom or the display size might have changed. r=kats Differential Revision: https://phabricator.services.mozilla.com/D13578
layout/base/MobileViewportManager.cpp
--- a/layout/base/MobileViewportManager.cpp
+++ b/layout/base/MobileViewportManager.cpp
@@ -324,25 +324,29 @@ void MobileViewportManager::UpdateResolu
       // not _smaller_ than the intrinsic scale, otherwise we might be
       // trying to show regions where there is no content to show.
       if (zoom < intrinsicScale) {
         newZoom = Some(intrinsicScale);
       }
     }
   }
 
-  // If the zoom has changed, update the pres shell resolution and the
-  // visual viewport size accordingly.
+  // If the zoom has changed, update the pres shell resolution accordingly.
   if (newZoom) {
     LayoutDeviceToLayerScale resolution = ZoomToResolution(*newZoom, cssToDev);
     MVM_LOG("%p: setting resolution %f\n", this, resolution.scale);
     mPresShell->SetResolutionAndScaleTo(resolution.scale);
 
     MVM_LOG("%p: New zoom is %f\n", this, newZoom->scale);
-    UpdateVisualViewportSize(aDisplaySize, *newZoom);
+  }
+
+  // The visual viewport size depends on both the zoom and the display size,
+  // and needs to be updated if either might have changed.
+  if (newZoom || aType == UpdateType::ViewportSize) {
+    UpdateVisualViewportSize(aDisplaySize, newZoom ? *newZoom : zoom);
   }
 }
 
 ScreenIntSize MobileViewportManager::GetCompositionSize(
     const ScreenIntSize& aDisplaySize) const {
   ScreenIntSize compositionSize(aDisplaySize);
   ScreenMargin scrollbars =
       LayoutDeviceMargin::FromAppUnits(