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

Side by Side Diff: ui/accessibility/platform/test_ax_node_wrapper.cc

Issue 2795543002: Add GetScreenBoundsRect to ui::AXPlatformNodeDelegate (Closed)
Patch Set: Add GetScreenBoundsRect() to ui::AXPlatformNodeDelegate Created 3 years, 8 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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "ui/accessibility/ax_action_data.h" 6 #include "ui/accessibility/ax_action_data.h"
7 #include "ui/accessibility/platform/test_ax_node_wrapper.h" 7 #include "ui/accessibility/platform/test_ax_node_wrapper.h"
8 #include "ui/gfx/geometry/rect_conversions.h"
8 9
9 namespace ui { 10 namespace ui {
10 11
11 namespace { 12 namespace {
12 13
13 // A global map from AXNodes to TestAXNodeWrappers. 14 // A global map from AXNodes to TestAXNodeWrappers.
14 base::hash_map<AXNode*, TestAXNodeWrapper*> g_node_to_wrapper_map; 15 base::hash_map<AXNode*, TestAXNodeWrapper*> g_node_to_wrapper_map;
15 16
16 // A global coordinate offset. 17 // A global coordinate offset.
17 gfx::Vector2d g_offset; 18 gfx::Vector2d g_offset;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 gfx::NativeViewAccessible TestAXNodeWrapper::ChildAtIndex(int index) { 94 gfx::NativeViewAccessible TestAXNodeWrapper::ChildAtIndex(int index) {
94 CHECK_GE(index, 0); 95 CHECK_GE(index, 0);
95 CHECK_LT(index, GetChildCount()); 96 CHECK_LT(index, GetChildCount());
96 TestAXNodeWrapper* child_wrapper = 97 TestAXNodeWrapper* child_wrapper =
97 GetOrCreate(tree_, node_->children()[index]); 98 GetOrCreate(tree_, node_->children()[index]);
98 return child_wrapper ? 99 return child_wrapper ?
99 child_wrapper->ax_platform_node()->GetNativeViewAccessible() : 100 child_wrapper->ax_platform_node()->GetNativeViewAccessible() :
100 nullptr; 101 nullptr;
101 } 102 }
102 103
103 gfx::Vector2d TestAXNodeWrapper::GetGlobalCoordinateOffset() { 104 gfx::Rect TestAXNodeWrapper::GetScreenBoundsRect() const {
104 return g_offset; 105 gfx::RectF bounds = GetData().location;
106 bounds.Offset(g_offset);
107 return gfx::ToEnclosingRect(bounds);
105 } 108 }
106 109
107 gfx::NativeViewAccessible TestAXNodeWrapper::HitTestSync(int x, int y) { 110 gfx::NativeViewAccessible TestAXNodeWrapper::HitTestSync(int x, int y) {
108 return nullptr; 111 return nullptr;
109 } 112 }
110 113
111 gfx::NativeViewAccessible TestAXNodeWrapper::GetFocus() { 114 gfx::NativeViewAccessible TestAXNodeWrapper::GetFocus() {
112 return nullptr; 115 return nullptr;
113 } 116 }
114 117
115 gfx::AcceleratedWidget 118 gfx::AcceleratedWidget
116 TestAXNodeWrapper::GetTargetForNativeAccessibilityEvent() { 119 TestAXNodeWrapper::GetTargetForNativeAccessibilityEvent() {
117 return gfx::kNullAcceleratedWidget; 120 return gfx::kNullAcceleratedWidget;
118 } 121 }
119 122
120 bool TestAXNodeWrapper::AccessibilityPerformAction( 123 bool TestAXNodeWrapper::AccessibilityPerformAction(
121 const ui::AXActionData& data) { 124 const ui::AXActionData& data) {
122 return true; 125 return true;
123 } 126 }
124 127
125 TestAXNodeWrapper::TestAXNodeWrapper(AXTree* tree, AXNode* node) 128 TestAXNodeWrapper::TestAXNodeWrapper(AXTree* tree, AXNode* node)
126 : tree_(tree), 129 : tree_(tree),
127 node_(node), 130 node_(node),
128 platform_node_(AXPlatformNode::Create(this)) { 131 platform_node_(AXPlatformNode::Create(this)) {
129 } 132 }
130 133
131 } // namespace ui 134 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698