Bug 1193930 - Allow the user to start a pinch while an overscroll animation is still in progress. r=kats
authorBotond Ballo <botond@mozilla.com>
Fri, 14 Aug 2015 13:11:32 -0400
changeset 258042 78747fd20d8d6f3167af880084a4f9e77254857e
parent 258041 1b61da1529722e661ff5de3c10e58a919df00b66
child 258043 2d380f4a2f39f95f3b886a46b6b4a37099e8f3b2
push id29241
push userkwierso@gmail.com
push dateTue, 18 Aug 2015 00:00:46 +0000
treeherdermozilla-central@6ae3e9ff53b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1193930
milestone43.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 1193930 - Allow the user to start a pinch while an overscroll animation is still in progress. r=kats
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
gfx/layers/apz/src/OverscrollHandoffState.cpp
gfx/layers/apz/src/OverscrollHandoffState.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -711,21 +711,24 @@ APZCTreeManager::GetTouchInputBlockAPZC(
 }
 
 nsEventStatus
 APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
                                    ScrollableLayerGuid* aOutTargetGuid,
                                    uint64_t* aOutInputBlockId)
 {
   if (aInput.mType == MultiTouchInput::MULTITOUCH_START) {
-    // If we are in an overscrolled state and a second finger goes down,
+    // If we are panned into overscroll and a second finger goes down,
     // ignore that second touch point completely. The touch-start for it is
     // dropped completely; subsequent touch events until the touch-end for it
     // will have this touch point filtered out.
-    if (mApzcForInputBlock && BuildOverscrollHandoffChain(mApzcForInputBlock)->HasOverscrolledApzc()) {
+    // (By contrast, if we're in overscroll but not panning, such as after
+    // putting two fingers down during an overscroll animation, we process the
+    // second touch and proceed to pinch.)
+    if (mApzcForInputBlock && BuildOverscrollHandoffChain(mApzcForInputBlock)->HasApzcPannedIntoOverscroll()) {
       if (mRetainedTouchIdentifier == -1) {
         mRetainedTouchIdentifier = mApzcForInputBlock->GetLastTouchIdentifier();
       }
       return nsEventStatus_eConsumeNoDefault;
     }
 
     // NS_TOUCH_START event contains all active touches of the current
     // session thus resetting mTouchCount.
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -1037,16 +1037,20 @@ public:
   // Returns whether or not this apzc contains the given screen point within
   // its composition bounds.
   bool Contains(const ScreenIntPoint& aPoint) const;
 
   bool IsOverscrolled() const {
     return mX.IsOverscrolled() || mY.IsOverscrolled();
   }
 
+  bool IsPannedIntoOverscroll() const {
+    return IsOverscrolled() && IsInPanningState();
+  }
+
 private:
   /* This is the cumulative CSS transform for all the layers from (and including)
    * the parent APZC down to (but excluding) this one. */
   Matrix4x4 mAncestorTransform;
 
 
   /* ===================================================================
    * The functions and members in this section are used for sharing the
--- a/gfx/layers/apz/src/OverscrollHandoffState.cpp
+++ b/gfx/layers/apz/src/OverscrollHandoffState.cpp
@@ -157,19 +157,19 @@ OverscrollHandoffChain::CanScrollInDirec
       return true;
     }
   }
 
   return false;
 }
 
 bool
-OverscrollHandoffChain::HasOverscrolledApzc() const
+OverscrollHandoffChain::HasApzcPannedIntoOverscroll() const
 {
-  return AnyApzc(&AsyncPanZoomController::IsOverscrolled);
+  return AnyApzc(&AsyncPanZoomController::IsPannedIntoOverscroll);
 }
 
 bool
 OverscrollHandoffChain::HasFastFlungApzc() const
 {
   return AnyApzc(&AsyncPanZoomController::IsFlingingFast);
 }
 
--- a/gfx/layers/apz/src/OverscrollHandoffState.h
+++ b/gfx/layers/apz/src/OverscrollHandoffState.h
@@ -75,18 +75,18 @@ public:
   // has room to be panned.
   bool CanBePanned(const AsyncPanZoomController* aApzc) const;
 
   // Determine whether the given APZC, or any APZC further in the chain,
   // can scroll in the given direction.
   bool CanScrollInDirection(const AsyncPanZoomController* aApzc,
                             Layer::ScrollDirection aDirection) const;
 
-  // Determine whether any APZC along this handoff chain is overscrolled.
-  bool HasOverscrolledApzc() const;
+  // Determine whether any APZC along this handoff chain is panned into overscroll.
+  bool HasApzcPannedIntoOverscroll() const;
 
   // Determine whether any APZC along this handoff chain has been flung fast.
   bool HasFastFlungApzc() const;
 
   nsRefPtr<AsyncPanZoomController> FindFirstScrollable(const ScrollWheelInput& aInput) const;
 
 private:
   std::vector<nsRefPtr<AsyncPanZoomController>> mChain;