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

Unified Diff: ui/events/event_processor.cc

Issue 542323002: Convert ui::GestureEvent coordinates during targeting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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 e9f47c353f74442bc6d9e20154cd88b155cdded0..3806fbc03984e05c6d27876ac48e49b5f29f410a 100644
--- a/ui/events/event_processor.cc
+++ b/ui/events/event_processor.cc
@@ -14,27 +14,27 @@ EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) {
CHECK(root);
EventTargeter* targeter = root->GetEventTargeter();
CHECK(targeter);
-
PrepareEventForDispatch(event);
- EventTarget* target = targeter->FindTargetForEvent(root, event);
- // If the event is in the process of being dispatched or has already been
+ // 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;
+ Event* event_to_dispatch = event;
scoped_ptr<Event> event_copy;
- if (event->phase() != EP_PREDISPATCH)
+ if (!dispatch_original_event) {
event_copy = Event::Clone(*event);
+ event_to_dispatch = event_copy.get();
+ }
+ EventTarget* target = targeter->FindTargetForEvent(root, event_to_dispatch);
while (target) {
- EventDispatchDetails details;
- if (event_copy) {
- details = DispatchEvent(target, event_copy.get());
+ EventDispatchDetails details = DispatchEvent(target, event_to_dispatch);
- if (event_copy->stopped_propagation())
+ if (!dispatch_original_event) {
+ if (event_to_dispatch->stopped_propagation())
event->StopPropagation();
- else if (event_copy->handled())
+ else if (event_to_dispatch->handled())
event->SetHandled();
- } else {
- details = DispatchEvent(target, event);
}
if (details.dispatcher_destroyed ||
@@ -43,7 +43,7 @@ EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) {
return details;
}
- target = targeter->FindNextBestTarget(target, event);
+ target = targeter->FindNextBestTarget(target, event_to_dispatch);
}
return EventDispatchDetails();
« no previous file with comments | « no previous file | ui/events/event_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698