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

Unified Diff: ui/aura/window_event_dispatcher.cc

Issue 551373006: Re-enable Eager Gesture Recognition on Aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jdduke's comments. Created 6 years, 2 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/aura/window_event_dispatcher.cc
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc
index 0b1103d016880e8015092b7a734b0a5145a34acc..8980b5f330e2283a7f0ef154f91004a2a66626d8 100644
--- a/ui/aura/window_event_dispatcher.cc
+++ b/ui/aura/window_event_dispatcher.cc
@@ -159,18 +159,11 @@ 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/10/23 15:56:34 Is this comment still correct?
tdresser 2014/10/27 15:52:31 Yes, this is still correct. This patch only migrat
scoped_ptr<ui::GestureRecognizer::Gestures> gestures(
- ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck(
- *event, result, window));
+ ui::GestureRecognizer::Get()
+ ->ProcessTouchEventAck(*event, result, window));
DispatchDetails details = ProcessGestures(gestures.get());
if (details.dispatcher_destroyed)
return;
@@ -497,6 +490,10 @@ 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)
sadrul 2014/10/23 15:56:34 space after 'if'. I remember we discussed using s
tdresser 2014/10/27 15:52:32 (Added space after 'if') We concluded that it was
+ 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.
@@ -504,30 +501,31 @@ ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent(
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;
+ if (ui::GestureRecognizer::Get()->ProcessTouchEvent(
+ orig_event, static_cast<Window*>(target))) {
sadrul 2014/10/23 15:56:34 As the TODO you are removing mentions, shouldn't t
tdresser 2014/10/27 15:52:31 I previously thought that was the correct path for
sadrul 2014/10/29 19:35:00 I thought one of the major points of eager GR was
+ gestures.reset(ui::GestureRecognizer::Get()->ProcessTouchEventAck(
+ orig_event, event.result(), static_cast<Window*>(target)));
+ 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());
}
}
return details;
}
+bool WindowEventDispatcher::OnForwardingAsyncTouchEvent(ui::TouchEvent* event) {
+ ui::TouchEvent orig_event(
+ *event, static_cast<aura::Window*>(event->target()), window());
+
+ bool should_forward = ui::GestureRecognizer::Get()->ProcessTouchEvent(
+ orig_event, static_cast<aura::Window*>(event->target()));
+
+ // Make sure that |PostDispatch| doesn't give |event| to the GestureRecognizer
+ // again.
+ event->StopPropagation();
+ return should_forward;
+}
+
////////////////////////////////////////////////////////////////////////////////
// WindowEventDispatcher, ui::GestureEventHelper implementation:

Powered by Google App Engine
This is Rietveld 408576698