Bug 1543307: For out-of-process iframes on Windows, return the embedded document as a child of the OuterDocAccessible. r=eeejay

Windows accessibility clients talk directly to the content process via COM.
In order to expose an OOP iframe document accessible as a child of the embedder iframe accessible via COM, the embedder process needs a COM proxy for the iframe document accessible.
This is exposed on the embedder's BrowserBridgeChild, so we can use this when a client asks for the child of the OuterDocAccessible.

Differential Revision: https://phabricator.services.mozilla.com/D32281

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2019-05-23 19:54:37 +00:00
Родитель a23e2db32f
Коммит bffe0db8cf
2 изменённых файлов: 28 добавлений и 6 удалений

Просмотреть файл

@ -10,6 +10,9 @@
#include "DocAccessible-inl.h"
#include "mozilla/a11y/DocAccessibleChild.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#if defined(XP_WIN)
# include "mozilla/a11y/ProxyWrappers.h"
#endif
#include "mozilla/dom/BrowserBridgeChild.h"
#include "mozilla/dom/BrowserParent.h"
#include "Role.h"
@ -172,13 +175,33 @@ bool OuterDocAccessible::IsAcceptableChild(nsIContent* aEl) const {
#if defined(XP_WIN)
Accessible* OuterDocAccessible::RemoteChildDocAccessible() const {
ProxyAccessible* docProxy = RemoteChildDoc();
if (docProxy) {
// We're in the parent process, but we're embedding a remote document.
return WrapperFor(docProxy);
}
if (IPCAccessibilityActive()) {
auto bridge = dom::BrowserBridgeChild::GetFrom(mContent);
if (bridge) {
// We're an iframe in a content process and we're embedding a remote
// document (in another content process). The COM proxy for the embedded
// document accessible was sent to us from the parent via PBrowserBridge.
return bridge->GetEmbeddedDocAccessible();
}
}
return nullptr;
}
// On Windows e10s, since we don't cache in the chrome process, these next two
// functions must be implemented so that we properly cross the chrome-to-content
// boundary when traversing.
uint32_t OuterDocAccessible::ChildCount() const {
uint32_t result = mChildren.Length();
if (!result && RemoteChildDoc()) {
if (!result && RemoteChildDocAccessible()) {
result = 1;
}
return result;
@ -191,11 +214,7 @@ Accessible* OuterDocAccessible::GetChildAt(uint32_t aIndex) const {
}
// If we are asking for child 0 and GetChildAt doesn't return anything, try
// to get the remote child doc and return that instead.
ProxyAccessible* remoteChild = RemoteChildDoc();
if (!remoteChild) {
return nullptr;
}
return WrapperFor(remoteChild);
return RemoteChildDocAccessible();
}
#endif // defined(XP_WIN)

Просмотреть файл

@ -28,6 +28,9 @@ class OuterDocAccessible final : public AccessibleWrap {
NS_INLINE_DECL_REFCOUNTING_INHERITED(OuterDocAccessible, AccessibleWrap)
DocAccessibleParent* RemoteChildDoc() const;
#if defined(XP_WIN)
Accessible* RemoteChildDocAccessible() const;
#endif
// Accessible
virtual void Shutdown() override;