Bug 1622699 part 1: Add nsIAccessible::GetDeepestChildAtPointInProcess. r=yzen

Dev Tools A11y Panel interacts with accessibles in the process in which they reside.
It does not (and cannot) deal with ProxyAccessibles.
However, GetDeepestChildAtPoint now walks into the ProxyAccessible tree if appropriate, which is what we want for tests and what normally makes sense.
This patch introduces GetDeepestChildAtPointInProcess, which Dev Tools will use instead.

Differential Revision: https://phabricator.services.mozilla.com/D68302

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2020-03-26 18:00:59 +00:00
Родитель 8505e4cfea
Коммит cc07441b96
3 изменённых файлов: 33 добавлений и 1 удалений

Просмотреть файл

@ -193,7 +193,7 @@ interface nsIAccessible : nsISupports
*
* @param x screen's x coordinate
* @param y screen's y coordinate
* @return the deepest accessible child containing the given point
* @return the direct accessible child containing the given point
*/
nsIAccessible getChildAtPoint(in long x, in long y);
@ -209,6 +209,20 @@ interface nsIAccessible : nsISupports
*/
nsIAccessible getDeepestChildAtPoint(in long x, in long y);
/**
* Like GetDeepestChildAtPoint, but restricted to the current process.
* If the point is within a remote document, the accessible for the browser
* element containing that document will be returned; i.e. this will not
* descend into the document. If called on an accessible inside a remote
* document, this will fail.
*
* @param x screen's x coordinate
* @param y screen's y coordinate
* @return the deepest accessible child in this process containing the given
* point
*/
nsIAccessible getDeepestChildAtPointInProcess(in long x, in long y);
/**
* Nth accessible child using zero-based index or last child if index less than zero
*/

Просмотреть файл

@ -586,6 +586,22 @@ xpcAccessible::GetDeepestChildAtPoint(int32_t aX, int32_t aY,
return NS_OK;
}
NS_IMETHODIMP
xpcAccessible::GetDeepestChildAtPointInProcess(int32_t aX, int32_t aY,
nsIAccessible** aAccessible) {
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nullptr;
AccessibleOrProxy generic = IntlGeneric();
if (generic.IsNull() || generic.IsProxy()) {
return NS_ERROR_FAILURE;
}
NS_IF_ADDREF(*aAccessible = ToXPC(
Intl()->ChildAtPoint(aX, aY, Accessible::eDeepestChild)));
return NS_OK;
}
NS_IMETHODIMP
xpcAccessible::SetSelected(bool aSelect) {
if (IntlGeneric().IsNull()) return NS_ERROR_FAILURE;

Просмотреть файл

@ -67,6 +67,8 @@ class xpcAccessible : public nsIAccessible {
nsIAccessible** aAccessible) final;
NS_IMETHOD GetDeepestChildAtPoint(int32_t aX, int32_t aY,
nsIAccessible** aAccessible) final;
NS_IMETHOD GetDeepestChildAtPointInProcess(int32_t aX, int32_t aY,
nsIAccessible** aAccessible) final;
NS_IMETHOD SetSelected(bool aSelect) final;
NS_IMETHOD TakeSelection() final;