Revert "Access: Add the missing patch related by Efl.Access_Object.relations_get" 88/197988/1 submit/tizen/20190117.121937 submit/tizen/20190118.024659 submit/tizen/20190118.084922
authorJunsuChoi <jsuya.choi@samsung.com>
Thu, 17 Jan 2019 11:29:27 +0000 (20:29 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 17 Jan 2019 11:40:23 +0000 (20:40 +0900)
This reverts commit 5194165f4f21e9777a54c6800f7367b9e8e45742.

Change-Id: Ib7973a78a44b751a5de7bf35df0d6f2c63491f3e

src/lib/elementary/efl_access_object.c
src/lib/elementary/efl_access_object.eo
src/lib/elementary/efl_access_object.h
src/lib/elementary/efl_ui_widget.c
src/lib/elementary/efl_ui_widget.eo
src/lib/elementary/elm_atspi_bridge.c
src/lib/elementary/elm_widget.h
src/lib/elementary/elm_widget_item.eo
src/tests/elementary/elm_test_atspi.c

index 1192232..2f41c7d 100644 (file)
@@ -152,7 +152,7 @@ typedef struct _Elm_Atspi_Gesture_Cb_Item Elm_Atspi_Gesture_Cb_Item;
 
 struct _Efl_Access_Object_Data
 {
-   Eina_List     *relations;
+   Efl_Access_Relation_Set relations;
    //TIZEN_ONLY(20190922): add name callback, description callback.
    Efl_Access_Reading_Info_Cb_Item name_cb_item;
    Efl_Access_Reading_Info_Cb_Item description_cb_item;
@@ -483,7 +483,7 @@ _efl_access_object_access_children_get(const Eo *obj, Efl_Access_Object_Data *pd
           {
             children = eina_list_append(children, chld);
             //TIZEN_ONLY(20181024): Fix parent-children incosistencies in atspi tree
-            efl_access_object_access_parent_set(chld, (Eo *)obj);
+            efl_access_object_access_parent_set(chld, obj);
             //
           }
      }
@@ -515,11 +515,11 @@ _efl_access_object_can_highlight_get(const Eo *obj EINA_UNUSED, Efl_Access_Objec
 }
 //
 
-EOLIAN Eina_Iterator *
-_efl_access_object_relations_get(const Eo *obj EINA_UNUSED, Efl_Access_Object_Data *pd EINA_UNUSED)
+EOLIAN Efl_Access_Relation_Set
+_efl_access_object_relation_set_get(const Eo *obj EINA_UNUSED, Efl_Access_Object_Data *pd)
 {
    //TIZEN_ONLY(20171115) Fixed the bugs and warnings in atspi relationship APIS
-   //return eina_list_iterator_new(pd->relations);
+   //return efl_access_relation_set_clone(pd->relations);
    WRN("The %s object does not implement the \"accessible_relation_set\" function.",
        efl_class_name_get(efl_class_get(obj)));
    return NULL;
@@ -602,120 +602,70 @@ _efl_access_object_translation_domain_get(const Eo *obj EINA_UNUSED, Efl_Access_
    return pd->translation_domain;
 }
 
-// TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-static void
-_efl_access_relation_free(Efl_Access_Relation *relation)
+EAPI void
+efl_access_relation_free(Efl_Access_Relation *relation)
 {
    eina_list_free(relation->objects);
    free(relation);
 }
-//
 
-// TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
+EAPI Efl_Access_Relation *
+efl_access_relation_clone(const Efl_Access_Relation *relation)
+{
+   Efl_Access_Relation *ret = calloc(1, sizeof(Efl_Access_Relation));
+   if (!ret) return NULL;
+
+   ret->type = relation->type;
+   ret->objects = eina_list_clone(relation->objects);
+   return ret;
+}
+
 static void
 _on_rel_obj_del(void *data, const Efl_Event *event)
 {
-   Eina_List **relations = data;
-//
-
+   Efl_Access_Relation_Set *set = data;
    Efl_Access_Relation *rel;
    Eina_List *l, *l2, *p, *p2;
    Eo *rel_obj;
 
-   // TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-   EINA_LIST_FOREACH_SAFE(*relations, l, l2, rel)
-   //
+   EINA_LIST_FOREACH_SAFE(*set, l, l2, rel)
      {
         EINA_LIST_FOREACH_SAFE(rel->objects, p, p2, rel_obj)
           {
-             if (rel_obj == event->object)
+          if (rel_obj == event->object)
                rel->objects = eina_list_remove_list(rel->objects, p);
           }
         if (!rel->objects)
           {
-             // TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-             *relations = eina_list_remove_list(*relations, l);
-             //
+             *set = eina_list_remove_list(*set, l);
              free(rel);
           }
      }
 }
 
-// TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-static void
-_efl_access_relation_set_relation_type_remove(Eina_List **set, Efl_Access_Relation_Type type)
-{
-   Eina_List *l;
-   Efl_Access_Relation *rel;
-   Eo *obj;
-
-   EINA_LIST_FOREACH(*set, l, rel)
-     {
-        if (rel->type == type)
-          {
-             EINA_LIST_FOREACH(rel->objects, l, obj)
-                efl_event_callback_del(obj, EFL_EVENT_DEL, _on_rel_obj_del, set);
-             *set = eina_list_remove(*set, rel);
-             _efl_access_relation_free(rel);
-             return;
-          }
-     }
-}
-
-static void
-_efl_access_relation_set_free(Eina_List **relations)
-{
-   Efl_Access_Relation *rel;
-   Eo *obj;
-
-   EINA_LIST_FREE(*relations, rel)
-     {
-        Eina_List *l;
-
-        EINA_LIST_FOREACH(rel->objects, l, obj)
-          efl_event_callback_del(obj, EFL_EVENT_DEL, _on_rel_obj_del, relations);
-        eina_list_free(rel->objects);
-        free(rel);
-     }
-}
-//
-
-static void
-efl_access_relation_set_free(Efl_Access_Object_Data *sd)
-{
-   // TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-   _efl_access_relation_set_free(&sd->relations);
-   //
-}
-
-
-// TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-static Eina_Bool
-_efl_access_object_relation_append(Eina_List **relations, Efl_Access_Relation_Type type, const Eo *relation)
+EAPI Eina_Bool
+efl_access_relation_set_relation_append(Efl_Access_Relation_Set *set, Efl_Access_Relation_Type type, const Eo *rel_obj)
 {
    Efl_Access_Relation *rel;
-   //TIZEN_ONLY(20171208): elm: [atspi]Demote relation object if the object exist
    Eina_List *l, *ll;
-   //
 
-   EINA_LIST_FOREACH(*relations, l, rel)
+   if (!efl_isa(rel_obj, EFL_ACCESS_OBJECT_MIXIN))
+     return EINA_FALSE;
+
+   EINA_LIST_FOREACH(*set, l, rel)
      {
         if (rel->type == type)
           {
-             //TIZEN_ONLY(20171208): elm: [atspi]Demote relation object if the object exist
-             ll = eina_list_data_find(rel->objects, relation);
+             ll = eina_list_data_find_list(rel->objects, rel_obj);
              if (!ll)
-             //
                {
-                  rel->objects = eina_list_append(rel->objects, relation);
-                  efl_event_callback_add((Eo *) relation, EFL_EVENT_DEL, _on_rel_obj_del, relations);
+                  rel->objects = eina_list_append(rel->objects, rel_obj);
+                  efl_event_callback_add((Eo *) rel_obj, EFL_EVENT_DEL, _on_rel_obj_del, set);
                }
-             //TIZEN_ONLY(20171208): elm: [atspi]Demote relation object if the object exist
              else
                {
                   rel->objects = eina_list_demote_list(rel->objects, ll);
                }
-             //
              return EINA_TRUE;
           }
      }
@@ -724,94 +674,84 @@ _efl_access_object_relation_append(Eina_List **relations, Efl_Access_Relation_Ty
    if (!rel) return EINA_FALSE;
 
    rel->type = type;
-   rel->objects = eina_list_append(rel->objects, relation);
-   *relations = eina_list_append(*relations, rel);
-
-   efl_event_callback_add((Eo *) relation, EFL_EVENT_DEL, _on_rel_obj_del, relations);
+   rel->objects = eina_list_append(rel->objects, rel_obj);
+   *set = eina_list_append(*set, rel);
 
+   efl_event_callback_add((Eo *) rel_obj, EFL_EVENT_DEL, _on_rel_obj_del, set);
    return EINA_TRUE;
 }
-//
 
-EOLIAN static Eina_Bool
-_efl_access_object_relationship_append(Eo *obj EINA_UNUSED, Efl_Access_Object_Data *sd, Efl_Access_Relation_Type type, const Efl_Access_Object *relation)
-{
-   // TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-   return _efl_access_object_relation_append(&sd->relations, type, relation);
-   //
-}
-
-// TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-static void
-_efl_access_object_relation_remove(Eina_List** relations, Efl_Access_Relation_Type type, const Efl_Access_Object *relation)
+EAPI void
+efl_access_relation_set_relation_remove(Efl_Access_Relation_Set *set, Efl_Access_Relation_Type type, const Eo *rel_obj)
 {
-   Efl_Access_Relation *rel;
    Eina_List *l;
+   Efl_Access_Relation *rel;
 
-   EINA_LIST_FOREACH(*relations, l, rel)
+   EINA_LIST_FOREACH(*set, l, rel)
      {
         if (rel->type == type)
           {
-             if (relation)
+             if (eina_list_data_find(rel->objects, rel_obj))
                {
-                  if (eina_list_data_find(rel->objects, relation))
-                    {
-                       efl_event_callback_del((Eo *) relation, EFL_EVENT_DEL, _on_rel_obj_del, relations);
-                       rel->objects = eina_list_remove(rel->objects, relation);
-                    }
-                  if (!rel->objects)
-                    {
-                       *relations = eina_list_remove(*relations, rel);
-                       free(rel);
-                    }
+                  efl_event_callback_del((Eo *) rel_obj, EFL_EVENT_DEL, _on_rel_obj_del, set);
+                  rel->objects = eina_list_remove(rel->objects, rel_obj);
                }
-             else
+             if (!rel->objects)
                {
-                  Eina_List *ll;
-                  Eo *ro;
-
-                  EINA_LIST_FOREACH(rel->objects, ll, ro)
-                    efl_event_callback_del(ro, EFL_EVENT_DEL, _on_rel_obj_del, relations);
-                  *relations = eina_list_remove(*relations, rel);
-                  free(rel);
+                  *set = eina_list_remove(*set, rel);
+                  efl_access_relation_free(rel);
                }
-             return ;
+             return;
           }
      }
 }
-//
 
-EOLIAN static void
-_efl_access_object_relationship_remove(Eo *obj EINA_UNUSED, Efl_Access_Object_Data *sd, Efl_Access_Relation_Type type, const Efl_Access_Object *relation)
+EAPI void
+efl_access_relation_set_relation_type_remove(Efl_Access_Relation_Set *set, Efl_Access_Relation_Type type)
 {
-   // TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-   _efl_access_object_relation_remove(&sd->relations, type, relation);
-   //
+   Eina_List *l;
+   Efl_Access_Relation *rel;
+   Eo *obj;
+
+   EINA_LIST_FOREACH(*set, l, rel)
+     {
+        if (rel->type == type)
+          {
+             EINA_LIST_FOREACH(rel->objects, l, obj)
+                efl_event_callback_del(obj, EFL_EVENT_DEL, _on_rel_obj_del, set);
+             *set = eina_list_remove(*set, rel);
+             efl_access_relation_free(rel);
+             return;
+          }
+     }
 }
 
-// TIZEN_ONLY(20190104): Access: Add the missing patch related by Efl.Access_Object.relations_get
-static Efl_Access_Relation *
-_efl_access_relation_clone(const Efl_Access_Relation *relation)
+//TIZEN_ONLY(20171115) Fixed the bugs and warnings in atspi relationship APIS
+EAPI void
+efl_access_relation_set_free(Efl_Access_Relation_Set *set)
 {
-   Efl_Access_Relation *ret = calloc(1, sizeof(Efl_Access_Relation));
-   if (!ret) return NULL;
+   Efl_Access_Relation *rel;
+   Eina_List *l;
+   Eo *obj;
 
-   ret->type = relation->type;
-   ret->objects = eina_list_clone(relation->objects);
-   return ret;
+   EINA_LIST_FREE(*set, rel)
+     {
+        EINA_LIST_FOREACH(rel->objects, l, obj)
+           efl_event_callback_del(obj, EFL_EVENT_DEL, _on_rel_obj_del, set);
+        efl_access_relation_free(rel);
+     }
 }
 
-
-static Eina_List *
-_efl_access_relation_set_clone(const Eina_List **set)
+EAPI Efl_Access_Relation_Set
+efl_access_relation_set_clone(const Efl_Access_Relation_Set *set)
 {
-   Eina_List *ret = NULL;
+   Efl_Access_Relation_Set ret = NULL;
    Eina_List *l;
    Efl_Access_Relation *rel;
 
    EINA_LIST_FOREACH(*set, l, rel)
      {
-        Efl_Access_Relation *cpy = _efl_access_relation_clone(rel);
+        Efl_Access_Relation *cpy = efl_access_relation_clone(rel);
         ret = eina_list_append(ret, cpy);
      }
 
@@ -819,10 +759,27 @@ _efl_access_relation_set_clone(const Eina_List **set)
 }
 //
 
+EOLIAN static Eina_Bool
+_efl_access_object_relationship_append(Eo *obj EINA_UNUSED, Efl_Access_Object_Data *sd, Efl_Access_Relation_Type type, const Efl_Access_Object *relation_obj)
+{
+   return efl_access_relation_set_relation_append(&sd->relations, type, relation_obj);
+}
+
+EOLIAN static void
+_efl_access_object_relationship_remove(Eo *obj EINA_UNUSED, Efl_Access_Object_Data *sd, Efl_Access_Relation_Type type, const Efl_Access_Object *relation_obj)
+{
+   if (relation_obj)
+     efl_access_relation_set_relation_remove(&sd->relations, type, relation_obj);
+   else
+     efl_access_relation_set_relation_type_remove(&sd->relations, type);
+}
+
 EOLIAN static void
 _efl_access_object_relationships_clear(Eo *obj EINA_UNUSED, Efl_Access_Object_Data *sd)
 {
-   efl_access_relation_set_free(sd);
+   //TIZEN_ONLY(20171115) Fixed the bugs and warnings in atspi relationship APIS
+   efl_access_relation_set_free(&sd->relations);
+   //
    sd->relations = NULL;
 }
 
@@ -880,19 +837,12 @@ _efl_access_object_access_root_get(const Eo *class EINA_UNUSED, void *pd EINA_UN
 }
 
 EOLIAN void
-_efl_access_object_efl_object_invalidate(Eo *obj, Efl_Access_Object_Data *pd)
-{
-   efl_access_relation_set_free(pd);
-
-   efl_invalidate(efl_super(obj, EFL_ACCESS_OBJECT_MIXIN));
-}
-
-EOLIAN void
 _efl_access_object_efl_object_destructor(Eo *obj, Efl_Access_Object_Data *pd)
 {
    eina_stringshare_del(pd->name);
    eina_stringshare_del(pd->description);
    eina_stringshare_del(pd->translation_domain);
+   efl_access_relation_set_free(&pd->relations);
    //TIZEN_ONLY(20181211): Fix for missing unregistration of atspi objects
    unregister_atspi_object_in_bridge(obj);
    //
@@ -962,15 +912,7 @@ elm_atspi_accessible_name_cb_set(Elm_Interface_Atspi_Accessible *obj, Elm_Atspi_
 EAPI Elm_Atspi_Relation_Set
 elm_atspi_accessible_relation_set_get(const Elm_Interface_Atspi_Accessible *obj)
 {
-   Elm_Atspi_Relation_Set relation_set;
-   Eina_Iterator *relations = efl_access_object_relations_get(obj);
-   Efl_Access_Relation *rel;
-   EINA_ITERATOR_FOREACH(relations, rel)
-     {
-        relation_set = eina_list_append(relation_set, rel);
-     }
-   eina_iterator_free(relations);
-   return eina_list_clone(relation_set);
+   return efl_access_object_relation_set_get(obj);
 }
 
 EAPI void
@@ -1102,37 +1044,37 @@ elm_atspi_accessible_state_notify(Elm_Interface_Atspi_Accessible *obj, Elm_Atspi
 
 EAPI void elm_atspi_relation_set_free(Elm_Atspi_Relation_Set *set)
 {
-   _efl_access_relation_set_free(set);
+   efl_access_relation_set_free(set);
 }
 
 EAPI Elm_Atspi_Relation_Set elm_atspi_relation_set_clone(const Elm_Atspi_Relation_Set *set)
 {
-   return _efl_access_relation_set_clone(set);
+   return efl_access_relation_set_clone(set);
 }
 
 EAPI void elm_atspi_relation_free(Elm_Atspi_Relation *relation)
 {
-   _efl_access_relation_free(relation);
+   efl_access_relation_free(relation);
 }
 
 EAPI Elm_Atspi_Relation * elm_atspi_relation_clone(const Elm_Atspi_Relation *relation)
 {
-   return _efl_access_relation_clone(relation);
+   return efl_access_relation_clone(relation);
 }
 
 EAPI Eina_Bool elm_atspi_relation_set_relation_append(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj)
 {
-   return _efl_access_object_relation_append(set, type, rel_obj);
+   return efl_access_relation_set_relation_append(set, type, rel_obj);
 }
 
 EAPI void elm_atspi_relation_set_relation_remove(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj)
 {
-   _efl_access_object_relation_remove(set, type, rel_obj);
+   efl_access_relation_set_relation_remove(set, type, rel_obj);
 }
 
 EAPI void elm_atspi_relation_set_relation_type_remove(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type)
 {
-   _efl_access_relation_set_relation_type_remove(set, type);
+   efl_access_relation_set_relation_type_remove(set, type);
 }
 
 EAPI void elm_atspi_attributes_list_free(Eina_List *list)
index 81719be..10a6bb0 100644 (file)
@@ -308,6 +308,8 @@ struct Efl.Access.Gesture_Info
    event_time: uint; [[gesture occurance time]]
 }
 
+type Efl.Access.Relation_Set: list<ptr(Efl.Access.Relation)>; [[Elementary Accessibility relation set type]]
+
 mixin Efl.Access.Object requires Efl.Object
 {
    [[Accessibility accessible mixin]]
@@ -347,9 +349,13 @@ mixin Efl.Access.Object requires Efl.Object
          }
       }
       //
-      relations_get @protected @beta @const {
-         [[Gets an all relations between accessible object and other accessible objects.]]
-         return: iterator<ptr(Efl.Access.Relation)>; [[Accessible relation set]]
+      @property relation_set @protected @beta {
+         get {
+            [[Gets an all relations between accessible object and other accessible objects.]]
+         }
+         values {
+            relations: Efl.Access.Relation_Set; [[Accessible relation set]]
+         }
       }
       @property role @beta {
          get {
@@ -626,7 +632,6 @@ mixin Efl.Access.Object requires Efl.Object
    }
    implements {
       Efl.Object.destructor;
-      Efl.Object.invalidate;
    }
    events {
       property,changed: string; [[Called when property has changed]]
index a0edfbb..c6eb985 100644 (file)
@@ -69,6 +69,43 @@ typedef enum _Efl_Access_Move_Outed_Type Efl_Access_Move_Outed_Type;
  */
 EAPI void efl_access_attributes_list_free(Eina_List *list);
 
+/**
+ * Frees relation.
+ */
+EAPI void efl_access_relation_free(Efl_Access_Relation *relation);
+
+/**
+ * Clones relation.
+ */
+EAPI Efl_Access_Relation * efl_access_relation_clone(const Efl_Access_Relation *relation);
+
+/**
+ * Appends relation to relation set
+ */
+EAPI Eina_Bool efl_access_relation_set_relation_append(Efl_Access_Relation_Set *set, Efl_Access_Relation_Type type, const Eo *rel_obj);
+
+/**
+ * Removes relation from relation set
+ */
+EAPI void efl_access_relation_set_relation_remove(Efl_Access_Relation_Set *set, Efl_Access_Relation_Type type, const Eo *rel_obj);
+
+/**
+ * Removes all relation from relation set of a given type
+ */
+EAPI void efl_access_relation_set_relation_type_remove(Efl_Access_Relation_Set *set, Efl_Access_Relation_Type type);
+
+//TIZEN_ONLY(20171115) Fixed the bugs and warnings in atspi relationship APIS
+/**
+ * Frees Efl_Access_Relation_Set
+ */
+EAPI void efl_access_relation_set_free(Efl_Access_Relation_Set *set);
+
+/**
+ * Clones Efl_Access_Relation_Set
+ */
+EAPI Efl_Access_Relation_Set efl_access_relation_set_clone(const Efl_Access_Relation_Set *set);
+//
+
 #ifdef EFL_EO_API_SUPPORT
 
 /**
index 1ea8298..54b804c 100644 (file)
@@ -5564,7 +5564,7 @@ _elm_widget_item_efl_object_destructor(Eo *eo_item, Elm_Widget_Item_Data *item)
 
    // TIZEN_ONLY(20150709) : atspi relations api
    if (item->atspi_custom_relations)
-     elm_atspi_relation_set_free(&item->atspi_custom_relations);
+     efl_access_relation_set_free(&item->atspi_custom_relations);
    //
 
    //TIZEN_ONLY(20150731) : add i18n support for name and description
@@ -7108,7 +7108,7 @@ _efl_ui_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd)
 
    // TIZEN_ONLY(20150709) : atspi relations api
    if (sd->atspi_custom_relations)
-     elm_atspi_relation_set_free(&sd->atspi_custom_relations);
+     efl_access_relation_set_free(&sd->atspi_custom_relations);
    //
 
    //TIZEN_ONLY(20150717) add widget name setter
@@ -7714,53 +7714,52 @@ _efl_ui_widget_efl_access_object_attributes_get(const Eo *obj, Elm_Widget_Smart_
 }
 
 // TIZEN_ONLY(20150709) : atspi relations api
-EOLIAN static Eina_Iterator *
-_efl_ui_widget_efl_access_object_relations_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
+EOLIAN static Efl_Access_Relation_Set
+_efl_ui_widget_efl_access_object_relation_set_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
 {
-   return eina_list_iterator_new(sd->atspi_custom_relations);
+   return efl_access_relation_set_clone(&sd->atspi_custom_relations);
 }
-
 EOLIAN static Eina_Bool
 _efl_ui_widget_efl_access_object_relationship_append(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Efl_Access_Relation_Type type, const Eo *relation_obj)
 {
-   return elm_atspi_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj);
+   return efl_access_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj);
 }
 
 EOLIAN static void
 _efl_ui_widget_efl_access_object_relationship_remove(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Efl_Access_Relation_Type type, const Eo *relation_obj)
 {
-   elm_atspi_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj);
+   efl_access_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj);
 }
 
 EOLIAN static void
 _efl_ui_widget_efl_access_object_relationships_clear(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
 {
-   elm_atspi_relation_set_free(&sd->atspi_custom_relations);
+   efl_access_relation_set_free(&sd->atspi_custom_relations);
    sd->atspi_custom_relations = NULL;
 }
 
-EOLIAN static Eina_Iterator *
-_elm_widget_item_efl_access_object_relations_get(const Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd)
+EOLIAN static Elm_Atspi_Relation_Set
+_elm_widget_item_efl_access_object_relation_set_get(const Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd)
 {
-   return eina_list_iterator_new(sd->atspi_custom_relations);
+   return efl_access_relation_set_clone(&sd->atspi_custom_relations);
 }
 
 EOLIAN static Eina_Bool
 _elm_widget_item_efl_access_object_relationship_append(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd, Efl_Access_Relation_Type type, const Eo *relation_obj)
 {
-   return elm_atspi_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj);
+   return efl_access_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj);
 }
 
 EOLIAN static void
 _elm_widget_item_efl_access_object_relationship_remove(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd, Efl_Access_Relation_Type type, const Eo *relation_obj)
 {
-   elm_atspi_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj);
+   efl_access_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj);
 }
 
 EOLIAN static void
 _elm_widget_item_efl_access_object_relationships_clear(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd)
 {
-   elm_atspi_relation_set_free(&sd->atspi_custom_relations);
+   efl_access_relation_set_free(&sd->atspi_custom_relations);
    sd->atspi_custom_relations = NULL;
 }
 //////////////////////////////
index 4ffbd52..58b36b3 100644 (file)
@@ -862,7 +862,7 @@ abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access.Object,
       //
 
       //TIZEN_ONLY(20150709) : atspi relations api
-      Efl.Access.Object.relations_get;
+      Efl.Access.Object.relation_set { get;}
       Efl.Access.Object.relationship_append;
       Efl.Access.Object.relationship_remove;
       Efl.Access.Object.relationships_clear;
index 1c82f50..ca2b48c 100644 (file)
@@ -919,9 +919,9 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
    Eo *rel_obj, *obj = _bridge_object_from_path(bridge, obj_path);
    Eldbus_Message *ret = NULL;
    Eldbus_Message_Iter *iter = NULL, *iter_array = NULL, *iter_array2 = NULL, *iter_struct;
-   const Efl_Access_Relation *rel;
-   Eina_List *l;
-   Eina_Iterator *it;
+   Efl_Access_Relation *rel;
+   Eina_List *l, *l2;
+   Efl_Access_Relation_Set rels;
 
    ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_OBJECT_MIXIN, msg);
 
@@ -932,14 +932,15 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
    iter_array = eldbus_message_iter_container_new(iter, 'a', "(ua(so))");
    EINA_SAFETY_ON_NULL_GOTO(iter_array, fail);
 
-   it = efl_access_object_relations_get(obj);
-   EINA_ITERATOR_FOREACH(it, rel)
+   rels = efl_access_object_relation_set_get(obj);
+
+   EINA_LIST_FOREACH(rels, l, rel)
      {
         iter_struct = eldbus_message_iter_container_new(iter_array, 'r', NULL);
         eldbus_message_iter_basic_append(iter_struct, 'u', _elm_relation_to_atspi_relation(rel->type));
         iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)");
         EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail);
-        EINA_LIST_FOREACH(rel->objects, l, rel_obj)
+        EINA_LIST_FOREACH(rel->objects, l2, rel_obj)
           {
              _bridge_iter_object_reference_append(bridge, iter_array2, rel_obj);
              _bridge_object_register(bridge, rel_obj);
@@ -947,7 +948,9 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
         eldbus_message_iter_container_close(iter_struct, iter_array2);
         eldbus_message_iter_container_close(iter_array, iter_struct);
      }
-   eina_iterator_free(it);
+   //TIZEN_ONLY(20171115) Fixed the bugs and warnings in atspi relationship APIS
+   efl_access_relation_set_free(&rels);
+   //
    eldbus_message_iter_container_close(iter, iter_array);
 
    return ret;
@@ -1236,13 +1239,13 @@ _accessible_reading_material_get(const Eldbus_Service_Interface *iface, const El
    Efl_Access_Role role;
    Efl_Access_Attribute *attr;
    Efl_Access_State_Set states;
+   Efl_Access_Relation_Set rels = NULL;
    Efl_Access_Relation *rel;
    Eo *relation_obj = NULL;
    Eo *parent = NULL;
    Eo *child = NULL;
    Eina_Bool is_selected = EINA_FALSE;
    AtspiRole atspi_role = ATSPI_ROLE_INVALID;
-   Eina_Iterator *it;
 
    const char *obj_path = eldbus_message_path_get(msg);
    Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
@@ -1276,8 +1279,8 @@ _accessible_reading_material_get(const Eldbus_Service_Interface *iface, const El
    eldbus_message_iter_basic_append(iter, 's', name);
 
    /* name - LABELED_BY relation */
-   it = efl_access_object_relations_get(obj);
-   EINA_ITERATOR_FOREACH(it, rel)
+   rels = efl_access_object_relation_set_get(obj);
+   EINA_LIST_FOREACH(rels, l, rel)
      {
         if (rel->type == EFL_ACCESS_RELATION_LABELLED_BY)
           {
@@ -1437,7 +1440,8 @@ _accessible_reading_material_get(const Eldbus_Service_Interface *iface, const El
    eldbus_message_iter_basic_append(iter, 'i', selected_child_count);
 
    /* relation object - DESCRIBED_BY */
-   EINA_ITERATOR_FOREACH(it, rel)
+   relation_obj = NULL;
+   EINA_LIST_FOREACH(rels, l, rel)
      {
         if (rel->type == EFL_ACCESS_RELATION_DESCRIBED_BY)
           {
@@ -1447,12 +1451,12 @@ _accessible_reading_material_get(const Eldbus_Service_Interface *iface, const El
           }
      }
    _bridge_iter_object_reference_append(bridge, iter, relation_obj);
-   eina_iterator_free(it);
+   efl_access_relation_set_free(&rels);
 
    return ret;
 
 fail:
-   if (it) eina_iterator_free(it);
+   if (rels) efl_access_relation_set_free(&rels);
    if (ret) eldbus_message_unref(ret);
    return NULL;
 }
@@ -5011,10 +5015,12 @@ static void *_get_object_in_relation_by_type_impl(struct accessibility_navigatio
    if (ptr)
      {
        const Eo *source = ptr;
+       Efl_Access_Relation_Set relations;
        Efl_Access_Relation_Type expected_relation_type = _atspi_relation_to_elm_relation(type);
-       Eina_Iterator *relations = efl_access_object_relations_get(source);
+       relations = efl_access_object_relation_set_get(source);
        Efl_Access_Relation *rel;
-       EINA_ITERATOR_FOREACH(relations, rel)
+       Eina_List *l;
+       EINA_LIST_FOREACH(relations, l, rel)
          {
            if (rel->type == expected_relation_type)
              {
index c33a583..862b127 100644 (file)
@@ -376,7 +376,7 @@ typedef struct _Elm_Widget_Smart_Data
    Eina_List                    *event_cb;
 
    //TIZEN_ONLY(20150709) add relations atpi
-   Eina_List                    *atspi_custom_relations; /**< Developer-defined accessiblity relations */
+   Efl_Access_Relation_Set       atspi_custom_relations; /**< Developer-defined accessiblity relations */
    ///////////////////////////////////
    //TIZEN_ONLY(20150713) : add widget_item name setter
    const char                    *name;
@@ -646,7 +646,7 @@ struct _Elm_Widget_Item_Data
    const char                    *atspi_translation_domain;
    ///
    //TIZEN_ONLY(20150709) add relations atpi
-   Eina_List                     *atspi_custom_relations; /**< Developer-defined accessiblity relations */
+   Efl_Access_Relation_Set        atspi_custom_relations; /**< Developer-defined accessiblity relations */
    ///////////////////////////////////
 
    /***********************************************************************************
index e51b76d..9efa014 100644 (file)
@@ -562,7 +562,7 @@ class Elm.Widget.Item(Efl.Object, Efl.Access.Object,
            //
 
            //TIZEN_ONLY(20150709) : atspi relations api
-           Efl.Access.Object.relations_get;
+           Efl.Access.Object.relation_set { get; }
            Efl.Access.Object.relationship_append;
            Efl.Access.Object.relationship_remove;
            Efl.Access.Object.relationships_clear;
index ff70c5b..d5a30ae 100644 (file)
@@ -281,46 +281,42 @@ EFL_START_TEST (test_efl_access_object_relationship_append)
 {
    generate_app();
 
+   Efl_Access_Relation_Set set;
    Efl_Access_Relation *rel, *rel_to, *rel_from;
-   Eina_Iterator *it;
-   unsigned int i = 0;
+   Eina_List *l;
 
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_bg);
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_FROM, g_win);
-   it = efl_access_object_relations_get(g_btn);
+   set = efl_access_object_relation_set_get(g_btn);
 
-   ck_assert(it != NULL);
+   ck_assert(set != NULL);
+   ck_assert(eina_list_count(set) >= 2);
 
    rel_to = rel_from = NULL;
-   EINA_ITERATOR_FOREACH(it, rel)
+   EINA_LIST_FOREACH(set, l, rel)
    {
-      i++;
-
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_TO)
         rel_to = rel;
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_FROM)
         rel_from = rel;
    }
 
-   ck_assert(i >= 2);
    ck_assert(rel_to != NULL);
    ck_assert(eina_list_data_find(rel_to->objects, g_bg) != NULL);
 
    ck_assert(rel_from != NULL);
    ck_assert(eina_list_data_find(rel_from->objects, g_win) != NULL);
 
-   eina_iterator_free(it);
+   efl_access_relation_set_free(set);
 
    /* Check if append do not procude duplicated relations */
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_bg);
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_FROM, g_win);
-   it = efl_access_object_relations_get(g_btn); i = 0;
+   set = efl_access_object_relation_set_get(g_btn);
 
    rel_to = rel_from = NULL;
-   EINA_ITERATOR_FOREACH(it, rel)
+   EINA_LIST_FOREACH(set, l, rel)
    {
-      i++;
-
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_TO)
         rel_to = rel;
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_FROM)
@@ -337,7 +333,8 @@ EFL_START_TEST (test_efl_access_object_relationship_append)
    rel_from->objects = eina_list_remove(rel_from->objects, g_win);
    ck_assert(eina_list_data_find(rel_from->objects, g_win) == NULL);
 
-   eina_iterator_free(it);
+   efl_access_relation_set_free(set);
+
 }
 EFL_END_TEST
 
@@ -345,48 +342,43 @@ EFL_START_TEST (test_efl_access_object_relationship_remove)
 {
    generate_app();
 
+   Efl_Access_Relation_Set set;
    Efl_Access_Relation *rel, *rel_to, *rel_from;
-   Eina_Iterator *it;
-   unsigned int i = 0;
+   Eina_List *l;
 
    /* Test if removal of single relationship works */
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_bg);
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_FROM, g_win);
    efl_access_object_relationship_remove(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_bg);
-   it = efl_access_object_relations_get(g_btn);
+   set = efl_access_object_relation_set_get(g_btn);
 
-   ck_assert(it != NULL);
+   ck_assert(set != NULL);
+   ck_assert(eina_list_count(set) >= 1);
 
    rel_to = rel_from = NULL;
-   EINA_ITERATOR_FOREACH(it, rel)
+   EINA_LIST_FOREACH(set, l, rel)
    {
-      i++;
-
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_TO)
         rel_to = rel;
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_FROM)
         rel_from = rel;
    }
 
-   ck_assert(i >= 1);
-
    if (rel_to) ck_assert(eina_list_data_find(rel_to->objects, g_bg) == NULL);
    ck_assert(rel_from != NULL);
    ck_assert(eina_list_data_find(rel_from->objects, g_win) != NULL);
 
-   eina_iterator_free(it);
+   efl_access_relation_set_free(set);
 
    /* Test if removal of type relationship works */
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_bg);
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_win);
    efl_access_object_relationship_remove(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, NULL);
-   it = efl_access_object_relations_get(g_btn); i = 0;
+   set = efl_access_object_relation_set_get(g_btn);
 
    rel_to = rel_from = NULL;
-   EINA_ITERATOR_FOREACH(it, rel)
+   EINA_LIST_FOREACH(set, l, rel)
    {
-      i++;
-
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_TO)
         rel_to = rel;
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_FROM)
@@ -397,19 +389,17 @@ EFL_START_TEST (test_efl_access_object_relationship_remove)
    ck_assert(rel_from != NULL);
    ck_assert(eina_list_data_find(rel_from->objects, g_win) != NULL);
 
-   eina_iterator_free(it);
+   efl_access_relation_set_free(set);
 
    /* Test if relationship is implicity removed when object is deleted */
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_TO, g_bg);
    efl_access_object_relationship_append(g_btn, EFL_ACCESS_RELATION_FLOWS_FROM, g_bg);
    efl_del(g_bg);
-   it = efl_access_object_relations_get(g_btn); i = 0;
+   set = efl_access_object_relation_set_get(g_btn);
 
    rel_to = rel_from = NULL;
-   EINA_ITERATOR_FOREACH(it, rel)
+   EINA_LIST_FOREACH(set, l, rel)
    {
-      i++;
-
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_TO)
         rel_to = rel;
       if (rel->type == EFL_ACCESS_RELATION_FLOWS_FROM)
@@ -419,14 +409,15 @@ EFL_START_TEST (test_efl_access_object_relationship_remove)
    if (rel_to) ck_assert(eina_list_data_find(rel_to->objects, g_bg) == NULL);
    if (rel_from) ck_assert(eina_list_data_find(rel_from->objects, g_bg) == NULL);
 
-   eina_iterator_free(it);
+   efl_access_relation_set_free(set);
 }
 EFL_END_TEST
 
 EFL_START_TEST (test_efl_access_object_relationships_clear)
 {
+   Efl_Access_Relation_Set set;
    Efl_Access_Relation *rel;
-   Eina_Iterator *it;
+   Eina_List *l;
 
    generate_app();
 
@@ -437,15 +428,16 @@ EFL_START_TEST (test_efl_access_object_relationships_clear)
 
    efl_access_object_relationships_clear(g_btn);
 
-   it = efl_access_object_relations_get(g_btn);
-   EINA_ITERATOR_FOREACH(it, rel)
+   set = efl_access_object_relation_set_get(g_btn);
+   EINA_LIST_FOREACH(set, l, rel)
    {
       ck_assert(!((rel->type == EFL_ACCESS_RELATION_FLOWS_TO) && eina_list_data_find(rel->objects, g_bg)));
       ck_assert(!((rel->type == EFL_ACCESS_RELATION_FLOWS_FROM) && eina_list_data_find(rel->objects, g_bg)));
       ck_assert(!((rel->type == EFL_ACCESS_RELATION_FLOWS_TO) && eina_list_data_find(rel->objects, g_win)));
       ck_assert(!((rel->type == EFL_ACCESS_RELATION_FLOWS_FROM) && eina_list_data_find(rel->objects, g_win)));
    }
-   eina_iterator_free(it);
+
+   efl_access_relation_set_free(set);
 }
 EFL_END_TEST