Bug 1774197 part 2: Don't include the document in the viewport cache. r=morgan

Sometimes, the document occurs too early in the viewport cache, perhaps even right at the start.
We weren't benefitting from it being in the cache anyway, since we always skipped it.
We already have a fallback in ChildAtPoint for the case where we didn't find a matching Accessible, so we rely on that to handle returning the document when appropriate.

Differential Revision: https://phabricator.services.mozilla.com/D149493
This commit is contained in:
James Teh 2022-06-23 04:57:04 +00:00
parent d73cd7641e
commit e03a5619fd
2 changed files with 5 additions and 11 deletions

View File

@ -3236,7 +3236,11 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
}
LocalAccessible* acc = doc->GetAccessibleOrContainer(content);
if (!acc) {
// The document is sometimes placed too early in the list, which would
// cause us to return the document instead of the correct descendant.
// We skip the document here and handle it as a fallback when hit
// testing.
if (!acc || acc == mDoc) {
continue;
}

View File

@ -346,16 +346,6 @@ Accessible* RemoteAccessibleBase<Derived>::ChildAtPoint(
break;
}
if (acc == doc) {
// If we're already in `doc`s viewport cache, and the doc is
// not the acc this call originated on, skip it.
// We have to have `doc` in this list, because we need to support
// calling `doc->ChildAtPoint()`. Without this check, we end up
// calling `doc->ChildAtPoint(...)` below which changes the context of
// this call.
continue;
}
if (acc->Bounds().Contains(aX, aY)) {
if (acc->IsDoc()) {
// If we encounter a doc, search its viewport