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

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

Issue 2893683002: Selection follows focus/activedescendant in single selection containers (Closed)
Patch Set: Last test to fix we hope Created 3 years, 7 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 fd0bab70144f0a8f95c61b7533cc33c9d88387a2..499c2a2c31c52f773988fcb74974f1314de609f8 100644
--- a/content/browser/accessibility/browser_accessibility_android.cc
+++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -105,10 +105,6 @@ bool BrowserAccessibilityAndroid::PlatformIsLeaf() const {
return false;
}
- // If it has a focusable child, we definitely can't leave out children.
- if (HasFocusableChild())
- return false;
-
// Date and time controls should drop their children.
switch (GetRole()) {
case ui::AX_ROLE_DATE:
@@ -119,6 +115,10 @@ bool BrowserAccessibilityAndroid::PlatformIsLeaf() const {
break;
}
+ // If it has a focusable child, we definitely can't leave out children.
+ if (HasFocusableNonOptionChild())
+ return false;
+
BrowserAccessibilityManagerAndroid* manager_android =
static_cast<BrowserAccessibilityManagerAndroid*>(manager());
if (manager_android->prune_tree_for_screen_reader()) {
@@ -1332,14 +1332,16 @@ void BrowserAccessibilityAndroid::GetWordBoundaries(
}
}
-bool BrowserAccessibilityAndroid::HasFocusableChild() const {
+bool BrowserAccessibilityAndroid::HasFocusableNonOptionChild() const {
// This is called from PlatformIsLeaf, so don't call PlatformChildCount
// from within this!
for (uint32_t i = 0; i < InternalChildCount(); i++) {
BrowserAccessibility* child = InternalGetChild(i);
- if (child->HasState(ui::AX_STATE_FOCUSABLE))
+ if (child->HasState(ui::AX_STATE_FOCUSABLE) &&
+ child->GetRole() != ui::AX_ROLE_MENU_LIST_OPTION)
return true;
- if (static_cast<BrowserAccessibilityAndroid*>(child)->HasFocusableChild())
+ if (static_cast<BrowserAccessibilityAndroid*>(child)
+ ->HasFocusableNonOptionChild())
return true;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698