| 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 #ifndef UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ |
| 6 #define UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ | 6 #define UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <string> | 11 #include <string> |
| 9 #include <vector> | 12 #include <vector> |
| 10 | 13 |
| 11 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 12 #include "ui/accessibility/ax_node_data.h" | 15 #include "ui/accessibility/ax_node_data.h" |
| 13 #include "ui/accessibility/ax_tree_data.h" | 16 #include "ui/accessibility/ax_tree_data.h" |
| 14 | 17 |
| 15 namespace ui { | 18 namespace ui { |
| 16 | 19 |
| 17 // An AXTreeUpdate is a serialized representation of an atomic change | 20 // An AXTreeUpdate is a serialized representation of an atomic change |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (node_id_to_clear != 0) { | 91 if (node_id_to_clear != 0) { |
| 89 result += "AXTreeUpdate: clear node " + | 92 result += "AXTreeUpdate: clear node " + |
| 90 base::IntToString(node_id_to_clear) + "\n"; | 93 base::IntToString(node_id_to_clear) + "\n"; |
| 91 } | 94 } |
| 92 | 95 |
| 93 // The challenge here is that we want to indent the nodes being updated | 96 // The challenge here is that we want to indent the nodes being updated |
| 94 // so that parent/child relationships are clear, but we don't have access | 97 // so that parent/child relationships are clear, but we don't have access |
| 95 // to the rest of the tree for context, so we have to try to show the | 98 // to the rest of the tree for context, so we have to try to show the |
| 96 // relative indentation of child nodes in this update relative to their | 99 // relative indentation of child nodes in this update relative to their |
| 97 // parents. | 100 // parents. |
| 98 base::hash_map<int32, int> id_to_indentation; | 101 base::hash_map<int32_t, int> id_to_indentation; |
| 99 for (size_t i = 0; i < nodes.size(); ++i) { | 102 for (size_t i = 0; i < nodes.size(); ++i) { |
| 100 int indent = id_to_indentation[nodes[i].id]; | 103 int indent = id_to_indentation[nodes[i].id]; |
| 101 result += std::string(2 * indent, ' '); | 104 result += std::string(2 * indent, ' '); |
| 102 result += nodes[i].ToString() + "\n"; | 105 result += nodes[i].ToString() + "\n"; |
| 103 for (size_t j = 0; j < nodes[i].child_ids.size(); ++j) | 106 for (size_t j = 0; j < nodes[i].child_ids.size(); ++j) |
| 104 id_to_indentation[nodes[i].child_ids[j]] = indent + 1; | 107 id_to_indentation[nodes[i].child_ids[j]] = indent + 1; |
| 105 } | 108 } |
| 106 | 109 |
| 107 return result; | 110 return result; |
| 108 } | 111 } |
| 109 | 112 |
| 110 } // namespace ui | 113 } // namespace ui |
| 111 | 114 |
| 112 #endif // UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ | 115 #endif // UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ |
| OLD | NEW |