Index: ui/events/gesture_detection/gesture_provider.cc |
diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc |
index 7607f08d8765a7fbc02a96f7eb471af5f813efcb..0a67e4d3b467182f3b4867793deb02d248b28053 100644 |
--- a/ui/events/gesture_detection/gesture_provider.cc |
+++ b/ui/events/gesture_detection/gesture_provider.cc |
@@ -101,11 +101,12 @@ GestureEventData CreateGesture(EventType type, |
} |
GestureEventDetails CreateTapGestureDetails(EventType type, |
- const MotionEvent& event) { |
- // Set the tap count to 1 even for ET_GESTURE_DOUBLE_TAP, in order to be |
- // consistent with double tap behavior on a mobile viewport. See |
- // crbug.com/234986 for context. |
- GestureEventDetails tap_details(type, 1, 0); |
+ const MotionEvent& event, |
+ int tap_count) { |
+ DCHECK(type != ET_GESTURE_DOUBLE_TAP || tap_count == 1); |
+ DCHECK_GT(tap_count, 0); |
+ DCHECK_LE(tap_count, 3); |
+ GestureEventDetails tap_details(type, tap_count, 0); |
return tap_details; |
} |
@@ -406,7 +407,7 @@ class GestureProvider::GestureListenerImpl |
CreateGesture(ET_GESTURE_SHOW_PRESS, e, show_press_details)); |
} |
- virtual bool OnSingleTapUp(const MotionEvent& e) OVERRIDE { |
+ virtual bool OnSingleTapUp(const MotionEvent& e, int tap_count) OVERRIDE { |
// This is a hack to address the issue where user hovers |
// over a link for longer than double_tap_timeout_, then |
// OnSingleTapConfirmed() is not triggered. But we still |
@@ -415,18 +416,18 @@ class GestureProvider::GestureListenerImpl |
// gets always called before singleTapConfirmed. |
if (!ignore_single_tap_) { |
if (e.GetEventTime() - current_down_time_ > double_tap_timeout_) { |
- return OnSingleTapConfirmed(e); |
+ return OnSingleTapConfirmed(e, tap_count); |
} else if (!IsDoubleTapEnabled() || disable_click_delay_) { |
// If double-tap has been disabled, there is no need to wait |
// for the double-tap timeout. |
- return OnSingleTapConfirmed(e); |
+ return OnSingleTapConfirmed(e, tap_count); |
} else { |
// Notify Blink about this tapUp event anyway, when none of the above |
// conditions applied. |
provider_->Send(CreateGesture( |
ET_GESTURE_TAP_UNCONFIRMED, |
e, |
- CreateTapGestureDetails(ET_GESTURE_TAP_UNCONFIRMED, e))); |
+ CreateTapGestureDetails(ET_GESTURE_TAP_UNCONFIRMED, e, tap_count))); |
} |
} |
@@ -434,7 +435,8 @@ class GestureProvider::GestureListenerImpl |
} |
// GestureDetector::DoubleTapListener implementation. |
- virtual bool OnSingleTapConfirmed(const MotionEvent& e) OVERRIDE { |
+ virtual bool OnSingleTapConfirmed(const MotionEvent& e, |
+ int tap_count) OVERRIDE { |
// Long taps in the edges of the screen have their events delayed by |
// ContentViewHolder for tab swipe operations. As a consequence of the delay |
// this method might be called after receiving the up event. |
@@ -444,8 +446,10 @@ class GestureProvider::GestureListenerImpl |
ignore_single_tap_ = true; |
- provider_->Send(CreateGesture( |
- ET_GESTURE_TAP, e, CreateTapGestureDetails(ET_GESTURE_TAP, e))); |
+ provider_->Send( |
+ CreateGesture(ET_GESTURE_TAP, |
+ e, |
+ CreateTapGestureDetails(ET_GESTURE_TAP, e, tap_count))); |
return true; |
} |
@@ -460,10 +464,13 @@ class GestureProvider::GestureListenerImpl |
case MotionEvent::ACTION_UP: |
if (!provider_->IsPinchInProgress() && |
!provider_->IsScrollInProgress()) { |
- provider_->Send( |
- CreateGesture(ET_GESTURE_DOUBLE_TAP, |
- e, |
- CreateTapGestureDetails(ET_GESTURE_DOUBLE_TAP, e))); |
+ // Tap count is set to 1 for ET_GESTURE_DOUBLE_TAP, in order to be |
+ // consistent with double tap behavior on a mobile viewport. See |
+ // crbug.com/234986 for context. |
+ provider_->Send(CreateGesture( |
+ ET_GESTURE_DOUBLE_TAP, |
+ e, |
+ CreateTapGestureDetails(ET_GESTURE_DOUBLE_TAP, e, 1))); |
return true; |
} |
break; |