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

Side by Side Diff: ui/aura/window_event_dispatcher.cc

Issue 536843003: Disable eager gesture detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable test depending on eager behavior. Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_unittest.cc ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ui::TouchEvent orig_event(*event, window, this->window()); 162 ui::TouchEvent orig_event(*event, window, this->window());
163
164 // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager
165 // gesture detection. See crbug.com/410280.
166 if (!ui::GestureRecognizer::Get()
167 ->ProcessTouchEventPreDispatch(orig_event, window)) {
168 return;
169 }
170
163 // Once we've fully migrated to the eager gesture detector, we won't need to 171 // Once we've fully migrated to the eager gesture detector, we won't need to
164 // pass an event here. 172 // pass an event here.
165 scoped_ptr<ui::GestureRecognizer::Gestures> gestures( 173 scoped_ptr<ui::GestureRecognizer::Gestures> gestures(
166 ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck( 174 ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck(
167 orig_event, result, window)); 175 orig_event, result, window));
168 DispatchDetails details = ProcessGestures(gestures.get()); 176 DispatchDetails details = ProcessGestures(gestures.get());
169 if (details.dispatcher_destroyed) 177 if (details.dispatcher_destroyed)
170 return; 178 return;
171 } 179 }
172 180
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 old_dispatch_target_ = NULL; 496 old_dispatch_target_ = NULL;
489 #ifndef NDEBUG 497 #ifndef NDEBUG
490 DCHECK(!event_dispatch_target_ || window()->Contains(event_dispatch_target_)); 498 DCHECK(!event_dispatch_target_ || window()->Contains(event_dispatch_target_));
491 #endif 499 #endif
492 500
493 if (event.IsTouchEvent() && !details.target_destroyed) { 501 if (event.IsTouchEvent() && !details.target_destroyed) {
494 // Do not let 'held' touch events contribute to any gestures unless it is 502 // Do not let 'held' touch events contribute to any gestures unless it is
495 // being dispatched. 503 // being dispatched.
496 if (dispatching_held_event_ || !held_move_event_ || 504 if (dispatching_held_event_ || !held_move_event_ ||
497 !held_move_event_->IsTouchEvent()) { 505 !held_move_event_->IsTouchEvent()) {
498 // If the event is being handled asynchronously, ignore it.
499 if(event.result() & ui::ER_CONSUMED)
500 return details;
501 scoped_ptr<ui::GestureRecognizer::Gestures> gestures;
502 506
503 // Once we've fully migrated to the eager gesture detector, we won't 507 // Once we've fully migrated to the eager gesture detector, we won't
504 // need to pass an event here. 508 // need to pass an event here.
505 ui::TouchEvent orig_event(static_cast<const ui::TouchEvent&>(event), 509 ui::TouchEvent orig_event(static_cast<const ui::TouchEvent&>(event),
506 static_cast<Window*>(event.target()), 510 static_cast<Window*>(event.target()),
507 window()); 511 window());
512
513 if (event.result() & ui::ER_CONSUMED)
514 orig_event.StopPropagation();
515
516 // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager
517 // gesture detection. See crbug.com/410280.
518 if (!ui::GestureRecognizer::Get()
519 ->ProcessTouchEventPreDispatch(orig_event,
520 static_cast<Window*>(target))) {
521 return details;
522 }
523
524 scoped_ptr<ui::GestureRecognizer::Gestures> gestures;
525
508 gestures.reset( 526 gestures.reset(
509 ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch( 527 ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch(
510 orig_event, event.result(), static_cast<Window*>(target))); 528 orig_event, event.result(), static_cast<Window*>(target)));
511 529
512 return ProcessGestures(gestures.get()); 530 return ProcessGestures(gestures.get());
513 } 531 }
514 } 532 }
515 533
516 return details; 534 return details;
517 } 535 }
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 event->SetHandled(); 899 event->SetHandled();
882 return; 900 return;
883 } 901 }
884 break; 902 break;
885 903
886 default: 904 default:
887 NOTREACHED(); 905 NOTREACHED();
888 break; 906 break;
889 } 907 }
890 908
891 if (dispatching_held_event_ || !held_move_event_ ||
892 !held_move_event_->IsTouchEvent()) {
893 ui::TouchEvent orig_event(*event, target, window());
894
895 // If the touch event is invalid in some way, the gesture recognizer will
896 // reject it. This must call |StopPropagation()|, in order to prevent the
897 // touch from being acked in |PostDispatchEvent|.
898 if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event,
899 target)) {
900 event->StopPropagation();
901 }
902 }
903
904 PreDispatchLocatedEvent(target, event); 909 PreDispatchLocatedEvent(target, event);
905 } 910 }
906 911
907 } // namespace aura 912 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_unittest.cc ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698