Bug 1675301 - Don't return web area as result when searching backwards from root group. r=morgan

It seems that VO mistakenly thinks the web area is a descendant of itself. This causes all kinds of cyclical parent child relationships that makes VO over-query us.

This patch remedies that by not returning the web area when do an immediate child search starting from the root group - in any direction.

Differential Revision: https://phabricator.services.mozilla.com/D97819
This commit is contained in:
Eitan Isaacson 2020-11-21 04:14:44 +00:00
Родитель cf517da0a4
Коммит 1624b5c00a
2 изменённых файлов: 18 добавлений и 27 удалений

Просмотреть файл

@ -120,32 +120,24 @@ using namespace mozilla::a11y;
RotorRule rule =
mImmediateDescendantsOnly ? RotorRule(geckoRootAcc) : RotorRule();
if (mSearchForward) {
if ([mStartElem isKindOfClass:[MOXWebAreaAccessible class]]) {
if (id rootGroup =
[static_cast<MOXWebAreaAccessible*>(mStartElem) rootGroup]) {
// Moving forward from web area, rootgroup; if it exists, is next.
[matches addObject:rootGroup];
if (mResultLimit == 1) {
// Found one match, continue in search keys for block.
continue;
}
if ([mStartElem isKindOfClass:[MOXWebAreaAccessible class]]) {
if (id rootGroup =
[static_cast<MOXWebAreaAccessible*>(mStartElem) rootGroup]) {
// Moving forward from web area, rootgroup; if it exists, is next.
[matches addObject:rootGroup];
if (mResultLimit == 1) {
// Found one match, continue in search keys for block.
continue;
}
} else if (mImmediateDescendantsOnly && mStartElem != mRoot &&
[mStartElem isKindOfClass:[MOXRootGroup class]]) {
// Moving forward from root group. If we don't match descendants,
// there is no match. Continue.
continue;
}
} else if (!mSearchForward &&
[mStartElem isKindOfClass:[MOXRootGroup class]]) {
// Moving backward from root group. Web area is next.
[matches addObject:[mStartElem moxParent]];
if (mResultLimit == 1) {
// Found one match, continue in search keys for block.
continue;
}
}
if (mImmediateDescendantsOnly && mStartElem != mRoot &&
[mStartElem isKindOfClass:[MOXRootGroup class]]) {
// Moving forward from root group. If we don't match descendants,
// there is no match. Continue.
continue;
}
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
}

Просмотреть файл

@ -1040,11 +1040,10 @@ addAccessibleTask(
"AXUIElementsForSearchPredicate",
NSDictionary(searchPred)
);
is(results.length, 1, "WebArea is before root group");
is(
results[0].getAttributeValue("AXRole"),
"AXWebArea",
"Got web area accessible"
results.length,
0,
"Searching backwards from root group should yield no results"
);
const rootGroup = webArea.getAttributeValue("AXChildren")[0];