OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/accessibility/native_view_accessibility_base.h" | 5 #include "ui/views/accessibility/native_view_accessibility_base.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "ui/base/ime/input_method.h" |
9 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/views/controls/native/native_view_host.h" | 12 #include "ui/views/controls/native/native_view_host.h" |
12 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 if (parent_widget_) | 142 if (parent_widget_) |
142 return parent_widget_->GetRootView()->GetNativeViewAccessible(); | 143 return parent_widget_->GetRootView()->GetNativeViewAccessible(); |
143 | 144 |
144 return nullptr; | 145 return nullptr; |
145 } | 146 } |
146 | 147 |
147 gfx::Rect NativeViewAccessibilityBase::GetScreenBoundsRect() const { | 148 gfx::Rect NativeViewAccessibilityBase::GetScreenBoundsRect() const { |
148 return view_->GetBoundsInScreen(); | 149 return view_->GetBoundsInScreen(); |
149 } | 150 } |
150 | 151 |
| 152 ui::TextInputClient* NativeViewAccessibilityBase::GetTextInputClient() const { |
| 153 if (ui::InputMethod* input_method = view_->GetInputMethod()) { |
| 154 // This will return the wrong thing if a text field has focus, but a request |
| 155 // comes in for some other view. |
| 156 return input_method->GetTextInputClient(); |
| 157 } |
| 158 return nullptr; |
| 159 } |
| 160 |
151 gfx::NativeViewAccessible NativeViewAccessibilityBase::HitTestSync(int x, | 161 gfx::NativeViewAccessible NativeViewAccessibilityBase::HitTestSync(int x, |
152 int y) { | 162 int y) { |
153 if (!view_ || !view_->GetWidget()) | 163 if (!view_ || !view_->GetWidget()) |
154 return nullptr; | 164 return nullptr; |
155 | 165 |
156 // Search child widgets first, since they're on top in the z-order. | 166 // Search child widgets first, since they're on top in the z-order. |
157 std::vector<Widget*> child_widgets; | 167 std::vector<Widget*> child_widgets; |
158 PopulateChildWidgetVector(&child_widgets); | 168 PopulateChildWidgetVector(&child_widgets); |
159 for (Widget* child_widget : child_widgets) { | 169 for (Widget* child_widget : child_widgets) { |
160 View* child_root_view = child_widget->GetRootView(); | 170 View* child_root_view = child_widget->GetRootView(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 child_widget_platform_node->GetDelegate()); | 263 child_widget_platform_node->GetDelegate()); |
254 if (child_widget_view_accessibility->parent_widget() != widget) | 264 if (child_widget_view_accessibility->parent_widget() != widget) |
255 child_widget_view_accessibility->SetParentWidget(widget); | 265 child_widget_view_accessibility->SetParentWidget(widget); |
256 } | 266 } |
257 | 267 |
258 result_child_widgets->push_back(child_widget); | 268 result_child_widgets->push_back(child_widget); |
259 } | 269 } |
260 } | 270 } |
261 | 271 |
262 } // namespace views | 272 } // namespace views |
OLD | NEW |