Bug 1290330 - Properly handle pan-x pan-y regions in the APZ hit test. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 29 Jul 2016 14:26:24 -0400
changeset 332422 6b695df8579dc41bb951111b56e75a92a9f4c8e9
parent 332421 e5db12322fd393fe7970e726cd1f4b64845f6d23
child 332423 41f642c6793d4bf2df1046d88be687daead65021
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1290330
milestone50.0a1
Bug 1290330 - Properly handle pan-x pan-y regions in the APZ hit test. r=botond MozReview-Commit-ID: BqXVOsVeLEe
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