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

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

Issue 2969113002: Forward BrowserAccessibilityWin table APIs to AXPlatformNodeWin. (Closed)
Patch Set: Rename 4X4 to 3X3. Off by one! Created 3 years, 5 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
« no previous file with comments | « ui/accessibility/platform/test_ax_node_wrapper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/gfx/geometry/rect_conversions.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 gfx::NativeViewAccessible TestAXNodeWrapper::HitTestSync(int x, int y) { 134 gfx::NativeViewAccessible TestAXNodeWrapper::HitTestSync(int x, int y) {
135 TestAXNodeWrapper* wrapper = HitTestSyncInternal(x, y); 135 TestAXNodeWrapper* wrapper = HitTestSyncInternal(x, y);
136 return wrapper ? wrapper->ax_platform_node()->GetNativeViewAccessible() 136 return wrapper ? wrapper->ax_platform_node()->GetNativeViewAccessible()
137 : nullptr; 137 : nullptr;
138 } 138 }
139 139
140 gfx::NativeViewAccessible TestAXNodeWrapper::GetFocus() { 140 gfx::NativeViewAccessible TestAXNodeWrapper::GetFocus() {
141 return nullptr; 141 return nullptr;
142 } 142 }
143 143
144 // Walk the AXTree and ensure that all wrappers are created
145 void TestAXNodeWrapper::BuildAllWrappers(AXTree* tree, AXNode* node) {
146 for (int i = 0; i < node->child_count(); i++) {
147 auto* child = node->children()[i];
148 TestAXNodeWrapper::GetOrCreate(tree, child);
149
150 BuildAllWrappers(tree, child);
151 }
152 }
153
144 AXPlatformNode* TestAXNodeWrapper::GetFromNodeID(int32_t id) { 154 AXPlatformNode* TestAXNodeWrapper::GetFromNodeID(int32_t id) {
155 // Force creating all of the wrappers for this tree.
156 BuildAllWrappers(tree_, node_);
157
158 for (auto it = g_node_to_wrapper_map.begin();
159 it != g_node_to_wrapper_map.end(); ++it) {
160 AXNode* node = it->first;
161 if (node->id() == id) {
162 TestAXNodeWrapper* wrapper = it->second;
163 return wrapper->ax_platform_node();
164 }
165 }
145 return nullptr; 166 return nullptr;
146 } 167 }
147 168
148 gfx::AcceleratedWidget 169 gfx::AcceleratedWidget
149 TestAXNodeWrapper::GetTargetForNativeAccessibilityEvent() { 170 TestAXNodeWrapper::GetTargetForNativeAccessibilityEvent() {
150 return gfx::kNullAcceleratedWidget; 171 return gfx::kNullAcceleratedWidget;
151 } 172 }
152 173
153 bool TestAXNodeWrapper::AccessibilityPerformAction( 174 bool TestAXNodeWrapper::AccessibilityPerformAction(
154 const ui::AXActionData& data) { 175 const ui::AXActionData& data) {
155 return true; 176 return true;
156 } 177 }
157 178
158 bool TestAXNodeWrapper::ShouldIgnoreHoveredStateForTesting() { 179 bool TestAXNodeWrapper::ShouldIgnoreHoveredStateForTesting() {
159 return true; 180 return true;
160 } 181 }
161 182
162 TestAXNodeWrapper::TestAXNodeWrapper(AXTree* tree, AXNode* node) 183 TestAXNodeWrapper::TestAXNodeWrapper(AXTree* tree, AXNode* node)
163 : tree_(tree), 184 : tree_(tree),
164 node_(node), 185 node_(node),
165 platform_node_(AXPlatformNode::Create(this)) { 186 platform_node_(AXPlatformNode::Create(this)) {
166 } 187 }
167 188
168 } // namespace ui 189 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/platform/test_ax_node_wrapper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698