Bug 1520611 - Prune children in Android. r=yzen
☠☠ backed out by d646b0735ba3 ☠ ☠
authorEitan Isaacson <eitan@monotonous.org>
Tue, 22 Jan 2019 19:49:05 +0000
changeset 514863 0a48519a9ad1c62caf6d7fa056ce689070f67d81
parent 514862 1fea939a7e7c43c4fdc3430cf9815911f9c8f3b8
child 514864 3bf9f045d452667c73dca317118fb56202437c41
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1520611
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520611 - Prune children in Android. r=yzen Differential Revision: https://phabricator.services.mozilla.com/D16743
accessible/android/AccessibleWrap.cpp
accessible/base/nsAccUtils.cpp
--- a/accessible/android/AccessibleWrap.cpp
+++ b/accessible/android/AccessibleWrap.cpp
@@ -576,21 +576,26 @@ mozilla::java::GeckoBundle::LocalRef Acc
         }
 
         GECKOBUNDLE_FINISH(collectionInfo);
         GECKOBUNDLE_PUT(nodeInfo, "collectionInfo", collectionInfo);
       }
     }
   }
 
-  auto childCount = ChildCount();
-  nsTArray<int32_t> children(childCount);
-  for (uint32_t i = 0; i < childCount; i++) {
-    auto child = static_cast<AccessibleWrap*>(GetChildAt(i));
-    children.AppendElement(child->VirtualViewID());
+  bool mustPrune =
+      IsProxy() ? nsAccUtils::MustPrune(Proxy()) : nsAccUtils::MustPrune(this);
+  if (!mustPrune) {
+    auto childCount = ChildCount();
+    nsTArray<int32_t> children(childCount);
+    for (uint32_t i = 0; i < childCount; i++) {
+      auto child = static_cast<AccessibleWrap*>(GetChildAt(i));
+      children.AppendElement(child->VirtualViewID());
+    }
+
+    GECKOBUNDLE_PUT(nodeInfo, "children",
+                    jni::IntArray::New(children.Elements(), children.Length()));
   }
 
-  GECKOBUNDLE_PUT(nodeInfo, "children",
-                  jni::IntArray::New(children.Elements(), children.Length()));
   GECKOBUNDLE_FINISH(nodeInfo);
 
   return nodeInfo;
 }
--- a/accessible/base/nsAccUtils.cpp
+++ b/accessible/base/nsAccUtils.cpp
@@ -394,21 +394,31 @@ bool nsAccUtils::MustPrune(AccessibleOrP
   roles::Role role = aAccessible.Role();
 
   if (role == roles::SLIDER) {
     // Always prune the tree for sliders, as it doesn't make sense for a
     // slider to have descendants and this confuses NVDA.
     return true;
   }
 
+#if defined(ANDROID)
+  if (role == roles::LINK) {
+    // Always prune links in Android
+    return true;
+  }
+#endif
+
   if (role != roles::MENUITEM && role != roles::COMBOBOX_OPTION &&
       role != roles::OPTION && role != roles::ENTRY &&
       role != roles::FLAT_EQUATION && role != roles::PASSWORD_TEXT &&
       role != roles::PUSHBUTTON && role != roles::TOGGLE_BUTTON &&
       role != roles::GRAPHIC && role != roles::PROGRESSBAR &&
+#if defined(ANDROID)
+      role != roles::HEADING &&
+#endif
       role != roles::SEPARATOR) {
     // If it doesn't match any of these roles, don't prune its children.
     return false;
   }
 
   if (aAccessible.ChildCount() != 1) {
     // If the accessible has more than one child, don't prune it.
     return false;