Bug 1694865 part 16: Transitional implementation of IUnknown in MsaaAccessible/MsaaDocAccessible which delegates to AccessibleWrap. r=morgan

This is necessary to enable COM objects which aggregate AccessibleWrap/DocAccessibleWrap to aggregate MsaaAccessible/MsaaDocAccessible instead.
Ultimately, the IUnknown implementation will be moved out of AccessibleWrap altogether and into MsaaAccessible, but we can't do that yet.
Even though MsaaDocAccessible indirectly inherits from MsaaAccessible, we have to override QueryInterface due to the naming conflict with nsISupports.

Differential Revision: https://phabricator.services.mozilla.com/D112948
This commit is contained in:
James Teh 2021-05-01 02:51:23 +00:00
Родитель efaf13c0ed
Коммит 19e006d017
3 изменённых файлов: 28 добавлений и 3 удалений

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

@ -618,6 +618,20 @@ ITypeInfo* MsaaAccessible::GetTI(LCID lcid) {
return gTypeInfo;
}
// IUnknown methods
// XXX This delegation to AccessibleWrap is a necessary hack until we can move
// the IUnknown implementation out of AccessibleWrap.
STDMETHODIMP MsaaAccessible::QueryInterface(REFIID iid, void** ppv) {
return static_cast<AccessibleWrap*>(this)->QueryInterface(iid, ppv);
}
ULONG STDMETHODCALLTYPE MsaaAccessible::AddRef() {
return static_cast<AccessibleWrap*>(this)->AddRef();
}
ULONG STDMETHODCALLTYPE MsaaAccessible::Release() {
return static_cast<AccessibleWrap*>(this)->Release();
}
// IAccessible methods
STDMETHODIMP

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

@ -66,6 +66,11 @@ class MsaaAccessible : public ia2Accessible,
static IDispatch* NativeAccessible(LocalAccessible* aAccessible);
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**) override;
ULONG STDMETHODCALLTYPE AddRef() override;
ULONG STDMETHODCALLTYPE Release() override;
// IAccessible
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
/* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispParent)

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

@ -24,6 +24,15 @@ class MsaaDocAccessible : public DocAccessible {
MsaaDocAccessible(dom::Document* aDocument, PresShell* aPresShell)
: DocAccessible(aDocument, aPresShell) {}
DocAccessible* DocAcc();
// IUnknown
// XXX This override of QueryInterface is a necessary hack until we get rid
// of the inheritance of DocAccessible.
STDMETHODIMP QueryInterface(REFIID iid, void** ppv) override {
return MsaaAccessible::QueryInterface(iid, ppv);
}
// IAccessible
// Override get_accParent for e10s
@ -52,9 +61,6 @@ class MsaaDocAccessible : public DocAccessible {
* This provides a mapping from 32 bit id to accessible objects.
*/
nsTHashMap<nsUint32HashKey, AccessibleWrap*> mIDToAccessibleMap;
private:
DocAccessible* DocAcc();
};
} // namespace a11y