atspi: remove unacceptable leaf node 13/148713/2
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:43:38 +0000 (19:43 +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 3c529c0178b693dcbfc9ad8c01d422e650f340b7..2f7967f9c92fa80c0b24677731096523c9696443 100644 (file)
@@ -7329,6 +7329,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)
 {
@@ -7347,7 +7369,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 */