atspi: check accessible parent for can_highlight 63/136363/4
authorShinwoo Kim <cinoo.kim@samsung.com>
Thu, 29 Jun 2017 07:31:44 +0000 (16:31 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 4 Jul 2017 05:00:45 +0000 (05:00 +0000)
If an object is Elm_Widget and accessible child of Elm_Widget_Item, then
can_child of this object does not check value of the Elm_Widget_Item.
Because the _elm_widget_item_highlightable has used elm_widget_parent_get.
It doesn't return Elm_Widget_Item. It returns parent object of Elm_Widget_Item.
So _elm_widget_item_highlightable should have to use accessible parent.

Change-Id: Iecbc162fc676efeb6e3162418ac3eb34b761195d

src/lib/elm_widget.c

index 8e69ebcb247ea8811dff5d32d0d7a2f80accfe77..294427648c1ff1d3580bcae7dfb76e38efc45919 100644 (file)
@@ -5027,27 +5027,20 @@ _elm_widget_item_onscreen_is(Elm_Object_Item *item)
 EAPI Eina_Bool
 _elm_widget_item_highlightable(Elm_Object_Item *item)
 {
+   Eo *parent;
+   Eina_Bool can_highlight;
+
    Elm_Widget_Item_Data *id = eo_data_scope_get(item, ELM_WIDGET_ITEM_CLASS);
    if (!id) return EINA_FALSE;
    if (!id->can_highlight) return EINA_FALSE;
-   Evas_Object *widget = id->widget;
-   Evas_Object *parent = widget;
-   Elm_Widget_Smart_Data *wd;
-   if (parent && eo_isa(parent, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
-     {
-        wd = eo_data_scope_get(parent, ELM_WIDGET_CLASS);
-        if (!wd->can_highlight) return EINA_FALSE;
-     }
-   do
+
+   eo_do(item, parent = elm_interface_atspi_accessible_parent_get());
+   while (parent && !eo_isa(parent, ELM_ATSPI_APP_OBJECT_CLASS))
      {
-        parent = elm_widget_parent_get(parent);
-        if (parent && eo_isa(parent, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
-          {
-             wd = eo_data_scope_get(parent, ELM_WIDGET_CLASS);
-             if (!wd->can_highlight) return EINA_FALSE;
-          }
+        eo_do(parent, can_highlight = elm_interface_atspi_accessible_can_highlight_get());
+        if (!can_highlight) return EINA_FALSE;
+        eo_do(parent, parent = elm_interface_atspi_accessible_parent_get());
      }
-   while (parent && (parent != elm_widget_top_get(widget)));
    return EINA_TRUE;
 }
 //
@@ -6914,25 +6907,20 @@ _elm_widget_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, Elm_W
 EAPI Eina_Bool
 _elm_widget_highlightable(Evas_Object *obj)
 {
+   Eo *parent;
+   Eina_Bool can_highlight;
+
    Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_WIDGET_CLASS);
    if (!wd) return EINA_FALSE;
    if (!wd->can_highlight) return EINA_FALSE;
-   Evas_Object *parent = elm_widget_parent_get(obj);
-   if (parent && eo_isa(parent, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
-     {
-        wd = eo_data_scope_get(parent, ELM_WIDGET_CLASS);
-        if (!wd->can_highlight) return EINA_FALSE;
-     }
-   do
+
+   eo_do(obj, parent = elm_interface_atspi_accessible_parent_get());
+   while (parent && !eo_isa(parent, ELM_ATSPI_APP_OBJECT_CLASS))
      {
-        parent = elm_widget_parent_get(parent);
-        if (parent && eo_isa(parent, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
-          {
-             wd = eo_data_scope_get(parent, ELM_WIDGET_CLASS);
-             if (!wd->can_highlight) return EINA_FALSE;
-          }
+        eo_do(parent, can_highlight = elm_interface_atspi_accessible_can_highlight_get());
+        if (!can_highlight) return EINA_FALSE;
+        eo_do(parent, parent = elm_interface_atspi_accessible_parent_get());
      }
-   while (parent && (parent != elm_widget_top_get(obj)));
    return EINA_TRUE;
 }
 //