Bug 967671 - Insure apzc always acknowledges scroll offset updates. r=botond
authorKartikaya Gupta <kats@mozilla.com>
Sat, 15 Feb 2014 07:06:27 -0600
changeset 169284 af48e36fd5a30299de9b8615f90e421ddafae17b
parent 169283 fbcd1f3a17031475eaebe315defe0794bb1c4d39
child 169285 072725b2ef45e968e80cd33b2576c13f95733ccf
child 169295 9394396013a8ffa427a994bf9f5e60214144b59e
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbotond
bugs967671
milestone30.0a1
Bug 967671 - Insure apzc always acknowledges scroll offset updates. r=botond
gfx/layers/ipc/AsyncPanZoomController.cpp
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1705,31 +1705,34 @@ void AsyncPanZoomController::NotifyLayer
     // we want to take the new scroll offset.
     if (aLayerMetrics.GetScrollOffsetUpdated()) {
       APZC_LOG("%p updating scroll offset from (%f, %f) to (%f, %f)\n", this,
         mFrameMetrics.mScrollOffset.x, mFrameMetrics.mScrollOffset.y,
         aLayerMetrics.mScrollOffset.x, aLayerMetrics.mScrollOffset.y);
 
       mFrameMetrics.mScrollOffset = aLayerMetrics.mScrollOffset;
 
-      // Once layout issues a scroll offset update, it becomes impervious to
-      // scroll offset updates from APZ until we acknowledge the update it sent.
-      // This prevents APZ updates from clobbering scroll updates from other
-      // more "legitimate" sources like content scripts.
-      // Furthermore, any inflight paint requests we have already dispatched are
+      // Because of the scroll offset update, any inflight paint requests are
       // going to be ignored by layout, and so mLastDispatchedPaintMetrics
       // becomes incorrect for the purposes of calculating the LD transform. To
       // correct this we need to update mLastDispatchedPaintMetrics to be the
       // last thing we know was painted by Gecko.
       mLastDispatchedPaintMetrics = aLayerMetrics;
-      nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
-      if (controller) {
-        controller->AcknowledgeScrollUpdate(aLayerMetrics.mScrollId,
-                                            aLayerMetrics.GetScrollGeneration());
-      }
+    }
+  }
+
+  if (aLayerMetrics.GetScrollOffsetUpdated()) {
+    // Once layout issues a scroll offset update, it becomes impervious to
+    // scroll offset updates from APZ until we acknowledge the update it sent.
+    // This prevents APZ updates from clobbering scroll updates from other
+    // more "legitimate" sources like content scripts.
+    nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
+    if (controller) {
+      controller->AcknowledgeScrollUpdate(aLayerMetrics.mScrollId,
+                                          aLayerMetrics.GetScrollGeneration());
     }
   }
 
   if (needContentRepaint) {
     RequestContentRepaint();
   }
   UpdateSharedCompositorFrameMetrics();
 }