a11y: Fix bounds check for AT-SPI GetAccessibleAtPoint
In `accessible_at_point`, fix the check whether the given point is inside of the accessible's bounds. For that to be the case, the point's x coordinate must be somewhere between the X position of the accessible's bounds and that position + width. (Likewise for the y coordinate and the height.) the previous check would only work correctly for children located at a relative location of (0, 0) within the parent. With this and the previous commit in place, the (extended) example from issue #6448 now gives the expected result: an accessible object in whose bounds include requested point (50, 50) lies: In [19]: acc.queryComponent().getExtents(pyatspi.WINDOW_COORDS) Out[19]: [0, 0, 800, 600] In [20]: acc.queryComponent().getAccessibleAtPoint(50, 50, pyatspi.WINDOW_COORDS) Out[20]: <Atspi.Accessible object at 0x7fae500e9180 (AtspiAccessible at 0x33455b0)> In [21]: acc.queryComponent().getAccessibleAtPoint(50, 50, pyatspi.WINDOW_COORDS).queryComponent().getExtents(pyatspi.WINDOW_COORDS) Out[21]: [6, 1, 68, 49] Fixes: #6448
This commit is contained in:
@@ -164,7 +164,7 @@ accessible_at_point (GtkAccessible *parent,
|
||||
if (!gtk_accessible_get_bounds (parent, &px, &py, &width, &height))
|
||||
return NULL;
|
||||
|
||||
if (!children_only && x >= 0 && x <= width && y >= 0 && y <= height)
|
||||
if (!children_only && x >= px && x <= px + width && y >= py && y <= py + height)
|
||||
result = parent;
|
||||
|
||||
for (GtkAccessible *child = gtk_accessible_get_first_accessible_child (parent);
|
||||
|
||||
Reference in New Issue
Block a user