mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 244288. MSAA's WindowFromAccessibleObject doesn't work because our get_accParent doesnreturn a ROLE_WINDOW object as the parent of the ROLE_CLIENT
This commit is contained in:
parent
e5b8e53d60
commit
a4853bd9ca
@ -40,6 +40,9 @@
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIAccessibleWin32Object.h"
|
||||
#include "nsArray.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
// for the COM IEnumVARIANT solution in get_AccSelection()
|
||||
#define _ATLBASE_IMPL
|
||||
@ -162,35 +165,14 @@ STDMETHODIMP nsAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *pp
|
||||
return E_FAIL; // We've been shut down
|
||||
|
||||
nsCOMPtr<nsIAccessible> xpParentAccessible;
|
||||
GetParent(getter_AddRefs(xpParentAccessible));
|
||||
|
||||
GetParent(getter_AddRefs(xpParentAccessible));
|
||||
if (xpParentAccessible) {
|
||||
*ppdispParent = NativeAccessible(xpParentAccessible);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// If we have a widget but no parent nsIAccessible then we might have a native
|
||||
// widget parent that could give us a IAccessible. Lets check.
|
||||
|
||||
void* wnd;
|
||||
GetOwnerWindow(&wnd);
|
||||
|
||||
HWND pWnd = ::GetParent(NS_REINTERPRET_CAST(HWND, wnd));
|
||||
if (pWnd) {
|
||||
// get the accessible.
|
||||
void* ptr = nsnull;
|
||||
HRESULT result = AccessibleObjectFromWindow(pWnd, OBJID_WINDOW, IID_IAccessible, &ptr);
|
||||
if (SUCCEEDED(result)) {
|
||||
IAccessible* msaaParentAccessible = (IAccessible*)ptr;
|
||||
// got one? return it.
|
||||
if (msaaParentAccessible) {
|
||||
*ppdispParent = msaaParentAccessible;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessibleWrap::get_accChildCount( long __RPC_FAR *pcountChildren)
|
||||
|
@ -152,6 +152,32 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild(
|
||||
return nsAccessibleWrap::get_accChild(varChild, ppdispChild);
|
||||
}
|
||||
|
||||
STDMETHODIMP nsDocAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
|
||||
{
|
||||
// MSAA expects that client area accessibles return the native accessible for
|
||||
// their containing window, otherwise WindowFromAccessibleObject() doesn't work.
|
||||
|
||||
void* wnd;
|
||||
GetWindowHandle(&wnd);
|
||||
|
||||
HWND pWnd = ::GetParent(NS_REINTERPRET_CAST(HWND, wnd));
|
||||
if (pWnd) {
|
||||
// get the accessible.
|
||||
void* ptr = nsnull;
|
||||
HRESULT result = AccessibleObjectFromWindow(pWnd, OBJID_WINDOW, IID_IAccessible, &ptr);
|
||||
if (SUCCEEDED(result)) {
|
||||
IAccessible* msaaParentAccessible = (IAccessible*)ptr;
|
||||
// got one? return it.
|
||||
if (msaaParentAccessible) {
|
||||
*ppdispParent = msaaParentAccessible;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData)
|
||||
{
|
||||
if (!mWeakShell) { // Means we're not active
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
static PRInt32 GetChildIDFor(nsIAccessible* aAccessible);
|
||||
|
||||
void GetXPAccessibleFor(const VARIANT& varChild, nsIAccessible **aXPAccessible);
|
||||
|
||||
// ISimpleDOMDocument
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_URL(
|
||||
/* [out] */ BSTR __RPC_FAR *url);
|
||||
@ -82,11 +83,17 @@ public:
|
||||
/* [in] */ BSTR __RPC_FAR *commaSeparatedMediaTypes);
|
||||
|
||||
// IAccessible
|
||||
// Overrid get_accChild so that it can get any child via the unique ID
|
||||
// Override get_accChild so that it can get any child via the unique ID
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild(
|
||||
/* [in] */ VARIANT varChild,
|
||||
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild);
|
||||
|
||||
// Override get_accParent so that native accessible for window is
|
||||
// returned as parent, otherwise WindowFromAccessibleObject() doesn't work.
|
||||
// Also necessary for MSAA SDK's accexplore.exe testing tool to work.
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
|
||||
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent);
|
||||
|
||||
NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user