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

Side by Side Diff: content/browser/accessibility/dump_accessibility_tree_helper.cc

Issue 9617019: Improve formatting of accessibility tests that dump the tree. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Linux build error, tolerate different line endings Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "content/browser/accessibility/dump_accessibility_tree_helper.h"
6
7 #include "base/memory/scoped_ptr.h"
8
9 namespace {
10 const int kIndentSpaces = 4;
11 }
12
13 void DumpAccessibilityTreeHelper::DumpAccessibilityTree(
14 BrowserAccessibility* node, string16* contents) {
15 RecursiveDumpAccessibilityTree(node, contents, 0);
16 }
17
18 void DumpAccessibilityTreeHelper::RecursiveDumpAccessibilityTree(
19 BrowserAccessibility* node, string16* contents, int indent) {
20 scoped_array<char> prefix(new char[indent + 1]);
21 for (int i = 0; i < indent; ++i)
22 prefix[i] = ' ';
23 prefix[indent] = '\0';
24
25 *contents += ToString(node, prefix.get());
26 for (size_t i = 0; i < node->children().size(); ++i) {
27 RecursiveDumpAccessibilityTree(node->children()[i], contents,
28 indent + kIndentSpaces);
29 }
30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698