зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268544: Integrate remote COM objects into a11y code; r=tbsaunde
MozReview-Commit-ID: ctPgegQ83a
This commit is contained in:
Родитель
723aa5c481
Коммит
7debf7c239
|
@ -515,6 +515,11 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
|||
docAcc->SetIPCDoc(ipcDoc);
|
||||
static_cast<TabChild*>(tabChild.get())->
|
||||
SendPDocAccessibleConstructor(ipcDoc, nullptr, 0);
|
||||
|
||||
#if defined(XP_WIN)
|
||||
IAccessibleHolder holder(CreateHolderFromAccessible(docAcc));
|
||||
ipcDoc->SendCOMProxy(holder);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,6 +420,10 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
|
|||
if (tabChild) {
|
||||
static_cast<TabChild*>(tabChild.get())->
|
||||
SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id);
|
||||
#if defined(XP_WIN)
|
||||
IAccessibleHolder holder(CreateHolderFromAccessible(childDoc));
|
||||
ipcDoc->SendCOMProxy(holder);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_Platform_h
|
||||
#define mozilla_a11y_Platform_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class nsString;
|
||||
|
@ -82,3 +85,4 @@ void ProxySelectionEvent(ProxyAccessible* aTarget, ProxyAccessible* aWidget,
|
|||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_a11y_Platform_h
|
||||
|
|
|
@ -63,6 +63,18 @@ LOCAL_INCLUDES += [
|
|||
'/accessible/generic',
|
||||
'/accessible/html',
|
||||
'/accessible/ipc',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/ipc/win',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/ipc/other',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/xpcom',
|
||||
'/accessible/xul',
|
||||
'/dom/base',
|
||||
|
|
|
@ -482,7 +482,6 @@ DocAccessibleParent::RecvCOMProxy(const IAccessibleHolder& aCOMProxy,
|
|||
SetCOMInterface(ptr);
|
||||
|
||||
Accessible* outerDoc = OuterDocOfRemoteBrowser();
|
||||
MOZ_ASSERT(outerDoc);
|
||||
IAccessible* rawNative = nullptr;
|
||||
if (outerDoc) {
|
||||
outerDoc->GetNativeInterface((void**) &rawNative);
|
||||
|
|
|
@ -7,14 +7,22 @@
|
|||
#include "DocAccessibleChild.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "mozilla/a11y/PlatformChild.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
static StaticAutoPtr<PlatformChild> sPlatformChild;
|
||||
|
||||
DocAccessibleChild::DocAccessibleChild(DocAccessible* aDoc)
|
||||
: DocAccessibleChildBase(aDoc)
|
||||
{
|
||||
MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
|
||||
if (!sPlatformChild) {
|
||||
sPlatformChild = new PlatformChild();
|
||||
ClearOnShutdown(&sPlatformChild, ShutdownPhase::Shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
DocAccessibleChild::~DocAccessibleChild()
|
||||
|
@ -28,7 +36,6 @@ DocAccessibleChild::SendCOMProxy(const IAccessibleHolder& aProxy)
|
|||
IAccessibleHolder parentProxy;
|
||||
PDocAccessibleChild::SendCOMProxy(aProxy, &parentProxy);
|
||||
mParentProxy.reset(parentProxy.Release());
|
||||
MOZ_ASSERT(mParentProxy);
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/a11y/PlatformChild.h"
|
||||
#include "mozilla/mscom/EnsureMTA.h"
|
||||
#include "mozilla/mscom/InterceptorLog.h"
|
||||
|
||||
#include "Accessible2.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Unfortunately the COM interceptor does not intrinsically handle array
|
||||
* outparams. Instead we manually define the relevant metadata here, and
|
||||
* register it in a call to mozilla::mscom::RegisterArrayData.
|
||||
* @see mozilla::mscom::ArrayData
|
||||
*/
|
||||
static const mozilla::mscom::ArrayData sPlatformChildArrayData[] = {
|
||||
{IID_IEnumVARIANT, 3, 1, VT_DISPATCH, IID_IDispatch, 2},
|
||||
{IID_IAccessible2, 30, 1, VT_UNKNOWN | VT_BYREF, IID_IAccessibleRelation, 2},
|
||||
{IID_IAccessibleRelation, 7, 1, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 2}
|
||||
};
|
||||
|
||||
// Type libraries are thread-neutral, so we can register those from any
|
||||
// apartment. OTOH, proxies must be registered from within the apartment where
|
||||
// we intend to instantiate them. Therefore RegisterProxy() must be called
|
||||
// via EnsureMTA.
|
||||
PlatformChild::PlatformChild()
|
||||
: mAccTypelib(mozilla::mscom::RegisterTypelib(L"oleacc.dll",
|
||||
mozilla::mscom::RegistrationFlags::eUseSystemDirectory))
|
||||
, mMiscTypelib(mozilla::mscom::RegisterTypelib(L"Accessible.tlb"))
|
||||
{
|
||||
mozilla::mscom::InterceptorLog::Init();
|
||||
mozilla::mscom::RegisterArrayData(sPlatformChildArrayData);
|
||||
|
||||
UniquePtr<mozilla::mscom::RegisteredProxy> ia2Proxy;
|
||||
mozilla::mscom::EnsureMTA([&ia2Proxy]() -> void {
|
||||
ia2Proxy = Move(mozilla::mscom::RegisterProxy(L"ia2marshal.dll"));
|
||||
});
|
||||
mIA2Proxy = Move(ia2Proxy);
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_PlatformChild_h
|
||||
#define mozilla_a11y_PlatformChild_h
|
||||
|
||||
#include "mozilla/mscom/Registration.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class PlatformChild
|
||||
{
|
||||
public:
|
||||
PlatformChild();
|
||||
|
||||
PlatformChild(PlatformChild&) = delete;
|
||||
PlatformChild(PlatformChild&&) = delete;
|
||||
PlatformChild& operator=(PlatformChild&) = delete;
|
||||
PlatformChild& operator=(PlatformChild&&) = delete;
|
||||
|
||||
private:
|
||||
UniquePtr<mozilla::mscom::RegisteredProxy> mIA2Proxy;
|
||||
UniquePtr<mozilla::mscom::RegisteredProxy> mAccTypelib;
|
||||
UniquePtr<mozilla::mscom::RegisteredProxy> mMiscTypelib;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
} // namespace a11y
|
||||
|
||||
#endif // mozilla_a11y_PlatformChild_h
|
||||
|
|
@ -12,12 +12,14 @@ if CONFIG['ACCESSIBILITY']:
|
|||
EXPORTS.mozilla.a11y += [
|
||||
'COMPtrTypes.h',
|
||||
'DocAccessibleChild.h',
|
||||
'PlatformChild.h',
|
||||
'ProxyAccessible.h'
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'COMPtrTypes.cpp',
|
||||
'DocAccessibleChild.cpp',
|
||||
'PlatformChild.cpp',
|
||||
'ProxyAccessible.cpp',
|
||||
]
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "DocAccessibleWrap.h"
|
||||
|
||||
#include "Compatibility.h"
|
||||
#include "DocAccessibleChild.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "Role.h"
|
||||
|
@ -43,6 +44,30 @@ IMPL_IUNKNOWN_QUERY_HEAD(DocAccessibleWrap)
|
|||
}
|
||||
IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(HyperTextAccessibleWrap)
|
||||
|
||||
STDMETHODIMP
|
||||
DocAccessibleWrap::get_accParent(
|
||||
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
|
||||
{
|
||||
HRESULT hr = DocAccessible::get_accParent(ppdispParent);
|
||||
if (*ppdispParent) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
// We might be a top-level document in a content process.
|
||||
DocAccessibleChild* ipcDoc = IPCDoc();
|
||||
if (!ipcDoc) {
|
||||
return S_FALSE;
|
||||
}
|
||||
IAccessible* dispParent = ipcDoc->GetParentIAccessible();
|
||||
if (!dispParent) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
dispParent->AddRef();
|
||||
*ppdispParent = static_cast<IDispatch*>(dispParent);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
DocAccessibleWrap::get_accValue(VARIANT aVarChild, BSTR __RPC_FAR* aValue)
|
||||
{
|
||||
|
|
|
@ -22,10 +22,14 @@ public:
|
|||
|
||||
// IAccessible
|
||||
|
||||
// Override get_accValue to provide URL when no other value is available
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
|
||||
/* [optional][in] */ VARIANT varChild,
|
||||
/* [retval][out] */ BSTR __RPC_FAR *pszValue);
|
||||
// Override get_accParent for e10s
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
|
||||
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent) override;
|
||||
|
||||
// Override get_accValue to provide URL when no other value is available
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
|
||||
/* [optional][in] */ VARIANT varChild,
|
||||
/* [retval][out] */ BSTR __RPC_FAR *pszValue) override;
|
||||
|
||||
// Accessible
|
||||
virtual void Shutdown();
|
||||
|
|
|
@ -10,12 +10,21 @@
|
|||
#include "Compatibility.h"
|
||||
#include "HyperTextAccessibleWrap.h"
|
||||
#include "ia2AccessibleText.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "mozilla/a11y/ProxyAccessible.h"
|
||||
#include "mozilla/mscom/InterceptorLog.h"
|
||||
#include "mozilla/mscom/Registration.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "ProxyWrappers.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
using namespace mozilla::mscom;
|
||||
|
||||
static StaticAutoPtr<RegisteredProxy> gRegProxy;
|
||||
static StaticAutoPtr<RegisteredProxy> gRegAccTlb;
|
||||
static StaticAutoPtr<RegisteredProxy> gRegMiscTlb;
|
||||
|
||||
void
|
||||
a11y::PlatformInit()
|
||||
|
@ -24,6 +33,19 @@ a11y::PlatformInit()
|
|||
|
||||
nsWinUtils::MaybeStartWindowEmulation();
|
||||
ia2AccessibleText::InitTextChangeData();
|
||||
if (BrowserTabsRemoteAutostart()) {
|
||||
mscom::InterceptorLog::Init();
|
||||
UniquePtr<RegisteredProxy> regProxy(
|
||||
mscom::RegisterProxy(L"ia2marshal.dll"));
|
||||
gRegProxy = regProxy.release();
|
||||
UniquePtr<RegisteredProxy> regAccTlb(
|
||||
mscom::RegisterTypelib(L"oleacc.dll",
|
||||
RegistrationFlags::eUseSystemDirectory));
|
||||
gRegAccTlb = regAccTlb.release();
|
||||
UniquePtr<RegisteredProxy> regMiscTlb(
|
||||
mscom::RegisterTypelib(L"Accessible.tlb"));
|
||||
gRegMiscTlb = regMiscTlb.release();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -32,6 +54,9 @@ a11y::PlatformShutdown()
|
|||
::DestroyCaret();
|
||||
|
||||
nsWinUtils::ShutdownWindowEmulation();
|
||||
gRegProxy = nullptr;
|
||||
gRegAccTlb = nullptr;
|
||||
gRegMiscTlb = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче