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

Unified Diff: ui/events/event_processor.cc

Issue 2681613002: Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: test and doc Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/event_processor.h ('k') | ui/events/event_processor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event_processor.cc
diff --git a/ui/events/event_processor.cc b/ui/events/event_processor.cc
index 61d2e72138a8dc51beb04f960b19197d715c750d..ef7a0f70d93f1ccfb1e8dc01a693884887892387 100644
--- a/ui/events/event_processor.cc
+++ b/ui/events/event_processor.cc
@@ -10,11 +10,6 @@
namespace ui {
EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) {
- EventTarget* root = GetRootTarget();
- CHECK(root);
- EventTargeter* targeter = root->GetEventTargeter();
- CHECK(targeter);
-
// If |event| is in the process of being dispatched or has already been
// dispatched, then dispatch a copy of the event instead.
bool dispatch_original_event = event->phase() == EP_PREDISPATCH;
@@ -26,9 +21,21 @@ EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) {
}
OnEventProcessingStarted(event_to_dispatch);
- EventTarget* target = NULL;
- if (!event_to_dispatch->handled())
- target = targeter->FindTargetForEvent(root, event_to_dispatch);
+ EventTarget* target = event->target();
sky 2017/02/16 01:03:02 The old code set the target to null here, which ma
riajiang 2017/02/16 19:10:36 Ah true! I moved it to be inside the case where ev
+ EventTargeter* targeter = nullptr;
+ if (!event_to_dispatch->handled()) {
+ EventTarget* root = GetRootForEvent(event_to_dispatch);
+ DCHECK(root);
+ targeter = root->GetEventTargeter();
+ if (!targeter) {
+ targeter = GetDefaultEventTargeter();
+ if (!target)
+ target = targeter->FindTargetForEvent(root, event_to_dispatch);
+ } else {
+ target = targeter->FindTargetForEvent(root, event_to_dispatch);
+ }
+ DCHECK(targeter);
+ }
EventDispatchDetails details;
while (target) {
« no previous file with comments | « ui/events/event_processor.h ('k') | ui/events/event_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698