From ca0992482704d4e4f67c4dbcedd2a5908662b9c0 Mon Sep 17 00:00:00 2001 From: James Teh Date: Thu, 23 May 2019 18:14:39 +0000 Subject: [PATCH] Bug 1543298 part 1: Add a stub AccessibleWrap used in a Windows content process for an embedded document residing in another content process. r=eeejay For an out-of-process iframe, we need to be able to return a remote embedder accessible as a child of an OuterDocAccessible. For parent process OuterDocAccessibles, we use the ProxyAccessible for the embedded document. In the case of out-of-process iframes, there is no ProxyAccessible for the embedded document, since the iframe is in a content process and ProxyAccessibles only exist in the parent process. Like ProxyAccessibleWrap, the only real method that gets called is GetNativeInterface, which returns a COM proxy for the document. Differential Revision: https://phabricator.services.mozilla.com/D32278 --HG-- extra : moz-landing-system : lando --- accessible/windows/ProxyWrappers.h | 32 +++++++++++++++++++++++++++++- accessible/windows/moz.build | 3 +++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/accessible/windows/ProxyWrappers.h b/accessible/windows/ProxyWrappers.h index 10d1d45e0418..950128db9f96 100644 --- a/accessible/windows/ProxyWrappers.h +++ b/accessible/windows/ProxyWrappers.h @@ -8,7 +8,7 @@ #ifndef MOZILLA_A11Y_ProxyWrappers_h #define MOZILLA_A11Y_ProxyWrappers_h -#include "HyperTextAccessible.h" +#include "HyperTextAccessibleWrap.h" namespace mozilla { namespace a11y { @@ -79,6 +79,36 @@ inline ProxyAccessible* HyperTextProxyFor(T* aWrapper) { return wrapper->IsProxy() ? wrapper->Proxy() : nullptr; } +/** + * Stub AccessibleWrap used in a content process for an embedded document + * residing in another content process. + * There is no ProxyAccessible here, since those only exist in the parent + * process. However, like ProxyAccessibleWrap, the only real method that + * gets called is GetNativeInterface, which returns a COM proxy for the + * document. + */ +class RemoteIframeDocProxyAccessibleWrap : public HyperTextAccessibleWrap { + public: + explicit RemoteIframeDocProxyAccessibleWrap(IDispatch* aCOMProxy) + : HyperTextAccessibleWrap(nullptr, nullptr), mCOMProxy(aCOMProxy) { + mType = eProxyType; + mBits.proxy = nullptr; + } + + virtual void Shutdown() override { + mStateFlags |= eIsDefunct; + mCOMProxy = nullptr; + } + + virtual void GetNativeInterface(void** aOutAccessible) override { + RefPtr addRefed = mCOMProxy; + addRefed.forget(aOutAccessible); + } + + private: + RefPtr mCOMProxy; +}; + } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/moz.build b/accessible/windows/moz.build index 4bfa4f330fd2..4a62560a43c3 100644 --- a/accessible/windows/moz.build +++ b/accessible/windows/moz.build @@ -6,3 +6,6 @@ DIRS += ['msaa', 'ia2', 'sdn', 'uia'] +EXPORTS.mozilla.a11y += [ + 'ProxyWrappers.h', +]