Index: ui/aura/window_event_dispatcher.cc |
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc |
index 2e42a9559614609352bad7f2b3e80ff9ba60bdd0..821b95bf394ef25a107befcf904b687a35edcd4c 100644 |
--- a/ui/aura/window_event_dispatcher.cc |
+++ b/ui/aura/window_event_dispatcher.cc |
@@ -24,6 +24,7 @@ |
#include "ui/events/event.h" |
#include "ui/events/gestures/gesture_recognizer.h" |
#include "ui/events/gestures/gesture_types.h" |
+#include "ui/events/gestures/unified_gesture_detector_enabled.h" |
jdduke (slow)
2014/08/01 14:27:22
Looks like we don't need this include anymore?
tdresser
2014/08/01 18:54:00
Done.
|
typedef ui::EventDispatchDetails DispatchDetails; |
@@ -160,9 +161,14 @@ DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint( |
void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event, |
Window* window, |
ui::EventResult result) { |
- scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
- gestures.reset(ui::GestureRecognizer::Get()-> |
- ProcessTouchEventForGesture(*event, result, window)); |
+ ui::TouchEvent orig_event(*static_cast<const ui::TouchEvent*>(event), |
+ static_cast<Window*>(window), |
+ this->window()); |
+ // Once we've fully migrated to the unified gesture detector, we won't need to |
+ // pass an event here. |
+ scoped_ptr<ui::GestureRecognizer::Gestures> gestures( |
+ ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck( |
+ orig_event, result, window)); |
DispatchDetails details = ProcessGestures(gestures.get()); |
if (details.dispatcher_destroyed) |
return; |
@@ -485,13 +491,20 @@ ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( |
// being dispatched. |
if (dispatching_held_event_ || !held_move_event_ || |
!held_move_event_->IsTouchEvent()) { |
- ui::TouchEvent orig_event(static_cast<const ui::TouchEvent&>(event), |
- static_cast<Window*>(event.target()), window()); |
- // Get the list of GestureEvents from GestureRecognizer. |
+ // If the event is being handled asynchronously, ignore it. |
+ if(event.result() & ui::ER_CONSUMED) |
+ return details; |
scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
- gestures.reset(ui::GestureRecognizer::Get()-> |
- ProcessTouchEventForGesture(orig_event, event.result(), |
- static_cast<Window*>(target))); |
+ |
+ // Once we've fully migrated to the unified gesture detector, we won't |
+ // need to pass an event here. |
+ ui::TouchEvent orig_event(static_cast<const ui::TouchEvent&>(event), |
+ static_cast<Window*>(event.target()), |
+ window()); |
+ gestures.reset( |
+ ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch( |
+ orig_event, event.result(), static_cast<Window*>(target))); |
+ |
return ProcessGestures(gestures.get()); |
} |
} |
@@ -866,6 +879,21 @@ void WindowEventDispatcher::PreDispatchTouchEvent(Window* target, |
NOTREACHED(); |
break; |
} |
+ |
+ if (dispatching_held_event_ || !held_move_event_ || |
+ !held_move_event_->IsTouchEvent()) { |
+ ui::TouchEvent orig_event( |
+ static_cast<const ui::TouchEvent&>(*event), target, window()); |
+ |
+ // If the touch event is invalid in some way, the gesture recognizer will |
+ // reject it. In this case, stop the touch from reaching the next event |
+ // phase. |
+ if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event, |
+ target)) { |
+ event->SetHandled(); |
+ } |
+ } |
+ |
PreDispatchLocatedEvent(target, event); |
} |