зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543313 part 1: Allow identification and retrieval of DocAccessibleParents at the top level of their content process. r=eeejay
DocAccessibleParent already has IsTopLevel(), which identifies a document at the top level of the hierarchy; i.e. it has no parents. Now that we have out-of-process iframes, we need to be able to identify and retrieve documents at the top level of their content process, even if they are embedded by another remote document. DocAccessibleParent::IsTopLevelInContentProcess() has been introduced to achieve this. BrowserParent::GetTopLevelDocAccessible() now uses this instead of IsTopLevel(), since we want to be able to get the top DocAccessibleParent even for a BrowserParent for an out-of-process iframe. Differential Revision: https://phabricator.services.mozilla.com/D32282 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b69c50a312
Коммит
80e4370a70
|
@ -36,6 +36,7 @@ class DocAccessibleParent : public ProxyAccessible,
|
|||
mEmulatedWindowHandle(nullptr),
|
||||
#endif // defined(XP_WIN)
|
||||
mTopLevel(false),
|
||||
mTopLevelInContentProcess(false),
|
||||
mShutdown(false) {
|
||||
sMaxDocID++;
|
||||
mActorID = sMaxDocID;
|
||||
|
@ -43,9 +44,27 @@ class DocAccessibleParent : public ProxyAccessible,
|
|||
LiveDocs().Put(mActorID, this);
|
||||
}
|
||||
|
||||
void SetTopLevel() { mTopLevel = true; }
|
||||
/**
|
||||
* Set this as a top level document; i.e. it is not embedded by another remote
|
||||
* document. This also means it is a top level document in its content
|
||||
* process.
|
||||
* Tab documents are top level documents.
|
||||
*/
|
||||
void SetTopLevel() {
|
||||
mTopLevel = true;
|
||||
mTopLevelInContentProcess = true;
|
||||
}
|
||||
bool IsTopLevel() const { return mTopLevel; }
|
||||
|
||||
/**
|
||||
* Set this as a top level document in its content process.
|
||||
* Note that this could be an out-of-process iframe embedded by a remote
|
||||
* embedder document. In that case, IsToplevel() will return false, but
|
||||
* IsTopLevelInContentProcess() will return true.
|
||||
*/
|
||||
void SetTopLevelInContentProcess() { mTopLevelInContentProcess = true; }
|
||||
bool IsTopLevelInContentProcess() const { return mTopLevelInContentProcess; }
|
||||
|
||||
bool IsShutdown() const { return mShutdown; }
|
||||
|
||||
/**
|
||||
|
@ -279,6 +298,7 @@ class DocAccessibleParent : public ProxyAccessible,
|
|||
nsTHashtable<ProxyEntry> mAccessibles;
|
||||
uint64_t mActorID;
|
||||
bool mTopLevel;
|
||||
bool mTopLevelInContentProcess;
|
||||
bool mShutdown;
|
||||
|
||||
static uint64_t sMaxDocID;
|
||||
|
|
|
@ -415,7 +415,11 @@ a11y::DocAccessibleParent* BrowserParent::GetTopLevelDocAccessible() const {
|
|||
ManagedPDocAccessibleParent();
|
||||
for (auto iter = docs.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto doc = static_cast<a11y::DocAccessibleParent*>(iter.Get()->GetKey());
|
||||
if (doc->IsTopLevel()) {
|
||||
// We want the document for this BrowserParent even if it's for an
|
||||
// embedded out-of-process iframe. Therefore, we use
|
||||
// IsTopLevelInContentProcess. In contrast, using IsToplevel would only
|
||||
// include documents that aren't embedded; e.g. tab documents.
|
||||
if (doc->IsTopLevelInContentProcess()) {
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
|
@ -1126,6 +1130,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
|
|||
// In this case, we don't get aParentDoc and aParentID.
|
||||
MOZ_ASSERT(!aParentDoc && !aParentID);
|
||||
MOZ_ASSERT(embedderID);
|
||||
doc->SetTopLevelInContentProcess();
|
||||
# ifdef XP_WIN
|
||||
MOZ_ASSERT(!aDocCOMProxy.IsNull());
|
||||
RefPtr<IAccessible> proxy(aDocCOMProxy.Get());
|
||||
|
|
|
@ -162,7 +162,12 @@ class BrowserParent final : public PBrowserParent,
|
|||
nsIXULBrowserWindow* GetXULBrowserWindow();
|
||||
|
||||
/**
|
||||
* Return the top level doc accessible parent for this tab.
|
||||
* Return the top level DocAccessibleParent for this BrowserParent.
|
||||
* Note that in the case of an out-of-process iframe, the returned actor
|
||||
* might not be at the top level of the DocAccessibleParent tree; i.e. it
|
||||
* might have a parent. However, it will be at the top level in its content
|
||||
* process. That is, doc->IsTopLevelInContentProcess() will always be true,
|
||||
* but doc->IsTopLevel() might not.
|
||||
*/
|
||||
a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче