atspi: fix bug of finding the last object 82/136882/2
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 30 Jun 2017 09:15:29 +0000 (18:15 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 4 Jul 2017 05:12:36 +0000 (05:12 +0000)
The last object can be found only if all_children_visited is false.
The start is same with root, when looking for the last object.

The first object can be found already, even though the start is same with root.
Because the forwarding navigation can visit its children.

Change-Id: I763994505d5b2b21ee8aa459b39c08512a34a279

src/lib/elm_atspi_bridge.c

index d0f12e8..a3c834b 100644 (file)
@@ -975,10 +975,6 @@ _accessible_get_neighbor(const Eldbus_Service_Interface *iface EINA_UNUSED, cons
 
    iter = eldbus_message_iter_get(ret);
 
-   if (start == root)
-     {
-        start = NULL;
-     }
    Eo *accessible = _calculate_neighbor(bridge, root, start, direction == 1, search_mode);
    _bridge_iter_object_reference_append(bridge, iter, accessible);
    _bridge_object_register(bridge, accessible);
@@ -4576,7 +4572,10 @@ static void *_calculate_neighbor_impl(accessibility_navigation_pointer_table *ta
    // that when we begin at start node and we navigate backward, then all children
    // are visited, so navigation will ignore start's children and go to
    // previous sibling available.
-   unsigned char all_children_visited = start && (search_mode != NEIGHBOR_SEARCH_MODE_RECURSE_FROM_ROOT && !forward);
+   /* Regarding condtion (start != root):
+      The last object can be found only if all_children_visited is false.
+      The start is same with root, when looking for the last object. */
+   unsigned char all_children_visited = (start != root) && (search_mode != NEIGHBOR_SEARCH_MODE_RECURSE_FROM_ROOT && !forward);
 
    // true, if starting element should be ignored. this is only used in rare case of
    // recursive search failing to find an object.