Bug 1611660 - Accept layout viewport updates from the main thread right away. r=tnikkel
☠☠ backed out by 3c7cdd9f7b80 ☠ ☠
authorBotond Ballo <botond@mozilla.com>
Thu, 30 Jan 2020 10:48:34 +0000
changeset 512136 9dc9deb3ba3bdfb7875b8259308d31ec46f4d6d1
parent 512135 b1105fc269d77c96f3bc3b4da81510d8c49b143a
child 512137 c7072bfa62d69ad0bf15e2d2d0b83a896f891f0a
push id106207
push userbballo@mozilla.com
push dateThu, 30 Jan 2020 10:54:34 +0000
treeherderautoland@9dc9deb3ba3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1611660
milestone74.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 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
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -4543,38 +4543,23 @@ void AsyncPanZoomController::NotifyLayer
 
   // TODO if we're in a drag and scrollOffsetUpdated is set then we want to
   // ignore it
 
   bool needContentRepaint = false;
   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)
   if (aLayerMetrics.IsRootContent()) {
     if (APZCTreeManager* manager = GetApzcTreeManager()) {
       if (AndroidDynamicToolbarAnimator* animator =
               manager->GetAndroidDynamicToolbarAnimator()) {
         animator->MaybeUpdateCompositionSizeAndRootFrameMetrics(aLayerMetrics);