Bug 1841941: Use CreateStdAccessibleObject instead of AccessibleObjectFromWindow when getting the window IAccessible. r=nlapre

We use AccessibleObjectFromWindow to get a system generated IAccessible for the window.
While this works well enough, it first sends WM_GETOBJECT to our window, goes through our window proc, etc., which is pointless since it will return nothing.
We should just call CreateStdAccessibleObject directly instead, which is what the existing code ends up doing indirectly.

Differential Revision: https://phabricator.services.mozilla.com/D182862
This commit is contained in:
James Teh 2023-07-11 21:57:29 +00:00
parent 4f7447668c
commit bac4f88bdf
2 changed files with 4 additions and 4 deletions

View File

@ -519,8 +519,8 @@ LazyInstantiator::get_accParent(IDispatch** ppdispParent) {
if (!mWeakAccessible) {
// If we'd resolve the root right now this would be the codepath we'd end
// up in anyway. So we might as well return it here.
return ::AccessibleObjectFromWindow(mHwnd, OBJID_WINDOW, IID_IAccessible,
(void**)ppdispParent);
return ::CreateStdAccessibleObject(mHwnd, OBJID_WINDOW, IID_IAccessible,
(void**)ppdispParent);
}
RESOLVE_ROOT;
return mWeakAccessible->get_accParent(ppdispParent);

View File

@ -76,7 +76,7 @@ MsaaDocAccessible::get_accParent(
HWND hwnd = remoteDoc->GetEmulatedWindowHandle();
MOZ_ASSERT(hwnd);
if (hwnd &&
SUCCEEDED(::AccessibleObjectFromWindow(
SUCCEEDED(::CreateStdAccessibleObject(
hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent))) {
return S_OK;
}
@ -118,7 +118,7 @@ MsaaDocAccessible::get_accParent(
}
}
if (hwnd &&
SUCCEEDED(::AccessibleObjectFromWindow(
SUCCEEDED(::CreateStdAccessibleObject(
hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent))) {
return S_OK;
}