mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 762770 - implement IAccessibleEx, rkhuey
This commit is contained in:
parent
6013f3dfea
commit
54ad98b7d8
@ -32,6 +32,10 @@ SHARED_LIBRARY_LIBS = \
|
||||
../src/xforms/$(LIB_PREFIX)accessibility_xforms_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
SHARED_LIBRARY_LIBS += ../src/windows/uia/$(LIB_PREFIX)accessibility_toolkit_uia_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
ifdef MOZ_XUL
|
||||
SHARED_LIBRARY_LIBS += ../src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
@ -14,7 +14,10 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
PLATFORM_DIR = atk
|
||||
else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
PLATFORM_DIR = msaa
|
||||
PLATFORM_DIR = \
|
||||
msaa \
|
||||
windows \
|
||||
$(null)
|
||||
else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
PLATFORM_DIR += mac
|
||||
|
@ -14,8 +14,6 @@ LIBRARY_NAME = accessibility_toolkit_s
|
||||
EXPORT_LIBRARY = ..
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
|
||||
CMMSRCS = \
|
||||
AccessibleWrap.mm \
|
||||
ApplicationAccessibleWrap.mm \
|
||||
|
@ -8,22 +8,17 @@
|
||||
#include "Compatibility.h"
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "EnumVariant.h"
|
||||
#include "ia2AccessibleRelation.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "ia2AccessibleRelation.h"
|
||||
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
|
||||
#include "Accessible2_i.c"
|
||||
#include "AccessibleRole.h"
|
||||
#include "AccessibleStates.h"
|
||||
#include "RootAccessible.h"
|
||||
#include "States.h"
|
||||
#include "uiaRawElmProvider.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "Logging.h"
|
||||
@ -40,7 +35,11 @@
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsEventMap.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
#include "Accessible2_i.c"
|
||||
#include "AccessibleRole.h"
|
||||
#include "AccessibleStates.h"
|
||||
#include "OLEACC.H"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -122,6 +121,32 @@ __try {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IServiceProvider
|
||||
|
||||
STDMETHODIMP
|
||||
AccessibleWrap::QueryService(REFGUID aGuidService, REFIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
// UIA IAccessibleEx
|
||||
if (aGuidService == IID_IAccessibleEx &&
|
||||
Preferences::GetBool("accessibility.uia.enable")) {
|
||||
IAccessibleEx* accEx = new uiaRawElmProvider(this);
|
||||
HRESULT hr = accEx->QueryInterface(aIID, aInstancePtr);
|
||||
if (FAILED(hr))
|
||||
delete accEx;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
return nsAccessNodeWrap::QueryService(aGuidService, aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// IAccessible methods
|
||||
//-----------------------------------------------------
|
||||
|
@ -17,51 +17,104 @@
|
||||
#include "ia2AccessibleHyperlink.h"
|
||||
#include "CAccessibleValue.h"
|
||||
|
||||
#define DECL_IUNKNOWN_INHERITED \
|
||||
public: \
|
||||
STDMETHODIMP QueryInterface(REFIID, void**); \
|
||||
#define DECL_IUNKNOWN \
|
||||
public: \
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**); \
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef() MOZ_FINAL \
|
||||
{ return ++mRefCnt; } \
|
||||
virtual ULONG STDMETHODCALLTYPE Release() MOZ_FINAL \
|
||||
{ \
|
||||
mRefCnt--; \
|
||||
if (mRefCnt) \
|
||||
return mRefCnt; \
|
||||
\
|
||||
delete this; \
|
||||
return 0; \
|
||||
} \
|
||||
private: \
|
||||
ULONG mRefCnt; \
|
||||
public:
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
STDMETHODIMP \
|
||||
Class::QueryInterface(REFIID iid, void** ppv) \
|
||||
{ \
|
||||
HRESULT hr = E_NOINTERFACE; \
|
||||
*ppv = NULL; \
|
||||
#define DECL_IUNKNOWN_INHERITED \
|
||||
public: \
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**); \
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
return hr; \
|
||||
} \
|
||||
#define IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
STDMETHODIMP \
|
||||
Class::QueryInterface(REFIID aIID, void** aInstancePtr) \
|
||||
{ \
|
||||
__try { \
|
||||
if (!aInstancePtr) \
|
||||
return E_INVALIDARG; \
|
||||
*aInstancePtr = NULL; \
|
||||
\
|
||||
HRESULT hr = E_NOINTERFACE;
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_ENTRY(Class) \
|
||||
hr = Class::QueryInterface(iid, ppv); \
|
||||
if (SUCCEEDED(hr)) \
|
||||
return hr; \
|
||||
#define IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
return hr; \
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), \
|
||||
GetExceptionInformation())) { } \
|
||||
return E_NOINTERFACE; \
|
||||
}
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_ENTRY_COND(Class, Cond) \
|
||||
if (Cond) { \
|
||||
hr = Class::QueryInterface(iid, ppv); \
|
||||
if (SUCCEEDED(hr)) \
|
||||
return hr; \
|
||||
} \
|
||||
#define IMPL_IUNKNOWN_QUERY_IFACE(Iface) \
|
||||
if (aIID == IID_##Iface) { \
|
||||
*aInstancePtr = static_cast<Iface*>(this); \
|
||||
AddRef(); \
|
||||
return S_OK; \
|
||||
}
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED0(Class, Super) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
#define IMPL_IUNKNOWN_QUERY_IFACE_AMBIGIOUS(Iface, aResolveIface) \
|
||||
if (aIID == IID_##Iface) { \
|
||||
*aInstancePtr = static_cast<Iface*>(static_cast<aResolveIface*>(this)); \
|
||||
AddRef(); \
|
||||
return S_OK; \
|
||||
}
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED1(Class, Super, I1) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(I1); \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
#define IMPL_IUNKNOWN_QUERY_CLASS(Class) \
|
||||
hr = Class::QueryInterface(aIID, aInstancePtr); \
|
||||
if (SUCCEEDED(hr)) \
|
||||
return hr;
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED2(Class, Super, I1, I2) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(I1); \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(I2); \
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
#define IMPL_IUNKNOWN_QUERY_CLASS_COND(Class, Cond) \
|
||||
if (Cond) { \
|
||||
hr = Class::QueryInterface(aIID, aInstancePtr); \
|
||||
if (SUCCEEDED(hr)) \
|
||||
return hr; \
|
||||
}
|
||||
|
||||
#define IMPL_IUNKNOWN_QUERY_AGGR_COND(Member, Cond) \
|
||||
if (Cond) { \
|
||||
hr = Member->QueryInterface(aIID, aInstancePtr); \
|
||||
if (SUCCEEDED(hr)) \
|
||||
return hr; \
|
||||
}
|
||||
|
||||
#define IMPL_IUNKNOWN1(Class, I1) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(I1); \
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IUnknown); \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
|
||||
#define IMPL_IUNKNOWN2(Class, I1, I2) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(I1); \
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(I2); \
|
||||
IMPL_IUNKNOWN_QUERY_IFACE_AMBIGIOUS(IUnknown, I1); \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED1(Class, Super0, Super1) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(Super1); \
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(Super0) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL \
|
||||
|
||||
#define IMPL_IUNKNOWN_INHERITED2(Class, Super0, Super1, Super2) \
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(Super1); \
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(Super2); \
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(Super0) \
|
||||
IMPL_IUNKNOWN_QUERY_TAIL
|
||||
|
||||
class AccessibleWrap : public Accessible,
|
||||
public ia2AccessibleComponent,
|
||||
@ -83,6 +136,11 @@ public: // construction, destruction
|
||||
// Return the registered OLE class ID of this object's CfDataObj.
|
||||
CLSID GetClassID() const;
|
||||
|
||||
// IServiceProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID aGuidService,
|
||||
REFIID aIID,
|
||||
void** aInstancePtr);
|
||||
|
||||
public: // COM interface IAccessible
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
|
||||
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent);
|
||||
|
@ -13,51 +13,11 @@ using namespace mozilla::a11y;
|
||||
// ChildrenEnumVariant
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
STDMETHODIMP
|
||||
ChildrenEnumVariant::QueryInterface(REFIID aIID, void** aObject)
|
||||
{
|
||||
__try {
|
||||
if (!aObject)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (aIID == IID_IEnumVARIANT) {
|
||||
*aObject = static_cast<IEnumVARIANT*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (aIID == IID_IUnknown) {
|
||||
*aObject = static_cast<IUnknown*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Redirect QI to IAccessible this enum was retrieved for.
|
||||
if (!mAnchorAcc->IsDefunct())
|
||||
return mAnchorAcc->QueryInterface(aIID, aObject);
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
|
||||
GetExceptionInformation())) { }
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE
|
||||
ChildrenEnumVariant::AddRef()
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE
|
||||
ChildrenEnumVariant::Release()
|
||||
{
|
||||
mRefCnt--;
|
||||
ULONG r = mRefCnt;
|
||||
if (r == 0)
|
||||
delete this;
|
||||
|
||||
return r;
|
||||
}
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(ChildrenEnumVariant)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IEnumVARIANT);
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IUnknown);
|
||||
IMPL_IUNKNOWN_QUERY_AGGR_COND(mAnchorAcc, !mAnchorAcc->IsDefunct());
|
||||
IMPL_IUNKNOWN_QUERY_TAIL
|
||||
|
||||
STDMETHODIMP
|
||||
ChildrenEnumVariant::Next(ULONG aCount, VARIANT FAR* aItems,
|
||||
|
@ -22,12 +22,7 @@ public:
|
||||
mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0), mRefCnt(0) { }
|
||||
|
||||
// IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
/* [in] */ REFIID aRefIID,
|
||||
/* [annotation][iid_is][out] */ void** aObject);
|
||||
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
DECL_IUNKNOWN
|
||||
|
||||
// IEnumVariant
|
||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
|
||||
@ -56,9 +51,6 @@ protected:
|
||||
nsRefPtr<AccessibleWrap> mAnchorAcc;
|
||||
Accessible* mCurAcc;
|
||||
PRUint32 mCurIndex;
|
||||
|
||||
private:
|
||||
ULONG mRefCnt;
|
||||
};
|
||||
|
||||
} // a11y namespace
|
||||
|
@ -69,6 +69,7 @@ LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../html \
|
||||
-I$(srcdir)/../xpcom \
|
||||
-I$(srcdir)/../xul \
|
||||
-I$(srcdir)/../windows/uia \
|
||||
-I$(srcdir)/../../../content/base/src \
|
||||
-I$(srcdir)/../../../content/events/src \
|
||||
$(NULL)
|
||||
|
@ -21,8 +21,8 @@ NS_IMPL_ISUPPORTS_INHERITED0(XULListboxAccessibleWrap,
|
||||
XULListboxAccessible)
|
||||
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(XULListboxAccessibleWrap)
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY_COND(CAccessibleTable, IsMulticolumn());
|
||||
IMPL_IUNKNOWN_QUERY_ENTRY(AccessibleWrap)
|
||||
IMPL_IUNKNOWN_QUERY_CLASS_COND(CAccessibleTable, IsMulticolumn());
|
||||
IMPL_IUNKNOWN_QUERY_CLASS(AccessibleWrap)
|
||||
IMPL_IUNKNOWN_QUERY_TAIL
|
||||
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
@ -87,22 +85,13 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
{
|
||||
*ppv = nsnull;
|
||||
|
||||
static const GUID IID_SimpleDOMDeprecated = {0x0c539790,0x12e4,0x11cf,0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8};
|
||||
|
||||
// Provide a special service ID for getting the accessible for the browser tab
|
||||
// document that contains this accessible object. If this accessible object
|
||||
// is not inside a browser tab then the service fails with E_NOINTERFACE.
|
||||
// A use case for this is for screen readers that need to switch context or
|
||||
// 'virtual buffer' when focus moves from one browser tab area to another.
|
||||
static const GUID SID_IAccessibleContentDocument = {0xa5d8e1f3,0x3571,0x4d8f,0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e};
|
||||
|
||||
if (guidService != IID_ISimpleDOMNode &&
|
||||
guidService != IID_SimpleDOMDeprecated &&
|
||||
guidService != IID_IAccessible && guidService != IID_IAccessible2 &&
|
||||
guidService != IID_IAccessibleApplication &&
|
||||
guidService != SID_IAccessibleContentDocument)
|
||||
return E_INVALIDARG;
|
||||
|
||||
static const GUID SID_IAccessibleContentDocument =
|
||||
{ 0xa5d8e1f3,0x3571,0x4d8f,0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e };
|
||||
if (guidService == SID_IAccessibleContentDocument) {
|
||||
if (iid != IID_IAccessible)
|
||||
return E_NOINTERFACE;
|
||||
@ -139,7 +128,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
}
|
||||
|
||||
// Can get to IAccessibleApplication from any node via QS
|
||||
if (iid == IID_IAccessibleApplication) {
|
||||
if (guidService == IID_IAccessibleApplication) {
|
||||
ApplicationAccessible* applicationAcc = GetApplicationAccessible();
|
||||
if (!applicationAcc)
|
||||
return E_NOINTERFACE;
|
||||
@ -162,7 +151,14 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
* }
|
||||
*/
|
||||
|
||||
return QueryInterface(iid, ppv);
|
||||
static const GUID IID_SimpleDOMDeprecated =
|
||||
{ 0x0c539790,0x12e4,0x11cf,0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8 };
|
||||
if (guidService == IID_ISimpleDOMNode ||
|
||||
guidService == IID_SimpleDOMDeprecated ||
|
||||
guidService == IID_IAccessible || guidService == IID_IAccessible2)
|
||||
return QueryInterface(iid, ppv);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
@ -34,6 +34,14 @@
|
||||
|
||||
#include "nsRefPtrHashtable.h"
|
||||
|
||||
#define A11Y_TRYBLOCK_BEGIN \
|
||||
__try {
|
||||
|
||||
#define A11Y_TRYBLOCK_END \
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), \
|
||||
GetExceptionInformation()))\
|
||||
{ } \
|
||||
return E_FAIL;
|
||||
|
||||
class AccTextChangeEvent;
|
||||
|
||||
@ -46,18 +54,20 @@ class nsAccessNodeWrap : public nsAccessNode,
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWINACCESSNODE
|
||||
|
||||
public: // IServiceProvider
|
||||
STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
|
||||
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
|
||||
virtual ~nsAccessNodeWrap();
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
// IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID aIID,
|
||||
void** aInstancePtr);
|
||||
|
||||
public:
|
||||
// IServiceProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID aGuidService,
|
||||
REFIID aIID,
|
||||
void** aInstancePtr);
|
||||
|
||||
// ISimpleDOMNode
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeInfo(
|
||||
/* [out] */ BSTR __RPC_FAR *tagName,
|
||||
/* [out] */ short __RPC_FAR *nameSpaceID,
|
||||
|
16
accessible/src/windows/Makefile.in
Normal file
16
accessible/src/windows/Makefile.in
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# 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/.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS += uia \
|
||||
$(null)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
36
accessible/src/windows/uia/Makefile.in
Normal file
36
accessible/src/windows/uia/Makefile.in
Normal file
@ -0,0 +1,36 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_toolkit_uia_s
|
||||
EXPORT_LIBRARY = ..
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
CPPSRCS += \
|
||||
uiaRawElmProvider.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../../base \
|
||||
-I$(srcdir)/../../generic \
|
||||
-I$(srcdir)/../../html \
|
||||
-I$(srcdir)/../../msaa \
|
||||
-I$(srcdir)/../../xpcom \
|
||||
-I$(srcdir)/../../xul \
|
||||
$(NULL)
|
170
accessible/src/windows/uia/uiaRawElmProvider.cpp
Normal file
170
accessible/src/windows/uia/uiaRawElmProvider.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
/* -*- 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 "uiaRawElmProvider.h"
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// uiaRawElmProvider
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IMPL_IUNKNOWN2(uiaRawElmProvider,
|
||||
IAccessibleEx,
|
||||
IRawElementProviderSimple)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IAccessibleEx
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::GetObjectForChild(long aIdChild,
|
||||
__RPC__deref_out_opt IAccessibleEx** aAccEx)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aAccEx)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aAccEx = NULL;
|
||||
|
||||
return mAcc->IsDefunct() ? CO_E_OBJNOTCONNECTED : S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::GetIAccessiblePair(__RPC__deref_out_opt IAccessible** aAcc,
|
||||
__RPC__out long* aIdChild)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aAcc || !aIdChild)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aAcc = NULL;
|
||||
*aIdChild = 0;
|
||||
|
||||
if (mAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aIdChild = CHILDID_SELF;
|
||||
*aAcc = mAcc;
|
||||
mAcc->AddRef();
|
||||
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::GetRuntimeId(__RPC__deref_out_opt SAFEARRAY** aRuntimeIds)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aRuntimeIds)
|
||||
return E_INVALIDARG;
|
||||
|
||||
int ids[] = { UiaAppendRuntimeId, reinterpret_cast<int>(mAcc->UniqueID()) };
|
||||
*aRuntimeIds = SafeArrayCreateVector(VT_I4, 0, 2);
|
||||
if (!*aRuntimeIds)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for (LONG i = 0; i < ArrayLength(ids); i++)
|
||||
SafeArrayPutElement(*aRuntimeIds, &i, (void*)&(ids[i]));
|
||||
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::ConvertReturnedElement(__RPC__in_opt IRawElementProviderSimple* aRawElmProvider,
|
||||
__RPC__deref_out_opt IAccessibleEx** aAccEx)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aRawElmProvider || !aAccEx)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aAccEx = NULL;
|
||||
|
||||
void* instancePtr = NULL;
|
||||
HRESULT hr = aRawElmProvider->QueryInterface(IID_IAccessibleEx, &instancePtr);
|
||||
if (SUCCEEDED(hr))
|
||||
*aAccEx = static_cast<IAccessibleEx*>(instancePtr);
|
||||
|
||||
return hr;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IRawElementProviderSimple
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::get_ProviderOptions(__RPC__out enum ProviderOptions* aOptions)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aOptions)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This method is not used with IAccessibleEx implementations.
|
||||
*aOptions = ProviderOptions_ServerSideProvider;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::GetPatternProvider(PATTERNID aPatternId,
|
||||
__RPC__deref_out_opt IUnknown** aPatternProvider)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aPatternProvider)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aPatternProvider = NULL;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::GetPropertyValue(PROPERTYID aPropertyId,
|
||||
__RPC__out VARIANT* aPropertyValue)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aPropertyValue)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// UI Automation will attempt to get the property from the host
|
||||
//window provider.
|
||||
aPropertyValue->vt = VT_EMPTY;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::get_HostRawElementProvider(__RPC__deref_out_opt IRawElementProviderSimple** aRawElmProvider)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aRawElmProvider)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// This method is not used with IAccessibleEx implementations.
|
||||
*aRawElmProvider = NULL;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
74
accessible/src/windows/uia/uiaRawElmProvider.h
Normal file
74
accessible/src/windows/uia/uiaRawElmProvider.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* -*- 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_uiaRawElmProvider_h__
|
||||
#define mozilla_a11y_uiaRawElmProvider_h__
|
||||
|
||||
#include "objbase.h"
|
||||
#include "AccessibleWrap.h"
|
||||
#include "UIAutomation.h"
|
||||
|
||||
class AccessibleWrap;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* IRawElementProviderSimple implementation (maintains IAccessibleEx approach).
|
||||
*/
|
||||
class uiaRawElmProvider MOZ_FINAL : public IAccessibleEx,
|
||||
public IRawElementProviderSimple
|
||||
{
|
||||
public:
|
||||
uiaRawElmProvider(AccessibleWrap* aAcc) : mAcc(aAcc), mRefCnt(0) { }
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN
|
||||
|
||||
// IAccessibleEx
|
||||
virtual HRESULT STDMETHODCALLTYPE GetObjectForChild(
|
||||
/* [in] */ long aIdChild,
|
||||
/* [retval][out] */ __RPC__deref_out_opt IAccessibleEx** aAccEx);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetIAccessiblePair(
|
||||
/* [out] */ __RPC__deref_out_opt IAccessible** aAcc,
|
||||
/* [out] */ __RPC__out long* aIdChild);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetRuntimeId(
|
||||
/* [retval][out] */ __RPC__deref_out_opt SAFEARRAY** aRuntimeIds);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE ConvertReturnedElement(
|
||||
/* [in] */ __RPC__in_opt IRawElementProviderSimple* aRawElmProvider,
|
||||
/* [out] */ __RPC__deref_out_opt IAccessibleEx** aAccEx);
|
||||
|
||||
// IRawElementProviderSimple
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProviderOptions(
|
||||
/* [retval][out] */ __RPC__out enum ProviderOptions* aProviderOptions);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetPatternProvider(
|
||||
/* [in] */ PATTERNID aPatternId,
|
||||
/* [retval][out] */ __RPC__deref_out_opt IUnknown** aPatternProvider);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(
|
||||
/* [in] */ PROPERTYID aPropertyId,
|
||||
/* [retval][out] */ __RPC__out VARIANT* aPropertyValue);
|
||||
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HostRawElementProvider(
|
||||
/* [retval][out] */ __RPC__deref_out_opt IRawElementProviderSimple** aRawElmProvider);
|
||||
|
||||
private:
|
||||
uiaRawElmProvider() MOZ_DELETE;
|
||||
uiaRawElmProvider& operator =(const uiaRawElmProvider&) MOZ_DELETE;
|
||||
uiaRawElmProvider(const uiaRawElmProvider&) MOZ_DELETE;
|
||||
|
||||
protected:
|
||||
nsRefPtr<AccessibleWrap> mAcc;
|
||||
};
|
||||
|
||||
} // a11y namespace
|
||||
} // mozilla namespace
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user