OLD | NEW |
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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 ui::Event* event) { | 41 ui::Event* event) { |
42 return previous_target->GetParentTarget(); | 42 return previous_target->GetParentTarget(); |
43 } | 43 } |
44 | 44 |
45 bool ViewTargeter::SubtreeCanAcceptEvent( | 45 bool ViewTargeter::SubtreeCanAcceptEvent( |
46 ui::EventTarget* target, | 46 ui::EventTarget* target, |
47 const ui::LocatedEvent& event) const { | 47 const ui::LocatedEvent& event) const { |
48 views::View* view = static_cast<views::View*>(target); | 48 views::View* view = static_cast<views::View*>(target); |
49 if (!view->visible()) | 49 if (!view->visible()) |
50 return false; | 50 return false; |
| 51 |
| 52 if (!view->CanProcessEventsWithinSubtree()) |
| 53 return false; |
| 54 |
51 return true; | 55 return true; |
52 } | 56 } |
53 | 57 |
54 bool ViewTargeter::EventLocationInsideBounds( | 58 bool ViewTargeter::EventLocationInsideBounds( |
55 ui::EventTarget* target, | 59 ui::EventTarget* target, |
56 const ui::LocatedEvent& event) const { | 60 const ui::LocatedEvent& event) const { |
57 views::View* view = static_cast<views::View*>(target); | 61 views::View* view = static_cast<views::View*>(target); |
58 gfx::Rect rect(event.location(), gfx::Size(1, 1)); | 62 gfx::Rect rect(event.location(), gfx::Size(1, 1)); |
59 gfx::RectF rect_in_view_coords_f(rect); | 63 gfx::RectF rect_in_view_coords_f(rect); |
60 if (view->parent()) | 64 if (view->parent()) |
61 View::ConvertRectToTarget(view->parent(), view, &rect_in_view_coords_f); | 65 View::ConvertRectToTarget(view->parent(), view, &rect_in_view_coords_f); |
62 gfx::Rect rect_in_view_coords = gfx::ToEnclosingRect(rect_in_view_coords_f); | 66 gfx::Rect rect_in_view_coords = gfx::ToEnclosingRect(rect_in_view_coords_f); |
63 | 67 |
64 // TODO(tdanderson): Don't call into HitTestRect() directly here. | 68 // TODO(tdanderson): Don't call into HitTestRect() directly here. |
65 // See crbug.com/370579. | 69 // See crbug.com/370579. |
66 return view->HitTestRect(rect_in_view_coords); | 70 return view->HitTestRect(rect_in_view_coords); |
67 } | 71 } |
68 | 72 |
69 View* ViewTargeter::FindTargetForKeyEvent(View* view, const ui::KeyEvent& key) { | 73 View* ViewTargeter::FindTargetForKeyEvent(View* view, const ui::KeyEvent& key) { |
70 if (view->GetFocusManager()) | 74 if (view->GetFocusManager()) |
71 return view->GetFocusManager()->GetFocusedView(); | 75 return view->GetFocusManager()->GetFocusedView(); |
72 return NULL; | 76 return NULL; |
73 } | 77 } |
74 | 78 |
75 } // namespace aura | 79 } // namespace aura |
OLD | NEW |