diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 0e96cc2655a..587eb21326c 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -55,6 +55,8 @@ #include "nsPIDOMWindow.h" #include "nsRootAccessible.h" #include "nsIServiceManager.h" +#include "AccessibleApplication.h" +#include "nsApplicationAccessibleWrap.h" /// the accessible library and cached methods HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull; @@ -126,6 +128,34 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv) return S_OK; } +STDMETHODIMP +nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv) +{ + // Can get to IAccessibleApplication from any node via QS + if (iid == IID_IAccessibleApplication) { + nsRefPtr app = + GetApplicationAccessible(); + nsresult rv = app->QueryNativeInterface(iid, ppv); + return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE; + } + + /** + * To get an ISimpleDOMNode, ISimpleDOMDocument, ISimpleDOMText + * or any IAccessible2 interface on should use IServiceProvider like this: + * ----------------------------------------------------------------------- + * ISimpleDOMDocument *pAccDoc = NULL; + * IServiceProvider *pServProv = NULL; + * pAcc->QueryInterface(IID_IServiceProvider, (void**)&pServProv); + * if (pServProv) { + * const GUID unused; + * pServProv->QueryService(unused, IID_ISimpleDOMDocument, (void**)&pAccDoc); + * pServProv->Release(); + * } + */ + + return QueryInterface(iid, ppv); +} + //----------------------------------------------------- // ISimpleDOMNode methods //----------------------------------------------------- diff --git a/accessible/src/msaa/nsAccessNodeWrap.h b/accessible/src/msaa/nsAccessNodeWrap.h index 6d2e8975531..225375874df 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.h +++ b/accessible/src/msaa/nsAccessNodeWrap.h @@ -61,12 +61,16 @@ typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREAD class nsAccessNodeWrap : public nsAccessNode, public nsIWinAccessNode, - public ISimpleDOMNode + public ISimpleDOMNode, + public IServiceProvider { public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIWINACCESSNODE + public: // IServiceProvider + STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv); + public: // construction, destruction nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell); virtual ~nsAccessNodeWrap(); diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index fc4239202c0..0b30f422987 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -1005,27 +1005,6 @@ STDMETHODIMP nsAccessibleWrap::put_accValue( #include "mshtml.h" -STDMETHODIMP -nsAccessibleWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv) -{ - /** - * To get an ISimpleDOMNode, ISimpleDOMDocument or ISimpleDOMText - * from an IAccessible you have to use IServiceProvider like this: - * -------------------------------------------------------------- - * ISimpleDOMDocument *pAccDoc = NULL; - * IServiceProvider *pServProv = NULL; - * pAcc->QueryInterface(IID_IServiceProvider, (void**)&pServProv); - * if (pServProv) { - * const GUID unused; - * pServProv->QueryService(unused, IID_ISimpleDOMDocument, (void**)&pAccDoc); - * pServProv->Release(); - * } - */ - - return QueryInterface(iid, ppv); -} - - STDMETHODIMP nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR* aNumElementsFetched) { diff --git a/accessible/src/msaa/nsAccessibleWrap.h b/accessible/src/msaa/nsAccessibleWrap.h index 6aca2691400..e1ad8ad8357 100644 --- a/accessible/src/msaa/nsAccessibleWrap.h +++ b/accessible/src/msaa/nsAccessibleWrap.h @@ -94,8 +94,7 @@ class nsAccessibleWrap : public nsAccessible, public CAccessibleHyperlink, public CAccessibleValue, public IAccessible2, - public IEnumVARIANT, - public IServiceProvider + public IEnumVARIANT { public: // construction, destruction nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell); @@ -107,9 +106,6 @@ class nsAccessibleWrap : public nsAccessible, public: // IUnknown methods - see iunknown.h for documentation STDMETHODIMP QueryInterface(REFIID, void**); - public: // IServiceProvider - STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv); - // Return the registered OLE class ID of this object's CfDataObj. CLSID GetClassID() const;