Bug 1290330 - Properly handle pan-x pan-y regions in the APZ hit test. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 28 Jul 2016 21:52:29 -0400
changeset 394068 ce5bb2b524f8e88705c2f6c7b9f2abf0654b4dc6
parent 393484 db3ed1fdbbeaf5ab1e8fe454780146e7499be3db
child 526727 996b1ee75faa81a92c8dd3e16f23c6e3be5594f4
push id24480
push userkgupta@mozilla.com
push dateFri, 29 Jul 2016 01:52:56 +0000
reviewersbotond
bugs1290330
milestone50.0a1
Bug 1290330 - Properly handle pan-x pan-y regions in the APZ hit test. r?botond MozReview-Commit-ID: IQvc67QRd5Y
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/APZUtils.h
gfx/layers/apz/src/HitTestingTreeNode.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -885,16 +885,19 @@ ConvertToTouchBehavior(HitTestResult res
            | AllowedTouchBehavior::PINCH_ZOOM
            | AllowedTouchBehavior::DOUBLE_TAP_ZOOM;
     case HitLayerTouchActionNone:
       return AllowedTouchBehavior::NONE;
     case HitLayerTouchActionPanX:
       return AllowedTouchBehavior::HORIZONTAL_PAN;
     case HitLayerTouchActionPanY:
       return AllowedTouchBehavior::VERTICAL_PAN;
+    case HitLayerTouchActionPanXY:
+      return AllowedTouchBehavior::HORIZONTAL_PAN
+           | AllowedTouchBehavior::VERTICAL_PAN;
     case HitDispatchToContentRegion:
     default:
       return AllowedTouchBehavior::UNKNOWN;
   }
 }
 
 already_AddRefed<AsyncPanZoomController>
 APZCTreeManager::GetTouchInputBlockAPZC(const MultiTouchInput& aEvent,
--- a/gfx/layers/apz/src/APZUtils.h
+++ b/gfx/layers/apz/src/APZUtils.h
@@ -17,16 +17,17 @@ namespace mozilla {
 namespace layers {
 
 enum HitTestResult {
   HitNothing,
   HitLayer,
   HitLayerTouchActionNone,
   HitLayerTouchActionPanX,
   HitLayerTouchActionPanY,
+  HitLayerTouchActionPanXY,
   HitDispatchToContentRegion,
 };
 
 enum CancelAnimationFlags : uint32_t {
   Default = 0x0,            /* Cancel all animations */
   ExcludeOverscroll = 0x1,  /* Don't clear overscroll */
   ScrollSnap = 0x2          /* Snap to snap points */
 };
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp
+++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp
@@ -277,20 +277,23 @@ HitTestingTreeNode::HitTest(const Parent
       mEventRegions.mDispatchToContentHitRegion.Contains(point.x, point.y))
   {
     return HitTestResult::HitDispatchToContentRegion;
   }
   if (gfxPrefs::TouchActionEnabled()) {
     if (mEventRegions.mNoActionRegion.Contains(point.x, point.y)) {
       return HitTestResult::HitLayerTouchActionNone;
     }
-    if (mEventRegions.mHorizontalPanRegion.Contains(point.x, point.y)) {
+    bool panX = mEventRegions.mHorizontalPanRegion.Contains(point.x, point.y);
+    bool panY = mEventRegions.mVerticalPanRegion.Contains(point.x, point.y);
+    if (panX && panY) {
+      return HitTestResult::HitLayerTouchActionPanXY;
+    } else if (panX) {
       return HitTestResult::HitLayerTouchActionPanX;
-    }
-    if (mEventRegions.mVerticalPanRegion.Contains(point.x, point.y)) {
+    } else if (panY) {
       return HitTestResult::HitLayerTouchActionPanY;
     }
   }
   return HitTestResult::HitLayer;
 }
 
 EventRegionsOverride
 HitTestingTreeNode::GetEventRegionsOverride() const