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

Unified Diff: ui/aura/window_event_dispatcher.cc

Issue 680413006: Re-enable Eager Gesture Recognition on Aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jdduke's comment. Created 6 years, 1 month 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/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.
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)));
- // 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);
}

Powered by Google App Engine
This is Rietveld 408576698