mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Bug 1649253: Correctly assign an Android a11y id to OOP iframe documents. r=eeejay
The DocProxyAccessibleWrap for an OOP iframe document is always created before we know its parent. Previously, this resulted in the document getting an id of -1, which is only valid for the root document. It also broke subsequent assumptions once the parent was set later. Because we don't have the parent in this case, we can't add the document's id to its parent's hash table. To deal with this, we no longer add any document to its parent's hash table. Instead, when finding an accessible by id, we just check the id of each child document before checking that child document's hash table. Differential Revision: https://phabricator.services.mozilla.com/D81959
This commit is contained in:
parent
b14bb7b621
commit
b9c87a600d
@ -93,21 +93,18 @@ class DocProxyAccessibleWrap : public ProxyAccessibleWrap {
|
||||
: ProxyAccessibleWrap(aProxy) {
|
||||
mGenericTypes |= eDocument;
|
||||
|
||||
if (auto parent = ParentDocument()) {
|
||||
mID = AcquireID();
|
||||
parent->AddID(mID, this);
|
||||
} else {
|
||||
// top level
|
||||
if (aProxy->IsTopLevel()) {
|
||||
mID = kNoID;
|
||||
} else {
|
||||
mID = AcquireID();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Shutdown() override {
|
||||
if (mID) {
|
||||
auto parent = ParentDocument();
|
||||
if (parent) {
|
||||
MOZ_ASSERT(mID != kNoID, "A non root accessible always has a parent");
|
||||
parent->RemoveID(mID);
|
||||
auto doc = static_cast<DocAccessibleParent*>(Proxy());
|
||||
if (!doc->IsTopLevel()) {
|
||||
MOZ_ASSERT(mID != kNoID, "A non root accessible must have an id");
|
||||
ReleaseID(mID);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,12 @@ AccessibleWrap* RootAccessibleWrap::FindAccessibleById(
|
||||
if (!child) {
|
||||
break;
|
||||
}
|
||||
acc = FindAccessibleById(child, aID);
|
||||
// A child document's id is not in its parent document's hash table.
|
||||
if (child->VirtualViewID() == aID) {
|
||||
acc = child;
|
||||
} else {
|
||||
acc = FindAccessibleById(child, aID);
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
|
Loading…
Reference in New Issue
Block a user