[AT-SPI] Fixed providing number of items for objects of AT_SPI role DIALOG and POPUP_MENU 69/267169/5
authorMaria Bialota <m.bialota@samsung.com>
Fri, 26 Nov 2021 20:29:42 +0000 (21:29 +0100)
committerMaria Białota <m.bialota@samsung.com>
Tue, 30 Nov 2021 16:38:37 +0000 (16:38 +0000)
Change-Id: I074172a98064da6e1bc7fb957feb1c7ed4a8fe1a

src/lib/elementary/elm_atspi_bridge.c

index 7476ca3..974615b 100644 (file)
@@ -1185,7 +1185,7 @@ _accessible_get_navigable_at_point(const Eldbus_Service_Interface *iface EINA_UN
 
 //TIZEN_ONLY(20170531): add "GetReadingMaterial" interface method
 static int
-_list_children_count_check(Eo *obj)
+_list_children_count_check(Eo *obj, Efl_Access_Role container_role, Efl_Access_Role item_role)
 {
    int i;
    int list_count = 0;
@@ -1197,7 +1197,7 @@ _list_children_count_check(Eo *obj)
      return 0;
 
    role = efl_access_object_role_get(obj);
-   if (role == EFL_ACCESS_ROLE_LIST)
+   if (role == container_role)
      {
         int children_count = 0;
         children = efl_access_object_access_children_get(obj);
@@ -1207,17 +1207,16 @@ _list_children_count_check(Eo *obj)
           {
              child = eina_list_nth(children, i);
              role = efl_access_object_role_get(child);
-             if (role == EFL_ACCESS_ROLE_LIST_ITEM)
+             if (role == item_role)
                list_count++;
           }
         eina_list_free(children);
      }
-
    return list_count;
 }
 
 static int
-_list_children_count(Eo *obj)
+_list_children_count(Eo *obj, Efl_Access_Role container_role, Efl_Access_Role item_role)
 {
    Eina_List *children;
    int list_items_count = 0;
@@ -1229,7 +1228,7 @@ _list_children_count(Eo *obj)
    int i;
    Eo *child = NULL;
 
-   list_items_count = _list_children_count_check(obj);
+   list_items_count = _list_children_count_check(obj, container_role, item_role);
    if (list_items_count > 0)
      {
         eina_list_free(children);
@@ -1239,14 +1238,13 @@ _list_children_count(Eo *obj)
    for (i = 0; i < children_count; i++)
      {
         child = eina_list_nth(children, i);
-        list_items_count = _list_children_count(child);
+        list_items_count = _list_children_count(child, container_role, item_role);
         if (list_items_count > 0)
           {
              eina_list_free(children);
              return list_items_count;
           }
      }
-
    return 0;
 }
 
@@ -1263,7 +1261,7 @@ _accessible_reading_material_get(const Eldbus_Service_Interface *iface, const El
    double max_value = 0;
    double min_value = 0;
    int idx = 0;
-   int child_count = 0;
+   int list_children_count = 0;
    int selected_child_count = 0;
    uint64_t atspi_states = 0;
    Efl_Access_Role role;
@@ -1413,12 +1411,16 @@ _accessible_reading_material_get(const Eldbus_Service_Interface *iface, const El
    eina_list_free(children);
 
    /* list children count */
-   child_count = 0;
+   list_children_count = 0;
    if (role == EFL_ACCESS_ROLE_DIALOG)
      {
-        child_count = _list_children_count(obj);
+        list_children_count = _list_children_count(obj, EFL_ACCESS_ROLE_LIST, EFL_ACCESS_ROLE_LIST_ITEM);
+     }
+   else if (role == EFL_ACCESS_ROLE_POPUP_MENU)
+     {
+        list_children_count = _list_children_count(obj, EFL_ACCESS_ROLE_POPUP_MENU, EFL_ACCESS_ROLE_MENU_ITEM);
      }
-   eldbus_message_iter_basic_append(iter, 'i', child_count);
+   eldbus_message_iter_basic_append(iter, 'i', list_children_count);
 
    /* first selected child index */
    idx = 0;