зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
b14bb7b621
Коммит
b9c87a600d
|
@ -93,21 +93,18 @@ class DocProxyAccessibleWrap : public ProxyAccessibleWrap {
|
||||||
: ProxyAccessibleWrap(aProxy) {
|
: ProxyAccessibleWrap(aProxy) {
|
||||||
mGenericTypes |= eDocument;
|
mGenericTypes |= eDocument;
|
||||||
|
|
||||||
if (auto parent = ParentDocument()) {
|
if (aProxy->IsTopLevel()) {
|
||||||
mID = AcquireID();
|
|
||||||
parent->AddID(mID, this);
|
|
||||||
} else {
|
|
||||||
// top level
|
|
||||||
mID = kNoID;
|
mID = kNoID;
|
||||||
|
} else {
|
||||||
|
mID = AcquireID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Shutdown() override {
|
virtual void Shutdown() override {
|
||||||
if (mID) {
|
if (mID) {
|
||||||
auto parent = ParentDocument();
|
auto doc = static_cast<DocAccessibleParent*>(Proxy());
|
||||||
if (parent) {
|
if (!doc->IsTopLevel()) {
|
||||||
MOZ_ASSERT(mID != kNoID, "A non root accessible always has a parent");
|
MOZ_ASSERT(mID != kNoID, "A non root accessible must have an id");
|
||||||
parent->RemoveID(mID);
|
|
||||||
ReleaseID(mID);
|
ReleaseID(mID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,12 @@ AccessibleWrap* RootAccessibleWrap::FindAccessibleById(
|
||||||
if (!child) {
|
if (!child) {
|
||||||
break;
|
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;
|
return acc;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче