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

Side by Side Diff: ui/views/view_targeter.cc

Issue 286933014: Introduce the MaskedViewTargeter class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/view_targeter.h ('k') | ui/views/view_targeter_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/view_targeter.h" 5 #include "ui/views/view_targeter.h"
6 6
7 #include "ui/events/event_target.h" 7 #include "ui/events/event_target.h"
8 #include "ui/views/focus/focus_manager.h" 8 #include "ui/views/focus/focus_manager.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 10
11 namespace views { 11 namespace views {
12 12
13 ViewTargeter::ViewTargeter() {} 13 ViewTargeter::ViewTargeter() {}
14 ViewTargeter::~ViewTargeter() {} 14 ViewTargeter::~ViewTargeter() {}
15 15
16 gfx::Rect ViewTargeter::BoundsForEvent(const ui::LocatedEvent& event) const {
17 gfx::Rect event_bounds(event.location(), gfx::Size(1, 1));
18 if (event.IsGestureEvent()) {
19 const ui::GestureEvent& gesture = static_cast<const ui::GestureEvent&>(
20 event);
sadrul 2014/05/27 16:03:32 The formatting here seems a bit weird. What would
tdanderson 2014/05/27 16:24:46 Done.
21 event_bounds = gesture.details().bounding_box();
sadrul 2014/05/27 16:03:32 Can you return a RectF instead (and get bounding_b
tdanderson 2014/05/27 16:24:46 Done.
22 }
23
24 return event_bounds;
25 }
26
27
16 ui::EventTarget* ViewTargeter::FindTargetForEvent(ui::EventTarget* root, 28 ui::EventTarget* ViewTargeter::FindTargetForEvent(ui::EventTarget* root,
17 ui::Event* event) { 29 ui::Event* event) {
18 View* view = static_cast<View*>(root); 30 View* view = static_cast<View*>(root);
19 if (event->IsKeyEvent()) 31 if (event->IsKeyEvent())
20 return FindTargetForKeyEvent(view, *static_cast<ui::KeyEvent*>(event)); 32 return FindTargetForKeyEvent(view, *static_cast<ui::KeyEvent*>(event));
21 else if (event->IsScrollEvent()) 33 else if (event->IsScrollEvent())
22 return EventTargeter::FindTargetForEvent(root, event); 34 return EventTargeter::FindTargetForEvent(root, event);
23 35
24 NOTREACHED() << "ViewTargeter does not yet support this event type."; 36 NOTREACHED() << "ViewTargeter does not yet support this event type.";
25 return NULL; 37 return NULL;
(...skipping 29 matching lines...) Expand all
55 return view->HitTestRect(rect_in_view_coords); 67 return view->HitTestRect(rect_in_view_coords);
56 } 68 }
57 69
58 View* ViewTargeter::FindTargetForKeyEvent(View* view, const ui::KeyEvent& key) { 70 View* ViewTargeter::FindTargetForKeyEvent(View* view, const ui::KeyEvent& key) {
59 if (view->GetFocusManager()) 71 if (view->GetFocusManager())
60 return view->GetFocusManager()->GetFocusedView(); 72 return view->GetFocusManager()->GetFocusedView();
61 return NULL; 73 return NULL;
62 } 74 }
63 75
64 } // namespace aura 76 } // namespace aura
OLDNEW
« no previous file with comments | « ui/views/view_targeter.h ('k') | ui/views/view_targeter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698