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

Side by Side Diff: components/mus/event_dispatcher.cc

Issue 1344223002: Revert of Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « components/mus/display_manager.cc ('k') | components/mus/gesture_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/event_dispatcher.h" 5 #include "components/mus/event_dispatcher.h"
6 6
7 #include "components/mus/server_view.h" 7 #include "components/mus/server_view.h"
8 #include "components/mus/view_coordinate_conversions.h" 8 #include "components/mus/view_coordinate_conversions.h"
9 #include "components/mus/view_locator.h" 9 #include "components/mus/view_locator.h"
10 #include "components/mus/view_tree_host_impl.h" 10 #include "components/mus/view_tree_host_impl.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return true; 66 return true;
67 } 67 }
68 } 68 }
69 return false; 69 return false;
70 } 70 }
71 71
72 ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) { 72 ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) {
73 ServerView* focused_view = view_tree_host_->GetFocusedView(); 73 ServerView* focused_view = view_tree_host_->GetFocusedView();
74 if (event->pointer_data) { 74 if (event->pointer_data) {
75 ServerView* root = view_tree_host_->root_view(); 75 ServerView* root = view_tree_host_->root_view();
76 const gfx::Point root_point( 76 const gfx::Point root_point(static_cast<int>(event->pointer_data->x),
77 static_cast<int>(event->pointer_data->location->x), 77 static_cast<int>(event->pointer_data->y));
78 static_cast<int>(event->pointer_data->location->y));
79 ServerView* target = focused_view; 78 ServerView* target = focused_view;
80 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || 79 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target ||
81 !root->Contains(target)) { 80 !root->Contains(target)) {
82 target = FindDeepestVisibleView(root, root_point); 81 target = FindDeepestVisibleView(root, root_point);
83 CHECK(target); 82 CHECK(target);
84 } 83 }
85 const gfx::PointF local_point(ConvertPointFBetweenViews( 84 const gfx::PointF local_point(ConvertPointFBetweenViews(
86 root, target, gfx::PointF(event->pointer_data->location->x, 85 root, target,
87 event->pointer_data->location->y))); 86 gfx::PointF(event->pointer_data->x, event->pointer_data->y)));
88 event->pointer_data->location->x = local_point.x(); 87 event->pointer_data->x = local_point.x();
89 event->pointer_data->location->y = local_point.y(); 88 event->pointer_data->y = local_point.y();
90 return target; 89 return target;
91 } 90 }
92 91
93 return focused_view; 92 return focused_view;
94 } 93 }
95 94
96 } // namespace view_manager 95 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/mus/display_manager.cc ('k') | components/mus/gesture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698