[ATSPI] Add check the object is in the scroller content size 81/113181/2
authorJunsuChoi <jsuya.choi@samsung.com>
Mon, 6 Feb 2017 11:33:54 +0000 (20:33 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 20 Feb 2017 02:07:44 +0000 (18:07 -0800)
   When the object is outside the scroller,
   it should be unhighlightable.
   So Add check the object is in the scroller content size
   when called accessible_state_set_get

Change-Id: If96d2bb022f8b4d817cf5468f7755381353aa333

src/lib/elm_widget.c

index 4f9ee6cb26c62b20d5f6706cc618ece4495b6c70..4cee3910d86997a403795bd38ed5fe5592693f75 100644 (file)
@@ -5021,6 +5021,46 @@ _elm_widget_item_highlightable(Elm_Object_Item *item)
 }
 //
 
+//TIZEN_ONLY(20170206): Add check the object is in the scroller content size
+Eina_Bool
+_accessible_object_on_scroll_is(Eo* obj)
+{
+   if(!obj) return EINA_FALSE;
+
+   Evas_Object *target = obj;
+   Evas_Object *parent = NULL;
+   Evas_Coord x, y, w, h, wx, wy, ww, wh, nx, ny;
+
+   evas_object_geometry_get(target, &x, &y ,&w, &h);
+
+   if (elm_widget_is(target))
+     parent = elm_widget_parent_get(target);
+   else
+     parent = elm_widget_parent_widget_get(target);
+
+   while (parent)
+     {
+        if (eo_isa(parent, ELM_INTERFACE_SCROLLABLE_MIXIN))
+          {
+             evas_object_geometry_get(parent, &wx, &wy, NULL, NULL);
+             eo_do(parent, elm_interface_scrollable_content_size_get(&ww, &wh));
+             eo_do(parent, elm_interface_scrollable_content_pos_get(&nx, &ny));
+             wx -= nx;
+             wy -= ny;
+
+             if (((wx < x) && (wx + ww < x)) || ((wx > x + w) && (wx + ww > x + w)) ||
+                 ((wy < y) && (wy + wh < y)) || ((wy > y + h) && (wy + wh > y + h)))
+               return EINA_FALSE;
+
+             break;
+          }
+        parent = elm_widget_parent_get(parent);
+     }
+
+   return EINA_TRUE;
+}
+//
+
 EOLIAN static Elm_Atspi_State_Set
 _elm_widget_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_item,
                                                               Elm_Widget_Item_Data *item)
@@ -5041,7 +5081,7 @@ _elm_widget_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_item,
      STATE_TYPE_SET(states, ELM_ATSPI_STATE_SHOWING);
 
    //TIZEN_ONLY(20170717) : expose highlight information on atspi
-   if (_elm_widget_item_highlightable(eo_item))
+   if (_elm_widget_item_highlightable(eo_item) && _accessible_object_on_scroll_is(item->view))
      STATE_TYPE_SET(states, ELM_ATSPI_STATE_HIGHLIGHTABLE);
    else
      STATE_TYPE_UNSET(states, ELM_ATSPI_STATE_HIGHLIGHTABLE);
@@ -6784,7 +6824,7 @@ _elm_widget_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Widget_Sma
      }
 
    //TIZEN_ONLY(20170717) : expose highlight information on atspi
-   if (_elm_widget_highlightable(obj))
+   if (_elm_widget_highlightable(obj) && _accessible_object_on_scroll_is(obj))
      STATE_TYPE_SET(states, ELM_ATSPI_STATE_HIGHLIGHTABLE);
    else
      STATE_TYPE_UNSET(states, ELM_ATSPI_STATE_HIGHLIGHTABLE);