forked from mirrors/gecko-dev
Bug 1801986 - Set pivot root to top remote document. r=Jamie
The pivot should never cross from remote into parent process local containers. We need to explicitly set the root for the pivot, and assert for this in the pivot traversal methods. Differential Revision: https://phabricator.services.mozilla.com/D163285
This commit is contained in:
parent
92425f68a1
commit
f9fbfefda3
2 changed files with 23 additions and 1 deletions
|
|
@ -265,7 +265,18 @@ bool AccessibleWrap::DoAction(uint8_t aIndex) const {
|
|||
Accessible* AccessibleWrap::DoPivot(Accessible* aAccessible,
|
||||
int32_t aGranularity, bool aForward,
|
||||
bool aInclusive) {
|
||||
a11y::Pivot pivot(nullptr);
|
||||
Accessible* pivotRoot = nullptr;
|
||||
if (aAccessible->IsRemote()) {
|
||||
// If this is a remote accessible provide the top level
|
||||
// remote doc as the pivot root for thread safety reasons.
|
||||
DocAccessibleParent* doc = aAccessible->AsRemote()->Document();
|
||||
while (doc && !doc->IsTopLevel()) {
|
||||
doc = doc->ParentDoc();
|
||||
}
|
||||
MOZ_ASSERT(doc, "Failed to get top level DocAccessibleParent");
|
||||
pivotRoot = doc;
|
||||
}
|
||||
a11y::Pivot pivot(pivotRoot);
|
||||
// Depending on the start accessible, the pivot rule will either traverse
|
||||
// local or remote accessibles exclusively.
|
||||
TraversalRule rule(aGranularity, aAccessible->IsLocal());
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ Accessible* Pivot::SearchBackward(Accessible* aAnchor, PivotRule& aRule,
|
|||
|
||||
while (acc && acc != mRoot) {
|
||||
Accessible* parent = acc->Parent();
|
||||
#if defined(ANDROID)
|
||||
MOZ_ASSERT(
|
||||
acc->IsLocal() || (acc->IsRemote() && parent->IsRemote()),
|
||||
"Pivot::SearchBackward climbed out of remote subtree in Android!");
|
||||
#endif
|
||||
int32_t idxInParent = acc->IndexInParent();
|
||||
while (idxInParent > 0 && parent) {
|
||||
acc = parent->ChildAt(--idxInParent);
|
||||
|
|
@ -141,6 +146,12 @@ Accessible* Pivot::SearchForward(Accessible* aAnchor, PivotRule& aRule,
|
|||
break;
|
||||
}
|
||||
temp = temp->Parent();
|
||||
#if defined(ANDROID)
|
||||
MOZ_ASSERT(
|
||||
acc->IsLocal() || (acc->IsRemote() && temp->IsRemote()),
|
||||
"Pivot::SearchForward climbed out of remote subtree in Android!");
|
||||
#endif
|
||||
|
||||
} while (temp);
|
||||
|
||||
if (!sibling) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue