atspi: remove unacceptable leaf node 11/148711/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 8 Sep 2017 07:46:32 +0000 (16:46 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Fri, 8 Sep 2017 10:41:04 +0000 (19:41 +0900)
An object could have children which have same position.
In this case, if first child of this object is not acceptable leaf node, then
there is no chance to find second child object.

Change-Id: If6887dc04bce4590ab4123cb79914172b5a4ca48

src/lib/elm_widget.c

index a5504152bda45cd24f42d7affefb04a79815e3cb..4a6530bc98f376f0c764f80e0584c7fdbf741969 100644 (file)
@@ -7328,6 +7328,28 @@ _child_object_at_point_get(Eo *obj, int x, int y)
    return obj;
 }
 
+static Eina_Bool
+_is_acceptable_leaf(Eo *obj)
+{
+   Elm_Atspi_Role role;
+   Eina_List *children;
+
+   eo_do(obj, role = elm_interface_atspi_accessible_role_get());
+   switch (role)
+     {
+       case ELM_ATSPI_ROLE_IMAGE:
+       case ELM_ATSPI_ROLE_ICON:
+         eo_do(obj, children = elm_interface_atspi_accessible_children_get());
+         if (!children) return EINA_FALSE;
+         break;
+
+       default:
+         break;
+     }
+
+   return EINA_TRUE;
+}
+
 static Eo *
 _accessible_at_point_top_down_get(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Eina_Bool screen_coords, int x, int y)
 {
@@ -7346,7 +7368,7 @@ _accessible_at_point_top_down_get(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSE
 
    EINA_LIST_FOREACH(children, l2, child)
      {
-        if (_is_inside(child, x, y))
+        if (_is_inside(child, x, y) && _is_acceptable_leaf(child))
           valid_children = eina_list_append(valid_children, child);
      }
    /* Get evas_object stacked at given x,y coordinates starting from top */