OLD | NEW |
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/view_manager/event_dispatcher.h" | 5 #include "components/view_manager/event_dispatcher.h" |
6 | 6 |
7 #include "components/view_manager/server_view.h" | 7 #include "components/view_manager/server_view.h" |
8 #include "components/view_manager/view_coordinate_conversions.h" | 8 #include "components/view_manager/view_coordinate_conversions.h" |
9 #include "components/view_manager/view_locator.h" | 9 #include "components/view_manager/view_locator.h" |
10 #include "components/view_manager/view_tree_host_impl.h" | 10 #include "components/view_manager/view_tree_host_impl.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return true; | 68 return true; |
69 } | 69 } |
70 } | 70 } |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) { | 74 ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) { |
75 ServerView* focused_view = view_tree_host_->GetFocusedView(); | 75 ServerView* focused_view = view_tree_host_->GetFocusedView(); |
76 if (event->pointer_data) { | 76 if (event->pointer_data) { |
77 ServerView* root = view_tree_host_->root_view(); | 77 ServerView* root = view_tree_host_->root_view(); |
78 const gfx::Point root_point(static_cast<int>(event->pointer_data->x), | 78 const gfx::Point root_point( |
79 static_cast<int>(event->pointer_data->y)); | 79 static_cast<int>(event->pointer_data->where->x), |
| 80 static_cast<int>(event->pointer_data->where->y)); |
80 ServerView* target = focused_view; | 81 ServerView* target = focused_view; |
81 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || | 82 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || |
82 !root->Contains(target)) { | 83 !root->Contains(target)) { |
83 target = FindDeepestVisibleView(root, root_point); | 84 target = FindDeepestVisibleView(root, root_point); |
84 CHECK(target); | 85 CHECK(target); |
85 } | 86 } |
86 const gfx::PointF local_point(ConvertPointFBetweenViews( | 87 const gfx::PointF local_point(ConvertPointFBetweenViews( |
87 root, target, | 88 root, target, gfx::PointF(event->pointer_data->where->x, |
88 gfx::PointF(event->pointer_data->x, event->pointer_data->y))); | 89 event->pointer_data->where->y))); |
89 event->pointer_data->x = local_point.x(); | 90 event->pointer_data->where->x = local_point.x(); |
90 event->pointer_data->y = local_point.y(); | 91 event->pointer_data->where->y = local_point.y(); |
91 return target; | 92 return target; |
92 } | 93 } |
93 | 94 |
94 return focused_view; | 95 return focused_view; |
95 } | 96 } |
96 | 97 |
97 } // namespace view_manager | 98 } // namespace view_manager |
OLD | NEW |