зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1520611 - Prune children in Android. r=yzen
Differential Revision: https://phabricator.services.mozilla.com/D16743 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0ed303a220
Коммит
e63779903d
|
@ -581,15 +581,20 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -399,11 +399,21 @@ bool nsAccUtils::MustPrune(AccessibleOrProxy aAccessible) {
|
|||
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;
|
||||
|
|
|
@ -839,12 +839,9 @@ class AccessibilityTest : BaseSessionTest() {
|
|||
|
||||
val buttonNode = createNodeInfo(rootNode.getChildId(2))
|
||||
assertThat("Last node is a button", buttonNode.className.toString(), equalTo("android.widget.Button"))
|
||||
assertThat("Button has a single text leaf", buttonNode.childCount, equalTo(1))
|
||||
// The child text leaf is pruned, so this button is childless.
|
||||
assertThat("Button has a single text leaf", buttonNode.childCount, equalTo(0))
|
||||
assertThat("Button has correct text", buttonNode.text.toString(), equalTo("Submit"))
|
||||
|
||||
val textLeaf = createNodeInfo(buttonNode.getChildId(0))
|
||||
assertThat("First node is a label", textLeaf.className.toString(), equalTo("android.view.View"))
|
||||
assertThat("Text leaf has correct text", textLeaf.text.toString(), equalTo("Submit"))
|
||||
}
|
||||
|
||||
@Setting(key = Setting.Key.FULL_ACCESSIBILITY_TREE, value = "true")
|
||||
|
|
Загрузка…
Ссылка в новой задаче