Bug 1123598 - Ensure we recompute margins after the scroll offset is forcibly changed by layout. r=botond, a=bajaj
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 30 Jan 2015 11:41:27 -0500
changeset 221724 bdebcc47ec7a493b40d62fc2baf551037a4d46ea
parent 221723 7209703b3339bb7830888a5fd821fa9306fc4864
child 221725 535db8fdc91927c1e1917dd9d435a24265d60d4d
push id361
push userryanvm@gmail.com
push dateWed, 04 Feb 2015 02:10:00 +0000
treeherdermozilla-b2g34_v2_1@bdebcc47ec7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, bajaj
Bug 1123598 - Ensure we recompute margins after the scroll offset is forcibly changed by layout. r=botond, a=bajaj
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -2486,27 +2486,36 @@ void AsyncPanZoomController::NotifyLayer
     if (scrollOffsetUpdated) {
       APZC_LOG("%p updating scroll offset from %s to %s\n", this,
-      // Cancel the animation (which will also trigger a repaint request)
+      // Cancel the animation (which might also trigger a repaint request)
       // after we update the scroll offset above. Otherwise we can be left
       // in a state where things are out of sync.
       // 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;
+      // Since the scroll offset has changed, we need to recompute the
+      // displayport margins and send them to layout. Otherwise there might be
+      // scenarios where for example we scroll from the top of a page (where the
+      // top displayport margin is zero) to the bottom of a page, which will
+      // result in a displayport that doesn't extend upwards at all.
+      // Note that even if the CancelAnimation call above requested a repaint
+      // this is fine because we already have repaint request deduplication.
+      needContentRepaint = true;
   if (scrollOffsetUpdated) {
     // 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.