| Index: content/browser/accessibility/browser_accessibility_manager_android.cc
|
| diff --git a/content/browser/accessibility/browser_accessibility_manager_android.cc b/content/browser/accessibility/browser_accessibility_manager_android.cc
|
| index daf936951dabc3b405c8856ca872858cc58ca3e6..ad8e0dd2d3c4d94fd4c6ab5d63c63e06898ae065 100644
|
| --- a/content/browser/accessibility/browser_accessibility_manager_android.cc
|
| +++ b/content/browser/accessibility/browser_accessibility_manager_android.cc
|
| @@ -54,6 +54,24 @@ bool SectionPredicate(
|
| }
|
| }
|
|
|
| +bool AllInterestingNodesPredicate(
|
| + BrowserAccessibility* start, BrowserAccessibility* node) {
|
| + // Focusable nodes should never be skipped. Note that IsFocusable()
|
| + // already skips over things like iframes and child frames that are
|
| + // technically focusable but shouldn't be exposed as focusable on Android.
|
| + BrowserAccessibilityAndroid* android_node =
|
| + static_cast<BrowserAccessibilityAndroid*>(node);
|
| + if (android_node->IsFocusable())
|
| + return true;
|
| +
|
| + // If it's not focusable but has a control role, then it's interesting.
|
| + if (android_node->IsControl())
|
| + return true;
|
| +
|
| + // Otherwise, the interesting nodes are leaf nodes with text.
|
| + return node->PlatformIsLeaf() && !node->GetText().empty();
|
| +}
|
| +
|
| void AddToPredicateMap(const char* search_key_ascii,
|
| AccessibilityMatchPredicate predicate) {
|
| base::string16 search_key_utf16 = base::ASCIIToUTF16(search_key_ascii);
|
| @@ -105,14 +123,9 @@ AccessibilityMatchPredicate PredicateForSearchKey(
|
| if (iter != g_search_key_to_predicate_map.Get().end())
|
| return iter->second;
|
|
|
| - // If we don't recognize the selector, return any element that's clickable.
|
| - // We mark all focusable nodes and leaf nodes as clickable because it's
|
| - // impossible to know whether a web node has a click handler or not, so
|
| - // to be safe we have to allow accessibility services to click on nearly
|
| - // anything that could possibly respond to a click.
|
| - return [](BrowserAccessibility* start, BrowserAccessibility* node) {
|
| - return static_cast<BrowserAccessibilityAndroid*>(node)->IsClickable();
|
| - };
|
| + // If we don't recognize the selector, return any element that a
|
| + // screen reader should navigate to.
|
| + return AllInterestingNodesPredicate;
|
| }
|
|
|
| } // anonymous namespace
|
|
|