OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // If a window has been hidden between the touch event and now, the associated | 307 // If a window has been hidden between the touch event and now, the associated |
308 // gestures may not have a valid target. | 308 // gestures may not have a valid target. |
309 if (!target) | 309 if (!target) |
310 return details; | 310 return details; |
311 | 311 |
312 for (const auto& event : gestures) { | 312 for (const auto& event : gestures) { |
313 event->ConvertLocationToTarget(window(), target); | 313 event->ConvertLocationToTarget(window(), target); |
314 details = DispatchEvent(target, event.get()); | 314 details = DispatchEvent(target, event.get()); |
315 if (details.dispatcher_destroyed || details.target_destroyed) | 315 if (details.dispatcher_destroyed || details.target_destroyed) |
316 break; | 316 break; |
| 317 // If the target window has moved off to a different WindowTreeHost, then |
| 318 // abort processing the rest of the events. |
| 319 if (!window()->Contains(target)) |
| 320 break; |
317 } | 321 } |
318 return details; | 322 return details; |
319 } | 323 } |
320 | 324 |
321 void WindowEventDispatcher::OnWindowHidden(Window* invisible, | 325 void WindowEventDispatcher::OnWindowHidden(Window* invisible, |
322 WindowHiddenReason reason) { | 326 WindowHiddenReason reason) { |
323 // If the window the mouse was pressed in becomes invisible, it should no | 327 // If the window the mouse was pressed in becomes invisible, it should no |
324 // longer receive mouse events. | 328 // longer receive mouse events. |
325 if (invisible->Contains(mouse_pressed_handler_)) | 329 if (invisible->Contains(mouse_pressed_handler_)) |
326 mouse_pressed_handler_ = NULL; | 330 mouse_pressed_handler_ = NULL; |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 } | 925 } |
922 | 926 |
923 // This flag is set depending on the gestures recognized in the call above, | 927 // This flag is set depending on the gestures recognized in the call above, |
924 // and needs to propagate with the forwarded event. | 928 // and needs to propagate with the forwarded event. |
925 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 929 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
926 | 930 |
927 return PreDispatchLocatedEvent(target, event); | 931 return PreDispatchLocatedEvent(target, event); |
928 } | 932 } |
929 | 933 |
930 } // namespace aura | 934 } // namespace aura |
OLD | NEW |