Index: ui/aura/window_event_dispatcher.cc |
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc |
index 3619dcc8c92c490b9c59555ae149741aea103794..d990082f6f808260703ef7e54c31a6fbec5d96e5 100644 |
--- a/ui/aura/window_event_dispatcher.cc |
+++ b/ui/aura/window_event_dispatcher.cc |
@@ -160,6 +160,14 @@ void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event, |
Window* window, |
ui::EventResult result) { |
ui::TouchEvent orig_event(*event, window, this->window()); |
+ |
+ // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager |
+ // gesture detection. See crbug.com/410280. |
+ if (!ui::GestureRecognizer::Get() |
+ ->ProcessTouchEventPreDispatch(orig_event, window)) { |
+ return; |
+ } |
+ |
// Once we've fully migrated to the eager gesture detector, we won't need to |
// pass an event here. |
scoped_ptr<ui::GestureRecognizer::Gestures> gestures( |
@@ -495,16 +503,26 @@ ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( |
// being dispatched. |
if (dispatching_held_event_ || !held_move_event_ || |
!held_move_event_->IsTouchEvent()) { |
- // If the event is being handled asynchronously, ignore it. |
- if(event.result() & ui::ER_CONSUMED) |
- return details; |
- scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
// 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.result() & ui::ER_CONSUMED) |
+ orig_event.StopPropagation(); |
+ |
+ // 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; |
+ } |
+ |
+ scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
+ |
gestures.reset( |
ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch( |
orig_event, event.result(), static_cast<Window*>(target))); |
@@ -888,19 +906,6 @@ void WindowEventDispatcher::PreDispatchTouchEvent(Window* target, |
break; |
} |
- if (dispatching_held_event_ || !held_move_event_ || |
- !held_move_event_->IsTouchEvent()) { |
- ui::TouchEvent orig_event(*event, target, window()); |
- |
- // If the touch event is invalid in some way, the gesture recognizer will |
- // reject it. This must call |StopPropagation()|, in order to prevent the |
- // touch from being acked in |PostDispatchEvent|. |
- if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event, |
- target)) { |
- event->StopPropagation(); |
- } |
- } |
- |
PreDispatchLocatedEvent(target, event); |
} |