From f1b4e1aa1069b648c5930135f47a247aa317bbcc Mon Sep 17 00:00:00 2001 From: James Teh Date: Wed, 11 Oct 2017 15:30:22 +1000 Subject: [PATCH] Bug 1407475: Fix IAccessible::accNavigate(NAVRELATION_EMBEDS) for e10s. r=surkov When we only have a single process, this can be (and was previously) handled the same way as any other relation. However, for multi process, the normal relation mechanism doesn't work because it can't handle remote objects. This patch overrides accNavigate for the root accessible to handle this, since this is only ever used on the root. MozReview-Commit-ID: JLm5zITfG6Y --HG-- extra : rebase_source : 3666ffe699d861c06b763200e7d59fbd75a581ee --- .../windows/msaa/RootAccessibleWrap.cpp | 44 +++++++++++++++++++ accessible/windows/msaa/RootAccessibleWrap.h | 5 +++ 2 files changed, 49 insertions(+) diff --git a/accessible/windows/msaa/RootAccessibleWrap.cpp b/accessible/windows/msaa/RootAccessibleWrap.cpp index 4475844516c6..6e9c54089dfd 100644 --- a/accessible/windows/msaa/RootAccessibleWrap.cpp +++ b/accessible/windows/msaa/RootAccessibleWrap.cpp @@ -102,3 +102,47 @@ RootAccessibleWrap::DocumentActivated(DocAccessible* aDocument) } } } + +STDMETHODIMP +RootAccessibleWrap::accNavigate( + /* [in] */ long navDir, + /* [optional][in] */ VARIANT varStart, + /* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt) +{ + // Special handling for NAVRELATION_EMBEDS. + // When we only have a single process, this can be handled the same way as + // any other relation. + // However, for multi process, the normal relation mechanism doesn't work + // because it can't handle remote objects. + if (navDir != NAVRELATION_EMBEDS || + varStart.vt != VT_I4 || varStart.lVal != CHILDID_SELF) { + // We only handle EMBEDS on the root here. + // Forward to the base implementation. + return DocAccessibleWrap::accNavigate(navDir, varStart, pvarEndUpAt); + } + + if (!pvarEndUpAt) { + return E_INVALIDARG; + } + + Accessible* target = nullptr; + // Get the document in the active tab. + ProxyAccessible* docProxy = GetPrimaryRemoteTopLevelContentDoc(); + if (docProxy) { + target = WrapperFor(docProxy); + } else { + // The base implementation could handle this, but we may as well + // just handle it here. + Relation rel = RelationByType(RelationType::EMBEDS); + target = rel.Next(); + } + + if (!target) { + return E_FAIL; + } + + VariantInit(pvarEndUpAt); + pvarEndUpAt->pdispVal = NativeAccessible(target); + pvarEndUpAt->vt = VT_DISPATCH; + return S_OK; +} diff --git a/accessible/windows/msaa/RootAccessibleWrap.h b/accessible/windows/msaa/RootAccessibleWrap.h index 676b08eea6f7..96fee33a554e 100644 --- a/accessible/windows/msaa/RootAccessibleWrap.h +++ b/accessible/windows/msaa/RootAccessibleWrap.h @@ -38,6 +38,11 @@ public: */ already_AddRefed GetInternalUnknown(); + virtual /* [id] */ HRESULT STDMETHODCALLTYPE accNavigate( + /* [in] */ long navDir, + /* [optional][in] */ VARIANT varStart, + /* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt) override; + private: // DECLARE_AGGREGATABLE declares the internal IUnknown methods as well as // mInternalUnknown.