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

Unified Diff: content/browser/accessibility/browser_accessibility_android.cc

Issue 1182783008: Add an option to not prune the Android AX tree, to preserve more style info. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@style_info_sgurun
Patch Set: Un-disable tests Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/browser_accessibility_android.cc
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc
index f4a2d86fc3749d32eb1d1c162b326130d86f947e..0efb78f16ed0fe61f3b6dd2f52cc21d04118f372 100644
--- a/content/browser/accessibility/browser_accessibility_android.cc
+++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -81,18 +81,22 @@ bool BrowserAccessibilityAndroid::PlatformIsLeaf() const {
if (GetRole() == ui::AX_ROLE_DATE || GetRole() == ui::AX_ROLE_INPUT_TIME)
return true;
- // Headings with text can drop their children.
- base::string16 name = GetText();
- if (GetRole() == ui::AX_ROLE_HEADING && !name.empty())
- return true;
+ BrowserAccessibilityManagerAndroid* manager_android =
+ static_cast<BrowserAccessibilityManagerAndroid*>(manager());
+ if (manager_android->prune_tree_for_screen_reader()) {
+ // Headings with text can drop their children.
+ base::string16 name = GetText();
+ if (GetRole() == ui::AX_ROLE_HEADING && !name.empty())
+ return true;
- // Focusable nodes with text can drop their children.
- if (HasState(ui::AX_STATE_FOCUSABLE) && !name.empty())
- return true;
+ // Focusable nodes with text can drop their children.
+ if (HasState(ui::AX_STATE_FOCUSABLE) && !name.empty())
+ return true;
- // Nodes with only static text as children can drop their children.
- if (HasOnlyStaticTextChildren())
- return true;
+ // Nodes with only static text as children can drop their children.
+ if (HasOnlyStaticTextChildren())
+ return true;
+ }
return BrowserAccessibility::PlatformIsLeaf();
}

Powered by Google App Engine
This is Rietveld 408576698