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

Unified Diff: ui/aura/mus/window_tree_client.cc

Issue 2715743005: Revert of Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: 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/aura/BUILD.gn ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_tree_client.cc
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
index b01a0d5d13bf12c00b174a83f27a69e44fa47ba1..08e7b028bf1b90a4a7f6d21a9458623df8459d90 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -160,14 +160,6 @@
event->set_root_location(root_location);
}
-// Set the |target| to be the target window of this |event| and send it to
-// the EventProcessor.
-void DispatchEventToTarget(ui::Event* event, WindowMus* target) {
- ui::Event::DispatcherApi dispatch_helper(event);
- dispatch_helper.set_target(target->GetWindow());
- GetWindowTreeHostMus(target)->SendEventToProcessor(event);
-}
-
} // namespace
WindowTreeClient::WindowTreeClient(
@@ -1151,22 +1143,34 @@
return;
}
+ WindowTreeHostMus* host = GetWindowTreeHostMus(window);
+ DCHECK(host);
+
+ // The location of the event is relative to |window|. As the event is handed
+ // to WindowTreeHost we need it to be relative to WindowTreeHost.
+ if (event->IsLocatedEvent()) {
+ gfx::Point host_location = event->AsLocatedEvent()->location();
+ aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(),
+ &host_location);
+ event->AsLocatedEvent()->set_location(host_location);
+ }
+
EventAckHandler ack_handler(CreateEventResultCallback(event_id));
// TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
// ui::TouchEvent once we have proper support for pointer events.
if (event->IsMousePointerEvent()) {
if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) {
ui::MouseWheelEvent mapped_event(*event->AsPointerEvent());
- DispatchEventToTarget(&mapped_event, window);
+ host->SendEventToProcessor(&mapped_event);
} else {
ui::MouseEvent mapped_event(*event->AsPointerEvent());
- DispatchEventToTarget(&mapped_event, window);
+ host->SendEventToProcessor(&mapped_event);
}
} else if (event->IsTouchPointerEvent()) {
ui::TouchEvent mapped_event(*event->AsPointerEvent());
- DispatchEventToTarget(&mapped_event, window);
+ host->SendEventToProcessor(&mapped_event);
} else {
- DispatchEventToTarget(event.get(), window);
+ host->SendEventToProcessor(event.get());
}
ack_handler.set_handled(event->handled());
}
« no previous file with comments | « ui/aura/BUILD.gn ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698