Chromium Code Reviews| Index: ui/aura/window_event_dispatcher.cc |
| diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc |
| index eadda03f6794645960382900eb4dcc4970ebb0a6..10afe1bea0c7963549d35ba45f3afd22400a13ac 100644 |
| --- a/ui/aura/window_event_dispatcher.cc |
| +++ b/ui/aura/window_event_dispatcher.cc |
| @@ -159,17 +159,10 @@ DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint( |
| void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event, |
| Window* window, |
| ui::EventResult result) { |
| - // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager |
| - // gesture detection. See crbug.com/410280. |
| - if (!ui::GestureRecognizer::Get() |
| - ->ProcessTouchEventPreDispatch(*event, window)) { |
| - return; |
| - } |
| - |
| // Once we've fully migrated to the eager gesture detector, we won't need to |
| // pass an event here. |
|
sadrul
2014/12/03 21:30:10
Is this comment still correct?
tdresser
2014/12/05 16:44:31
I'm performing that cleanup in a followup patch: h
|
| scoped_ptr<ui::GestureRecognizer::Gestures> gestures( |
| - ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck( |
| + ui::GestureRecognizer::Get()->AckAsyncTouchEvent( |
| *event, result, window)); |
| DispatchDetails details = ProcessGestures(gestures.get()); |
| if (details.dispatcher_destroyed) |
| @@ -499,30 +492,18 @@ ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( |
| if (dispatching_held_event_ || !held_move_event_ || |
| !held_move_event_->IsTouchEvent()) { |
| - // Once we've fully migrated to the eager 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()); |
| + if (!event.synchronous_handling_disabled()) { |
| + scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
| - if (event.result() & ui::ER_CONSUMED) |
| - orig_event.StopPropagation(); |
| + // Once we've fully migrated to the eager gesture detector, we won't |
| + // need to pass an event here. |
| + gestures.reset( |
| + ui::GestureRecognizer::Get()->AckSyncTouchEvent( |
| + static_cast<const ui::TouchEvent&>(event), event.result(), |
| + static_cast<Window*>(target))); |
|
sadrul
2014/12/03 21:30:10
This touch-event is being sent in the target's coo
tdresser
2014/12/05 16:44:31
It isn't problematic because we're only using the
|
| - // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager |
| - // gesture detection. See crbug.com/410280. |
| - if (!ui::GestureRecognizer::Get() |
| - ->ProcessTouchEventPreDispatch(orig_event, |
| - static_cast<Window*>(target))) { |
| - return details; |
| + return ProcessGestures(gestures.get()); |
| } |
| - |
| - scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
| - |
| - gestures.reset( |
| - ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch( |
| - orig_event, event.result(), static_cast<Window*>(target))); |
| - |
| - return ProcessGestures(gestures.get()); |
| } |
| } |
| @@ -901,6 +882,15 @@ void WindowEventDispatcher::PreDispatchTouchEvent(Window* target, |
| break; |
| } |
| + ui::TouchEvent orig_event(*event, target, window()); |
| + if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event, |
| + target)) { |
| + // The event is invalid - ignore it. |
| + event->StopPropagation(); |
| + event->DisableSynchronousHandling(); |
| + return; |
| + } |
| + |
| PreDispatchLocatedEvent(target, event); |
| } |