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

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

Issue 2410503002: Merge to M53: Don't post events on internal nodes in the accessibility tree on Android. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2785_124
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8eba8783185354af7ded8041032f3f30a6cffa7b..421ea92610c582e4a5725fd77b1bdd99569c28e1 100644
--- a/content/browser/accessibility/browser_accessibility_manager_android.cc
+++ b/content/browser/accessibility/browser_accessibility_manager_android.cc
@@ -206,9 +206,6 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
if (obj.is_null())
return;
- BrowserAccessibilityAndroid* android_node =
- static_cast<BrowserAccessibilityAndroid*>(node);
-
if (event_type == ui::AX_EVENT_HIDE)
return;
@@ -225,6 +222,16 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
return;
}
+ // Sometimes we get events on nodes in our internal accessibility tree
+ // that aren't exposed on Android. Walk up the ancestors and update |node|
+ // to point to the highest ancestor that's a leaf node.
+ BrowserAccessibility* parent = node->GetParent();
+ while (parent) {
+ if (parent->PlatformChildCount() == 0)
+ node = parent;
+ parent = parent->GetParent();
+ }
+
// Always send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED to notify
// the Android system that the accessibility hierarchy rooted at this
// node has changed.
@@ -237,6 +244,8 @@ void BrowserAccessibilityManagerAndroid::NotifyAccessibilityEvent(
return;
}
+ BrowserAccessibilityAndroid* android_node =
+ static_cast<BrowserAccessibilityAndroid*>(node);
switch (event_type) {
case ui::AX_EVENT_LOAD_COMPLETE:
Java_BrowserAccessibilityManager_handlePageLoaded(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698