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 "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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 void WindowEventDispatcher::ReleaseNativeCapture() { | 428 void WindowEventDispatcher::ReleaseNativeCapture() { |
429 host_->ReleaseCapture(); | 429 host_->ReleaseCapture(); |
430 } | 430 } |
431 | 431 |
432 //////////////////////////////////////////////////////////////////////////////// | 432 //////////////////////////////////////////////////////////////////////////////// |
433 // WindowEventDispatcher, ui::EventProcessor implementation: | 433 // WindowEventDispatcher, ui::EventProcessor implementation: |
434 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { | 434 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { |
435 return window(); | 435 return window(); |
436 } | 436 } |
437 | 437 |
438 void WindowEventDispatcher::PrepareEventForDispatch(ui::Event* event) { | 438 bool WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) { |
439 if (dispatching_held_event_) { | 439 // The held events are already in |window()|'s coordinate system. So it is |
440 // The held events are already in |window()|'s coordinate system. So it is | 440 // not necessary to apply the transform to convert from the host's |
441 // not necessary to apply the transform to convert from the host's | 441 // coordinate system to |window()|'s coordinate system. |
442 // coordinate system to |window()|'s coordinate system. | 442 if (event->IsLocatedEvent() && !dispatching_held_event_) |
443 return; | |
444 } | |
445 if (event->IsLocatedEvent()) { | |
446 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); | 443 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); |
447 } | 444 |
| 445 return true; |
448 } | 446 } |
449 | 447 |
450 //////////////////////////////////////////////////////////////////////////////// | 448 //////////////////////////////////////////////////////////////////////////////// |
451 // WindowEventDispatcher, ui::EventDispatcherDelegate implementation: | 449 // WindowEventDispatcher, ui::EventDispatcherDelegate implementation: |
452 | 450 |
453 bool WindowEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { | 451 bool WindowEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { |
454 return event_dispatch_target_ == target; | 452 return event_dispatch_target_ == target; |
455 } | 453 } |
456 | 454 |
457 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchEvent( | 455 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchEvent( |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 899 |
902 default: | 900 default: |
903 NOTREACHED(); | 901 NOTREACHED(); |
904 break; | 902 break; |
905 } | 903 } |
906 | 904 |
907 PreDispatchLocatedEvent(target, event); | 905 PreDispatchLocatedEvent(target, event); |
908 } | 906 } |
909 | 907 |
910 } // namespace aura | 908 } // namespace aura |
OLD | NEW |