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/accessibility/platform/ax_platform_node_base.h" | 5 #include "ui/accessibility/platform/ax_platform_node_base.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/accessibility/ax_action_data.h" | 8 #include "ui/accessibility/ax_action_data.h" |
9 #include "ui/accessibility/ax_node_data.h" | 9 #include "ui/accessibility/ax_node_data.h" |
10 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 10 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
11 #include "ui/gfx/geometry/rect_conversions.h" | 11 #include "ui/gfx/geometry/rect_conversions.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) { | 15 void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) { |
16 delegate_ = delegate; | 16 delegate_ = delegate; |
17 } | 17 } |
18 | 18 |
19 const AXNodeData& AXPlatformNodeBase::GetData() const { | 19 const AXNodeData& AXPlatformNodeBase::GetData() const { |
20 CHECK(delegate_); | 20 CHECK(delegate_); |
21 return delegate_->GetData(); | 21 return delegate_->GetData(); |
22 } | 22 } |
23 | 23 |
24 gfx::Rect AXPlatformNodeBase::GetBoundsInScreen() const { | 24 gfx::Rect AXPlatformNodeBase::GetBoundsInScreen() const { |
25 CHECK(delegate_); | 25 CHECK(delegate_); |
26 gfx::Rect bounds = gfx::ToEnclosingRect(GetData().location); | 26 return delegate_->GetScreenBoundsRect(); |
27 bounds.Offset(delegate_->GetGlobalCoordinateOffset()); | |
28 return bounds; | |
29 } | 27 } |
30 | 28 |
31 gfx::NativeViewAccessible AXPlatformNodeBase::GetParent() { | 29 gfx::NativeViewAccessible AXPlatformNodeBase::GetParent() { |
32 CHECK(delegate_); | 30 CHECK(delegate_); |
33 return delegate_->GetParent(); | 31 return delegate_->GetParent(); |
34 } | 32 } |
35 | 33 |
36 int AXPlatformNodeBase::GetChildCount() { | 34 int AXPlatformNodeBase::GetChildCount() { |
37 CHECK(delegate_); | 35 CHECK(delegate_); |
38 return delegate_->GetChildCount(); | 36 return delegate_->GetChildCount(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 ui::AXActionData action_data; | 207 ui::AXActionData action_data; |
210 action_data.action = ui::AX_ACTION_SET_SELECTION; | 208 action_data.action = ui::AX_ACTION_SET_SELECTION; |
211 action_data.anchor_node_id = action_data.focus_node_id = GetData().id; | 209 action_data.anchor_node_id = action_data.focus_node_id = GetData().id; |
212 action_data.anchor_offset = start_offset; | 210 action_data.anchor_offset = start_offset; |
213 action_data.focus_offset = end_offset; | 211 action_data.focus_offset = end_offset; |
214 DCHECK(delegate_); | 212 DCHECK(delegate_); |
215 return delegate_->AccessibilityPerformAction(action_data); | 213 return delegate_->AccessibilityPerformAction(action_data); |
216 } | 214 } |
217 | 215 |
218 } // namespace ui | 216 } // namespace ui |
OLD | NEW |