Bug 1501665 Part 9: Early exit around an unnecessary call to UpdateVisualViewportSize. r=botond
authorBrad Werth <bwerth@mozilla.com>
Mon, 18 Mar 2019 14:58:49 +0000
changeset 464844 22aac830b13a8ff5f57f8d7c1db94d9caeb26a03
parent 464843 c8bf0f59a60c8396cbf8c07764fcb82e9f13a67d
child 464845 8824d55c1b62ca892bf153a66213ada838c65df9
push id35727
push userdvarga@mozilla.com
push dateTue, 19 Mar 2019 09:48:59 +0000
treeherdermozilla-central@70baa37ae1eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1501665
milestone68.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 1501665 Part 9: Early exit around an unnecessary call to UpdateVisualViewportSize. r=botond Differential Revision: https://phabricator.services.mozilla.com/D21287
layout/base/MobileViewportManager.cpp
--- a/layout/base/MobileViewportManager.cpp
+++ b/layout/base/MobileViewportManager.cpp
@@ -339,28 +339,31 @@ void MobileViewportManager::UpdateResolu
       // 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 accordingly.
+  // This will also call UpdateVisualViewportSize, which means we can early
+  // exit afterwards.
   if (newZoom) {
     LayoutDeviceToLayerScale resolution = ZoomToResolution(*newZoom, cssToDev);
     MVM_LOG("%p: setting resolution %f\n", this, resolution.scale);
     mPresShell->SetResolutionAndScaleTo(
         resolution.scale, nsIPresShell::ChangeOrigin::eMainThread);
 
     MVM_LOG("%p: New zoom is %f\n", this, newZoom->scale);
+    return;
   }
 
-  // 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) {
+  // The visual viewport size also depends on the display size, and needs
+  // to be updated if if we didn't already update due to a zoom change.
+  if (aType == UpdateType::ViewportSize) {
     UpdateVisualViewportSize(aDisplaySize, newZoom ? *newZoom : zoom);
   }
 }
 
 ScreenIntSize MobileViewportManager::GetCompositionSize(
     const ScreenIntSize& aDisplaySize) const {
   if (!mPresShell) {
     return ScreenIntSize();