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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java

Issue 2264103003: Implement support for accessible collapse and expand actions on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cut_copy_paste
Patch Set: Created 4 years, 4 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/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
index fd77ec37dc708b1a1e8eac450b0a6398f5511b59..e78877d3185e26f51c6c6a6c2be261de9a8af869 100644
--- a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
+++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
@@ -37,6 +37,10 @@ import java.util.Locale;
public class BrowserAccessibilityManager {
private static final String TAG = "BrowserAccessibilityManager";
+ // Constants from AccessibilityNodeInfo defined in the K SDK.
+ private static final int ACTION_COLLAPSE = 0x00080000;
+ private static final int ACTION_EXPAND = 0x00040000;
+
// Constants from AccessibilityNodeInfo defined in the L SDK.
private static final int ACTION_SET_TEXT = 0x200000;
private static final String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE =
@@ -319,6 +323,11 @@ public class BrowserAccessibilityManager {
return true;
}
return false;
+ case AccessibilityNodeInfo.ACTION_COLLAPSE:
+ case AccessibilityNodeInfo.ACTION_EXPAND:
+ // If something is collapsible or expandable, just activate it to toggle.
+ nativeClick(mNativeObj, virtualViewId);
+ return true;
default:
break;
}
@@ -807,7 +816,7 @@ public class BrowserAccessibilityManager {
int virtualViewId, boolean canScrollForward, boolean canScrollBackward,
boolean canScrollUp, boolean canScrollDown, boolean canScrollLeft,
boolean canScrollRight, boolean clickable, boolean editableText, boolean enabled,
- boolean focusable, boolean focused) {
+ boolean focusable, boolean focused, boolean isCollapsed, boolean isExpanded) {
node.addAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT);
node.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT);
node.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);
@@ -849,6 +858,14 @@ public class BrowserAccessibilityManager {
if (clickable) {
node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
}
+
+ if (isCollapsed) {
+ node.addAction(ACTION_EXPAND);
+ }
+
+ if (isExpanded) {
+ node.addAction(ACTION_COLLAPSE);
+ }
}
@CalledByNative

Powered by Google App Engine
This is Rietveld 408576698