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

Side by Side Diff: ui/accessibility/ax_tree_update.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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/ax_tree_update.h ('k') | ui/accessibility/ax_view_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "ui/accessibility/ax_tree_update.h"
6
7 #include "base/containers/hash_tables.h"
8 #include "base/strings/string_number_conversions.h"
9
10 namespace ui {
11
12 AXTreeUpdate::AXTreeUpdate() : node_id_to_clear(0) {
13 }
14
15 AXTreeUpdate::~AXTreeUpdate() {
16 }
17
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";
23 }
24
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;
37 }
38
39 return result;
40 }
41
42 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_tree_update.h ('k') | ui/accessibility/ax_view_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698