Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 393953012: Eager Gesture Recognition on Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 06a1497cacfcfd3aa5e515303ce95f73c6a986f7..637e03cf5575ae554fad059a1bac06cb04309a1c 100644
--- a/ui/events/gesture_detection/gesture_provider.cc
+++ b/ui/events/gesture_detection/gesture_provider.cc
@@ -639,7 +639,11 @@ void GestureProvider::InitGestureDetectors(const Config& config) {
}
bool GestureProvider::CanHandle(const MotionEvent& event) const {
- return event.GetAction() == MotionEvent::ACTION_DOWN || current_down_event_;
+ // Aura requires one cancel event per touch point, whereas Android requires
+ // one cancel event per touch sequence. Thus we need to allow extra cancel
+ // events.
+ return event.GetAction() == MotionEvent::ACTION_DOWN || current_down_event_ ||
+ event.GetAction() == MotionEvent::ACTION_CANCEL;
}
void GestureProvider::Fling(const MotionEvent& event,
@@ -672,7 +676,8 @@ void GestureProvider::Send(GestureEventData gesture) {
// are SHOW_PRESS and TAP, potentially triggered by the double-tap
// delay timing out.
DCHECK(current_down_event_ || gesture.type() == ET_GESTURE_TAP ||
- gesture.type() == ET_GESTURE_SHOW_PRESS);
+ gesture.type() == ET_GESTURE_SHOW_PRESS ||
+ gesture.type() == ET_GESTURE_END);
// TODO(jdduke): Provide a way of skipping this clamping for stylus and/or
// mouse-based input, perhaps by exposing the source type on MotionEvent.
@@ -785,17 +790,15 @@ void GestureProvider::OnTouchEventHandlingEnd(const MotionEvent& event) {
const gfx::RectF bounding_box = GetBoundingBox(event);
if (gesture_begin_end_types_enabled_) {
- for (size_t i = 0; i < event.GetPointerCount(); ++i) {
- Send(CreateGesture(ET_GESTURE_END,
- event.GetId(),
- event.GetEventTime(),
- event.GetX(i),
- event.GetY(i),
- event.GetRawX(i),
- event.GetRawY(i),
- event.GetPointerCount() - i,
- bounding_box));
- }
+ Send(CreateGesture(ET_GESTURE_END,
jdduke (slow) 2014/07/30 15:29:32 Can this just be |CreateGesture(ET_GESTURE_END, ev
tdresser 2014/07/31 15:33:31 Thanks. Done.
+ event.GetId(),
+ event.GetEventTime(),
+ event.GetX(),
+ event.GetY(),
+ event.GetRawX(),
+ event.GetRawY(),
+ event.GetPointerCount(),
+ bounding_box));
}
current_down_event_.reset();

Powered by Google App Engine
This is Rietveld 408576698