Supervised user SafeSites: Ignore trailing slash in URL path
[chromium-blink-merge.git] / ui / accessibility / ax_tree_update.cc
blob8e9d019349f3cb8fa72f86204f5cd5d15bd4da3d
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
3 // found in the LICENSE file.
5 #include "ui/accessibility/ax_tree_update.h"
7 #include "base/containers/hash_tables.h"
8 #include "base/strings/string_number_conversions.h"
10 namespace ui {
12 AXTreeUpdate::AXTreeUpdate() : node_id_to_clear(0) {
15 AXTreeUpdate::~AXTreeUpdate() {
18 std::string AXTreeUpdate::ToString() const {
19 std::string result;
20 if (node_id_to_clear != 0) {
21 result += "AXTreeUpdate: clear node " +
22 base::IntToString(node_id_to_clear) + "\n";
25 // The challenge here is that we want to indent the nodes being updated
26 // so that parent/child relationships are clear, but we don't have access
27 // to the rest of the tree for context, so we have to try to show the
28 // relative indentation of child nodes in this update relative to their
29 // parents.
30 base::hash_map<int32, int> id_to_indentation;
31 for (size_t i = 0; i < nodes.size(); ++i) {
32 int indent = id_to_indentation[nodes[i].id];
33 result += std::string(2 * indent, ' ');
34 result += nodes[i].ToString() + "\n";
35 for (size_t j = 0; j < nodes[i].child_ids.size(); ++j)
36 id_to_indentation[nodes[i].child_ids[j]] = indent + 1;
39 return result;
42 } // namespace ui