diff --git a/accessible/ipc/win/ProxyAccessible.cpp b/accessible/ipc/win/ProxyAccessible.cpp index b56a9e35146e..8c4462cb8c1e 100644 --- a/accessible/ipc/win/ProxyAccessible.cpp +++ b/accessible/ipc/win/ProxyAccessible.cpp @@ -738,5 +738,49 @@ void ProxyAccessible::TakeFocus() { acc->accSelect(SELFLAG_TAKEFOCUS, kChildIdSelf); } +ProxyAccessible* ProxyAccessible::ChildAtPoint( + int32_t aX, int32_t aY, Accessible::EWhichChildAtPoint aWhichChild) { + RefPtr target = QueryInterface(this); + if (!target) { + return nullptr; + } + DocAccessibleParent* doc = Document(); + ProxyAccessible* proxy = this; + // accHitTest only does direct children, but we might want the deepest child. + for (;;) { + VARIANT childVar; + if (FAILED(target->accHitTest(aX, aY, &childVar)) || + childVar.vt == VT_EMPTY) { + return nullptr; + } + if (childVar.vt == VT_I4 && childVar.lVal == CHILDID_SELF) { + break; + } + MOZ_ASSERT(childVar.vt == VT_DISPATCH && childVar.pdispVal); + target = nullptr; + childVar.pdispVal->QueryInterface(IID_IAccessible2_2, + getter_AddRefs(target)); + childVar.pdispVal->Release(); + if (!target) { + return nullptr; + } + // We can't always use GetProxyFor because it can't cross document + // boundaries. + if (proxy->ChildrenCount() == 1) { + proxy = proxy->ChildAt(0); + if (proxy->IsDoc()) { + // We're crossing into a child document. + doc = proxy->AsDoc(); + } + } else { + proxy = GetProxyFor(doc, target); + } + if (aWhichChild == Accessible::eDirectChild) { + break; + } + } + return proxy; +} + } // namespace a11y } // namespace mozilla diff --git a/accessible/xpcom/xpcAccessible.cpp b/accessible/xpcom/xpcAccessible.cpp index 13c44bd51003..eefceb3db054 100644 --- a/accessible/xpcom/xpcAccessible.cpp +++ b/accessible/xpcom/xpcAccessible.cpp @@ -590,12 +590,8 @@ xpcAccessible::GetDeepestChildAtPoint(int32_t aX, int32_t aY, if (IntlGeneric().IsNull()) return NS_ERROR_FAILURE; if (ProxyAccessible* proxy = IntlGeneric().AsProxy()) { -#if defined(XP_WIN) - return NS_ERROR_NOT_IMPLEMENTED; -#else NS_IF_ADDREF(*aAccessible = ToXPC( proxy->ChildAtPoint(aX, aY, Accessible::eDeepestChild))); -#endif } else { NS_IF_ADDREF(*aAccessible = ToXPC( Intl()->ChildAtPoint(aX, aY, Accessible::eDeepestChild)));