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

Side by Side 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: Add DCHECK. Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint( 152 DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint(
153 const gfx::Point& point) { 153 const gfx::Point& point) {
154 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE, 154 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE,
155 ui::EF_NONE); 155 ui::EF_NONE);
156 return DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); 156 return DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED);
157 } 157 }
158 158
159 void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event, 159 void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event,
160 Window* window, 160 Window* window,
161 ui::EventResult result) { 161 ui::EventResult result) {
162 // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager
163 // gesture detection. See crbug.com/410280.
164 if (!ui::GestureRecognizer::Get()
165 ->ProcessTouchEventPreDispatch(*event, window)) {
166 return;
167 }
168
169 // Once we've fully migrated to the eager gesture detector, we won't need to 162 // Once we've fully migrated to the eager gesture detector, we won't need to
170 // pass an event here. 163 // 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
171 scoped_ptr<ui::GestureRecognizer::Gestures> gestures( 164 scoped_ptr<ui::GestureRecognizer::Gestures> gestures(
172 ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck( 165 ui::GestureRecognizer::Get()->AckAsyncTouchEvent(
173 *event, result, window)); 166 *event, result, window));
174 DispatchDetails details = ProcessGestures(gestures.get()); 167 DispatchDetails details = ProcessGestures(gestures.get());
175 if (details.dispatcher_destroyed) 168 if (details.dispatcher_destroyed)
176 return; 169 return;
177 } 170 }
178 171
179 void WindowEventDispatcher::HoldPointerMoves() { 172 void WindowEventDispatcher::HoldPointerMoves() {
180 if (!move_hold_count_) 173 if (!move_hold_count_)
181 held_event_factory_.InvalidateWeakPtrs(); 174 held_event_factory_.InvalidateWeakPtrs();
182 ++move_hold_count_; 175 ++move_hold_count_;
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 #ifndef NDEBUG 485 #ifndef NDEBUG
493 DCHECK(!event_dispatch_target_ || window()->Contains(event_dispatch_target_)); 486 DCHECK(!event_dispatch_target_ || window()->Contains(event_dispatch_target_));
494 #endif 487 #endif
495 488
496 if (event.IsTouchEvent() && !details.target_destroyed) { 489 if (event.IsTouchEvent() && !details.target_destroyed) {
497 // Do not let 'held' touch events contribute to any gestures unless it is 490 // Do not let 'held' touch events contribute to any gestures unless it is
498 // being dispatched. 491 // being dispatched.
499 if (dispatching_held_event_ || !held_move_event_ || 492 if (dispatching_held_event_ || !held_move_event_ ||
500 !held_move_event_->IsTouchEvent()) { 493 !held_move_event_->IsTouchEvent()) {
501 494
502 // Once we've fully migrated to the eager gesture detector, we won't 495 if (!event.synchronous_handling_disabled()) {
503 // need to pass an event here. 496 scoped_ptr<ui::GestureRecognizer::Gestures> gestures;
504 ui::TouchEvent orig_event(static_cast<const ui::TouchEvent&>(event),
505 static_cast<Window*>(event.target()),
506 window());
507 497
508 if (event.result() & ui::ER_CONSUMED) 498 // Once we've fully migrated to the eager gesture detector, we won't
509 orig_event.StopPropagation(); 499 // need to pass an event here.
500 gestures.reset(
501 ui::GestureRecognizer::Get()->AckSyncTouchEvent(
502 static_cast<const ui::TouchEvent&>(event), event.result(),
503 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
510 504
511 // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager 505 return ProcessGestures(gestures.get());
512 // gesture detection. See crbug.com/410280.
513 if (!ui::GestureRecognizer::Get()
514 ->ProcessTouchEventPreDispatch(orig_event,
515 static_cast<Window*>(target))) {
516 return details;
517 } 506 }
518
519 scoped_ptr<ui::GestureRecognizer::Gestures> gestures;
520
521 gestures.reset(
522 ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch(
523 orig_event, event.result(), static_cast<Window*>(target)));
524
525 return ProcessGestures(gestures.get());
526 } 507 }
527 } 508 }
528 509
529 return details; 510 return details;
530 } 511 }
531 512
532 //////////////////////////////////////////////////////////////////////////////// 513 ////////////////////////////////////////////////////////////////////////////////
533 // WindowEventDispatcher, ui::GestureEventHelper implementation: 514 // WindowEventDispatcher, ui::GestureEventHelper implementation:
534 515
535 bool WindowEventDispatcher::CanDispatchToConsumer( 516 bool WindowEventDispatcher::CanDispatchToConsumer(
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 event->SetHandled(); 875 event->SetHandled();
895 return; 876 return;
896 } 877 }
897 break; 878 break;
898 879
899 default: 880 default:
900 NOTREACHED(); 881 NOTREACHED();
901 break; 882 break;
902 } 883 }
903 884
885 ui::TouchEvent orig_event(*event, target, window());
886 if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event,
887 target)) {
888 // The event is invalid - ignore it.
889 event->StopPropagation();
890 event->DisableSynchronousHandling();
891 return;
892 }
893
904 PreDispatchLocatedEvent(target, event); 894 PreDispatchLocatedEvent(target, event);
905 } 895 }
906 896
907 } // namespace aura 897 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698