From f62b4f716bf279e0136ac6c1090d42086c79cb6e Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Thu, 30 Jan 2020 10:48:34 +0000 Subject: [PATCH] Bug 1611660 - Accept layout viewport updates from the main thread right away. r=tnikkel Previously, we would wait until the following frame (for uncertain reasons that date back to B2G), but this meant the layout and visual viewports would be out of sync for a frame, causing APZ to misbehave. Differential Revision: https://phabricator.services.mozilla.com/D61286 --HG-- extra : moz-landing-system : lando --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 4a833e95f812..966bcd229543 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -4548,28 +4548,13 @@ void AsyncPanZoomController::NotifyLayersUpdated( RepaintUpdateType contentRepaintType = RepaintUpdateType::eNone; bool viewportUpdated = false; - // We usually don't entertain viewport updates on the same transaction as - // a composition bounds update, but we make an exception for Android - // to avoid the composition bounds and the viewport diverging during - // orientation changes and dynamic toolbar transitions. - // TODO: Do this on all platforms. - bool entertainViewportUpdates = - FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Width(), - Metrics().GetCompositionBounds().Width()) && - FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Height(), - Metrics().GetCompositionBounds().Height()); -#if defined(MOZ_WIDGET_ANDROID) - entertainViewportUpdates = true; -#endif - if (entertainViewportUpdates) { - if (Metrics().GetLayoutViewport().Size() != - aLayerMetrics.GetLayoutViewport().Size()) { - needContentRepaint = true; - viewportUpdated = true; - } - if (viewportUpdated || scrollOffsetUpdated) { - Metrics().SetLayoutViewport(aLayerMetrics.GetLayoutViewport()); - } + if (Metrics().GetLayoutViewport().Size() != + aLayerMetrics.GetLayoutViewport().Size()) { + needContentRepaint = true; + viewportUpdated = true; + } + if (viewportUpdated || scrollOffsetUpdated) { + Metrics().SetLayoutViewport(aLayerMetrics.GetLayoutViewport()); } #if defined(MOZ_WIDGET_ANDROID)