summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshreeram.k <shreeram.k@samsung.com>2015-04-27 23:32:52 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-28 06:32:47 +0000
commite0ee113f5020a7d514b68e1556fd7f080c232d87 (patch)
treee6bfd4878215113c5c210b58d0ba668723e52e55
parentd4d2fc18bd3c078917e0ab952a786947a4daff27 (diff)
downloadchromium_src-e0ee113f5020a7d514b68e1556fd7f080c232d87.zip
chromium_src-e0ee113f5020a7d514b68e1556fd7f080c232d87.tar.gz
chromium_src-e0ee113f5020a7d514b68e1556fd7f080c232d87.tar.bz2
Add option to not dump childrens of a node in AX Tree.
This would be useful in cases when on the same platform due to different version, AX tree may vary. Please check below mentioned bug id for such kind of example. BUG=423675 Review URL: https://codereview.chromium.org/844273002 Cr-Commit-Position: refs/heads/master@{#327238}
-rw-r--r--content/browser/accessibility/accessibility_tree_formatter.cc4
-rw-r--r--content/test/data/accessibility/html/input-date-expected-android.txt2
-rw-r--r--content/test/data/accessibility/html/input-date-expected-win.txt13
-rw-r--r--content/test/data/accessibility/html/input-date.html2
4 files changed, 7 insertions, 14 deletions
diff --git a/content/browser/accessibility/accessibility_tree_formatter.cc b/content/browser/accessibility/accessibility_tree_formatter.cc
index 1f56cd4..2ca2a85 100644
--- a/content/browser/accessibility/accessibility_tree_formatter.cc
+++ b/content/browser/accessibility/accessibility_tree_formatter.cc
@@ -20,6 +20,7 @@ namespace {
const char kIndentSymbol = '+';
const int kIndentSymbolCount = 2;
const char* kSkipString = "@NO_DUMP";
+const char* kSkipChildren = "@NO_CHILDREN_DUMP";
const char* kChildrenDictAttr = "children";
}
@@ -84,6 +85,9 @@ void AccessibilityTreeFormatter::RecursiveFormatAccessibilityTree(
return;
*contents += line + base::ASCIIToUTF16("\n");
+ if (line.find(base::ASCIIToUTF16(kSkipChildren)) != base::string16::npos)
+ return;
+
const base::ListValue* children;
dict.GetList(kChildrenDictAttr, &children);
const base::DictionaryValue* child_dict;
diff --git a/content/test/data/accessibility/html/input-date-expected-android.txt b/content/test/data/accessibility/html/input-date-expected-android.txt
index 30dea11..cea0932 100644
--- a/content/test/data/accessibility/html/input-date-expected-android.txt
+++ b/content/test/data/accessibility/html/input-date-expected-android.txt
@@ -1,3 +1,3 @@
android.webkit.WebView focusable focused scrollable
++android.view.View
-++++android.widget.Spinner clickable focusable name='2008-09-01' input_type=20
+++++android.widget.Spinner clickable focusable name='@NO_CHILDREN_DUMP' input_type=20
diff --git a/content/test/data/accessibility/html/input-date-expected-win.txt b/content/test/data/accessibility/html/input-date-expected-win.txt
index 79f3ccf..f8879c9 100644
--- a/content/test/data/accessibility/html/input-date-expected-win.txt
+++ b/content/test/data/accessibility/html/input-date-expected-win.txt
@@ -1,14 +1,3 @@
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_SECTION
-++++IA2_ROLE_DATE_EDITOR FOCUSABLE
-++++++IA2_ROLE_SECTION
-++++++++IA2_ROLE_SECTION
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Month' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name='/'
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Day' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name='/'
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' FOCUSABLE
-++++++ROLE_SYSTEM_BUTTONMENU FOCUSABLE
-++++++ROLE_SYSTEM_SPINBUTTON
-++++++++ROLE_SYSTEM_PUSHBUTTON
-++++++++ROLE_SYSTEM_PUSHBUTTON
+++++IA2_ROLE_DATE_EDITOR name='@NO_CHILDREN_DUMP' FOCUSABLE
diff --git a/content/test/data/accessibility/html/input-date.html b/content/test/data/accessibility/html/input-date.html
index 3546b0a..ca24acb 100644
--- a/content/test/data/accessibility/html/input-date.html
+++ b/content/test/data/accessibility/html/input-date.html
@@ -5,7 +5,7 @@
<html>
<body>
- <input type="date" value="2008-09-01">
+ <input aria-label="@NO_CHILDREN_DUMP" type="date" value="2008-09-01">
</body>
</html>