From cad1533d0201dc9e42c7933cfa5f545fb172336f Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Sat, 1 Dec 2018 05:34:57 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- layout/base/MobileViewportManager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp index b5944650aacf..54a9db1cc19f 100644 --- a/layout/base/MobileViewportManager.cpp +++ b/layout/base/MobileViewportManager.cpp @@ -329,15 +329,19 @@ void MobileViewportManager::UpdateResolution( } } - // 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); } }