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

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

Issue 1313353010: Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments2 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
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/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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698