зеркало из https://github.com/mozilla/pjs.git
Bug 395077. Allow QueryService from any accessible to IAccessibleApplication. r=surkov, a=dsicore
This commit is contained in:
Родитель
38e4a52b47
Коммит
1ffa4e6e49
|
@ -55,6 +55,8 @@
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsRootAccessible.h"
|
#include "nsRootAccessible.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
#include "AccessibleApplication.h"
|
||||||
|
#include "nsApplicationAccessibleWrap.h"
|
||||||
|
|
||||||
/// the accessible library and cached methods
|
/// the accessible library and cached methods
|
||||||
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
|
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
|
||||||
|
@ -126,6 +128,34 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
|
||||||
return S_OK;
|
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<nsApplicationAccessibleWrap> 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
|
// ISimpleDOMNode methods
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
|
@ -61,12 +61,16 @@ typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREAD
|
||||||
|
|
||||||
class nsAccessNodeWrap : public nsAccessNode,
|
class nsAccessNodeWrap : public nsAccessNode,
|
||||||
public nsIWinAccessNode,
|
public nsIWinAccessNode,
|
||||||
public ISimpleDOMNode
|
public ISimpleDOMNode,
|
||||||
|
public IServiceProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_NSIWINACCESSNODE
|
NS_DECL_NSIWINACCESSNODE
|
||||||
|
|
||||||
|
public: // IServiceProvider
|
||||||
|
STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
|
||||||
|
|
||||||
public: // construction, destruction
|
public: // construction, destruction
|
||||||
nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
||||||
virtual ~nsAccessNodeWrap();
|
virtual ~nsAccessNodeWrap();
|
||||||
|
|
|
@ -1005,27 +1005,6 @@ STDMETHODIMP nsAccessibleWrap::put_accValue(
|
||||||
|
|
||||||
#include "mshtml.h"
|
#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
|
STDMETHODIMP
|
||||||
nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR* aNumElementsFetched)
|
nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR* aNumElementsFetched)
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,8 +94,7 @@ class nsAccessibleWrap : public nsAccessible,
|
||||||
public CAccessibleHyperlink,
|
public CAccessibleHyperlink,
|
||||||
public CAccessibleValue,
|
public CAccessibleValue,
|
||||||
public IAccessible2,
|
public IAccessible2,
|
||||||
public IEnumVARIANT,
|
public IEnumVARIANT
|
||||||
public IServiceProvider
|
|
||||||
{
|
{
|
||||||
public: // construction, destruction
|
public: // construction, destruction
|
||||||
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
|
||||||
|
@ -107,9 +106,6 @@ class nsAccessibleWrap : public nsAccessible,
|
||||||
public: // IUnknown methods - see iunknown.h for documentation
|
public: // IUnknown methods - see iunknown.h for documentation
|
||||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
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.
|
// Return the registered OLE class ID of this object's CfDataObj.
|
||||||
CLSID GetClassID() const;
|
CLSID GetClassID() const;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче