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

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

Issue 469523003: Add the actual location coordinates to the touch cancel event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the unit tests Created 6 years, 4 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
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"
11 #include "ui/aura/client/capture_client.h" 11 #include "ui/aura/client/capture_client.h"
12 #include "ui/aura/client/cursor_client.h" 12 #include "ui/aura/client/cursor_client.h"
13 #include "ui/aura/client/event_client.h" 13 #include "ui/aura/client/event_client.h"
14 #include "ui/aura/client/focus_client.h" 14 #include "ui/aura/client/focus_client.h"
15 #include "ui/aura/client/screen_position_client.h" 15 #include "ui/aura/client/screen_position_client.h"
16 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/aura/window_delegate.h" 18 #include "ui/aura/window_delegate.h"
19 #include "ui/aura/window_targeter.h" 19 #include "ui/aura/window_targeter.h"
20 #include "ui/aura/window_tracker.h" 20 #include "ui/aura/window_tracker.h"
21 #include "ui/aura/window_tree_host.h" 21 #include "ui/aura/window_tree_host.h"
22 #include "ui/base/hit_test.h" 22 #include "ui/base/hit_test.h"
23 #include "ui/compositor/dip_util.h" 23 #include "ui/compositor/dip_util.h"
24 #include "ui/events/event.h" 24 #include "ui/events/event.h"
25 #include "ui/events/event_constants.h"
tdresser 2014/08/13 19:57:58 Is this necessary?
lanwei 2014/08/14 00:38:46 No, forgot to delete it. Done.
25 #include "ui/events/gestures/gesture_recognizer.h" 26 #include "ui/events/gestures/gesture_recognizer.h"
26 #include "ui/events/gestures/gesture_types.h" 27 #include "ui/events/gestures/gesture_types.h"
27 28
28 typedef ui::EventDispatchDetails DispatchDetails; 29 typedef ui::EventDispatchDetails DispatchDetails;
29 30
30 namespace aura { 31 namespace aura {
31 32
32 namespace { 33 namespace {
33 34
34 // Returns true if |target| has a non-client (frame) component at |location|, 35 // Returns true if |target| has a non-client (frame) component at |location|,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 DispatchDetails details = 134 DispatchDetails details =
134 DispatchEvent(focused_window ? focused_window : window(), &event); 135 DispatchEvent(focused_window ? focused_window : window(), &event);
135 if (details.dispatcher_destroyed) 136 if (details.dispatcher_destroyed)
136 return; 137 return;
137 } 138 }
138 139
139 void WindowEventDispatcher::DispatchGestureEvent(ui::GestureEvent* event) { 140 void WindowEventDispatcher::DispatchGestureEvent(ui::GestureEvent* event) {
140 DispatchDetails details = DispatchHeldEvents(); 141 DispatchDetails details = DispatchHeldEvents();
141 if (details.dispatcher_destroyed) 142 if (details.dispatcher_destroyed)
142 return; 143 return;
143
144 Window* target = GetGestureTarget(event); 144 Window* target = GetGestureTarget(event);
145 if (target) { 145 if (target) {
146 event->ConvertLocationToTarget(window(), target); 146 event->ConvertLocationToTarget(window(), target);
147 DispatchDetails details = DispatchEvent(target, event); 147 DispatchDetails details = DispatchEvent(target, event);
148 if (details.dispatcher_destroyed) 148 if (details.dispatcher_destroyed)
149 return; 149 return;
150 } 150 }
151 } 151 }
152 152
153 DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint( 153 DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint(
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 //////////////////////////////////////////////////////////////////////////////// 523 ////////////////////////////////////////////////////////////////////////////////
524 // WindowEventDispatcher, ui::GestureEventHelper implementation: 524 // WindowEventDispatcher, ui::GestureEventHelper implementation:
525 525
526 bool WindowEventDispatcher::CanDispatchToConsumer( 526 bool WindowEventDispatcher::CanDispatchToConsumer(
527 ui::GestureConsumer* consumer) { 527 ui::GestureConsumer* consumer) {
528 Window* consumer_window = ConsumerToWindow(consumer); 528 Window* consumer_window = ConsumerToWindow(consumer);
529 return (consumer_window && consumer_window->GetRootWindow() == window()); 529 return (consumer_window && consumer_window->GetRootWindow() == window());
530 } 530 }
531 531
532 void WindowEventDispatcher::DispatchCancelTouchEvent(ui::TouchEvent* event) { 532 void WindowEventDispatcher::DispatchCancelTouchEvent(ui::TouchEvent* event) {
533 event->UpdateForRootTransform(host_->GetRootTransform());
tdresser 2014/08/13 19:57:58 Add a comment indicating why this is here.
lanwei 2014/08/14 00:38:46 Done.
533 DispatchDetails details = OnEventFromSource(event); 534 DispatchDetails details = OnEventFromSource(event);
534 if (details.dispatcher_destroyed) 535 if (details.dispatcher_destroyed)
535 return; 536 return;
536 } 537 }
537 538
538 //////////////////////////////////////////////////////////////////////////////// 539 ////////////////////////////////////////////////////////////////////////////////
539 // WindowEventDispatcher, WindowObserver implementation: 540 // WindowEventDispatcher, WindowObserver implementation:
540 541
541 void WindowEventDispatcher::OnWindowDestroying(Window* window) { 542 void WindowEventDispatcher::OnWindowDestroying(Window* window) {
542 if (!host_->window()->Contains(window)) 543 if (!host_->window()->Contains(window))
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event, 899 if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event,
899 target)) { 900 target)) {
900 event->SetHandled(); 901 event->SetHandled();
901 } 902 }
902 } 903 }
903 904
904 PreDispatchLocatedEvent(target, event); 905 PreDispatchLocatedEvent(target, event);
905 } 906 }
906 907
907 } // namespace aura 908 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698