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

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: add missing files 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 void DumpAccessibilityTreeHelper::DumpAccessibilityTree(
10 BrowserAccessibility* node, string16* contents) {
11 RecursiveDumpAccessibilityTree(node, contents, 0);
12 }
13
David Tseng 2012/03/06 23:49:05 nit: extra line.
dmazzoni 2012/03/08 07:10:37 Done.
14
15 void DumpAccessibilityTreeHelper::RecursiveDumpAccessibilityTree(
16 BrowserAccessibility* node, string16* contents, int indent) {
17 scoped_array<char> prefix(new char(indent + 1));
18 for (int i = 0; i < indent; i++)
David Tseng 2012/03/06 23:49:05 nit: ++i
dmazzoni 2012/03/08 07:10:37 Done.
19 prefix[i] = ' ';
20 prefix[indent] = 0;
David Tseng 2012/03/06 23:49:05 nit: 0 -> NULL for clearity?
dmazzoni 2012/03/08 07:10:37 I think NULL is only supposed to be for pointers.
21
22 *contents += ToString(node, prefix.get());
23 for (size_t i = 0; i < node->children().size(); ++i) {
24 RecursiveDumpAccessibilityTree(node->children()[i], contents, indent + 4);
David Tseng 2012/03/06 23:49:05 nit: define the indent step as a constant somewher
dmazzoni 2012/03/08 07:10:37 Done.
25 }
26 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698