Bug 1027309 - Ensure we build the overscroll handoff chain based on the APZC receiving input. r=drs, a=2.0+
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 25 Jun 2014 19:13:53 -0400
changeset 207371 ad16ee0c251bd99869e808c5d97d0d9e6f99edff
parent 207370 a10d2edbefe8bb909d87bd262b1a699ddb9d112f
child 207372 58bb80d1fe9d8bfa167dc387abcdeb3de939b5b8
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrs, 2
bugs1027309
milestone32.0a2
Bug 1027309 - Ensure we build the overscroll handoff chain based on the APZC receiving input. r=drs, a=2.0+
gfx/layers/apz/src/APZCTreeManager.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -391,32 +391,30 @@ APZCTreeManager::ReceiveInputEvent(const
           return nsEventStatus_eConsumeNoDefault;
         }
         // MULTITOUCH_START input contains all active touches of the current
         // session thus resetting mTouchCount.
         mTouchCount = multiTouchInput.mTouches.Length();
         mInOverscrolledApzc = false;
         mApzcForInputBlock = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[0].mScreenPoint),
                                            &mInOverscrolledApzc);
-        if (multiTouchInput.mTouches.Length() == 1) {
-          // If we have one touch point, this might be the start of a pan.
-          // Prepare for possible overscroll handoff.
-          BuildOverscrollHandoffChain(mApzcForInputBlock);
-        }
         for (size_t i = 1; i < multiTouchInput.mTouches.Length(); i++) {
           nsRefPtr<AsyncPanZoomController> apzc2 = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[i].mScreenPoint),
                                                                  &mInOverscrolledApzc);
           mApzcForInputBlock = CommonAncestor(mApzcForInputBlock.get(), apzc2.get());
           APZCTM_LOG("Using APZC %p as the common ancestor\n", mApzcForInputBlock.get());
           // For now, we only ever want to do pinching on the root APZC for a given layers id. So
           // when we find the common ancestor of multiple points, also walk up to the root APZC.
           mApzcForInputBlock = RootAPZCForLayersId(mApzcForInputBlock);
           APZCTM_LOG("Using APZC %p as the root APZC for multi-touch\n", mApzcForInputBlock.get());
         }
 
+        // Prepare for possible overscroll handoff.
+        BuildOverscrollHandoffChain(mApzcForInputBlock);
+
         if (mApzcForInputBlock) {
           // Cache transformToApzc so it can be used for future events in this block.
           GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToGecko);
           mCachedTransformToApzcForInputBlock = transformToApzc;
         } else {
           // Reset the cached apz transform
           mCachedTransformToApzcForInputBlock = gfx3DMatrix();
         }
@@ -547,31 +545,28 @@ APZCTreeManager::ReceiveInputEvent(const
 
 already_AddRefed<AsyncPanZoomController>
 APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent,
                                         bool* aOutInOverscrolledApzc)
 {
   ScreenPoint point = ScreenPoint(aEvent.touches[0]->mRefPoint.x, aEvent.touches[0]->mRefPoint.y);
   // Ignore events if any touch hits inside an overscrolled apzc.
   nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(point, aOutInOverscrolledApzc);
-  if (aEvent.touches.Length() == 1) {
-    // If we have one touch point, this might be the start of a pan.
-    // Prepare for possible overscroll handoff.
-    BuildOverscrollHandoffChain(apzc);
-  }
   for (size_t i = 1; i < aEvent.touches.Length(); i++) {
     point = ScreenPoint(aEvent.touches[i]->mRefPoint.x, aEvent.touches[i]->mRefPoint.y);
     nsRefPtr<AsyncPanZoomController> apzc2 = GetTargetAPZC(point, aOutInOverscrolledApzc);
     apzc = CommonAncestor(apzc.get(), apzc2.get());
     APZCTM_LOG("Using APZC %p as the common ancestor\n", apzc.get());
     // For now, we only ever want to do pinching on the root APZC for a given layers id. So
     // when we find the common ancestor of multiple points, also walk up to the root APZC.
     apzc = RootAPZCForLayersId(apzc);
     APZCTM_LOG("Using APZC %p as the root APZC for multi-touch\n", apzc.get());
   }
+  // Prepare for possible overscroll handoff.
+  BuildOverscrollHandoffChain(apzc);
   return apzc.forget();
 }
 
 nsEventStatus
 APZCTreeManager::ProcessTouchEvent(WidgetTouchEvent& aEvent,
                                    ScrollableLayerGuid* aOutTargetGuid)
 {
   MOZ_ASSERT(NS_IsMainThread());