OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/accessibility/ax_tree.h" | 5 #include "ui/accessibility/ax_tree.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "ui/accessibility/ax_node.h" | 11 #include "ui/accessibility/ax_node.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 std::string TreeToStringHelper(AXNode* node, int indent) { | 17 std::string TreeToStringHelper(AXNode* node, int indent) { |
18 std::string result; | 18 std::string result = std::string(2 * indent, ' '); |
19 for (int i = 0; i < indent; i++) | |
20 result += " "; | |
21 result += node->data().ToString() + "\n"; | 19 result += node->data().ToString() + "\n"; |
22 for (int i = 0; i < node->child_count(); ++i) | 20 for (int i = 0; i < node->child_count(); ++i) |
23 result += TreeToStringHelper(node->ChildAtIndex(i), indent + 1); | 21 result += TreeToStringHelper(node->ChildAtIndex(i), indent + 1); |
24 return result; | 22 return result; |
25 } | 23 } |
26 | 24 |
27 } // anonymous namespace | 25 } // anonymous namespace |
28 | 26 |
29 // Intermediate state to keep track of during a tree update. | 27 // Intermediate state to keep track of during a tree update. |
30 struct AXTreeUpdateState { | 28 struct AXTreeUpdateState { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 update_state->pending_nodes.insert(child); | 255 update_state->pending_nodes.insert(child); |
258 update_state->new_nodes.insert(child); | 256 update_state->new_nodes.insert(child); |
259 } | 257 } |
260 new_children->push_back(child); | 258 new_children->push_back(child); |
261 } | 259 } |
262 | 260 |
263 return success; | 261 return success; |
264 } | 262 } |
265 | 263 |
266 } // namespace ui | 264 } // namespace ui |
OLD | NEW |