Bug 1501665 Part 9: Early exit around an unnecessary call to UpdateVisualViewportSize. r=botond
☠☠ backed out by af46b1e88998 ☠ ☠
authorBrad Werth <bwerth@mozilla.com>
Mon, 18 Mar 2019 14:58:49 +0000
changeset 464816 3542bf2b89ddf170efe6c723a64f297868bc7db1
parent 464815 088dc24eabc75eea96301d50550e0a8817f5f809
child 464817 520dd24a73fc1a224c38c93ab91d36eecce727ed
push id80720
push userbwerth@mozilla.com
push dateMon, 18 Mar 2019 15:02:22 +0000
treeherderautoland@2fa518cb0dfc [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();