Add NEIGHBOR_SEARCH_MODE_RECURSE_TO_OUTSIDE mode 35/136235/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Thu, 15 Jun 2017 12:29:03 +0000 (21:29 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 28 Jun 2017 23:59:53 +0000 (08:59 +0900)
The "GetNeighbor" method returns an accessible object which has same bus with
root object. But the returned recurse value is 1.

The following is the case.
If embedded object has highlight, and there is no more previous object, then
it returns PROXY object which has embedding side bus information.

In this case, the "GetNeighbor" should find previous sibling object in embedding
process. The "GetNeighbor" is using NEIGHBOR_SEARCH_MODE_RECURSE_TO_OUTSIDE for
this case.

Change-Id: Icae2709b2746bd970643034c2d66b1c196c65ca9

atspi/atspi-accessible.c

index bafe114..40053f2 100644 (file)
@@ -583,6 +583,7 @@ typedef enum {
   NEIGHBOR_SEARCH_MODE_NORMAL = 0,
   NEIGHBOR_SEARCH_MODE_RECURSE_FROM_ROOT = 1,
   NEIGHBOR_SEARCH_MODE_CONTINUE_AFTER_FAILED_RECURSING = 2,
+  NEIGHBOR_SEARCH_MODE_RECURSE_TO_OUTSIDE = 3,
 } GetNeighborSearchMode;
 /**
  * atspi_accessible_get_neighbor:
@@ -630,10 +631,17 @@ atspi_accessible_get_neighbor (AtspiAccessible *root,
     // thus we're recursing. should the recurse failed to find anything it will end with
     if (ret && recurse) {
       g_object_unref(G_OBJECT(start));
-      g_queue_push_tail(children_root_stack, ret);
       start = ret;
       g_object_ref(start);
-      search_mode = NEIGHBOR_SEARCH_MODE_RECURSE_FROM_ROOT;
+      if (are_objects_on_the_same_bus(root, ret))
+        {
+          search_mode = NEIGHBOR_SEARCH_MODE_RECURSE_TO_OUTSIDE;
+        }
+      else
+        {
+          g_queue_push_tail(children_root_stack, ret);
+          search_mode = NEIGHBOR_SEARCH_MODE_RECURSE_FROM_ROOT;
+        }
       continue;
     }
     // found the one we've been looking for