atspi: set _accessibility_currently_highlighted_obj to NULL in object delete callback 70/81770/3
authorShinwoo Kim <cinoo.kim@samsung.com>
Thu, 28 Jul 2016 08:33:39 +0000 (17:33 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Fri, 5 Aug 2016 04:51:43 +0000 (13:51 +0900)
Change-Id: If19a0a6fc08a4d42d48efca24de6d3f3488f56d2

src/lib/elm_gengrid.c
src/lib/elm_genlist.c
src/lib/elm_list.c
src/lib/elm_win.c
src/mobile_lib/elm_genlist.c

index 1732076..e643eb7 100644 (file)
@@ -2774,7 +2774,7 @@ _anim_end(Elm_Gengrid_Data *sd)
            {
               sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
               sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
-           
+
               if (it1_prev)
                 {
                    tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
@@ -2783,7 +2783,7 @@ _anim_end(Elm_Gengrid_Data *sd)
                 }
               else
                 sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
-           
+
               if (it2_prev)
                 {
                    tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
@@ -2807,16 +2807,16 @@ _anim_end(Elm_Gengrid_Data *sd)
           {
              sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
              sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
-          
+
              if (it1_prev)
-               {  
+               {
                   tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
                   sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
                                                           tmp);
                }
              else
                sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
-        
+
              if (it2_prev)
                {
                   tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
@@ -6067,6 +6067,14 @@ _elm_gengrid_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Gengrid_Data
           if (parent == obj)
             break;
      }
+   // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+   else
+     {
+        WRN("Improper highlighted object: %p", highlighted_obj);
+        return;
+     }
+   //
+
     if (parent)
       {
         int obj_x, obj_y, w, h, hx, hy, hw, hh;
index 6cb205a..b0c1140 100644 (file)
@@ -4230,7 +4230,7 @@ _item_mouse_down_cb(void *data,
    else sd->on_hold = EINA_FALSE;
    if (sd->on_hold) return;
    sd->wasselected = it->selected;
-   
+
    ecore_timer_del(it->item->swipe_timer);
    it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it);
    ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
@@ -8499,72 +8499,80 @@ static Eina_Bool _atspi_enabled()
 EOLIAN static void
 _elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data *sid EINA_UNUSED, Evas_Coord x, Evas_Coord y, Eina_Bool sig)
 {
-    if (!_atspi_enabled())
-      {
-        eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
+   if (!_atspi_enabled())
+     {
+       eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
+       return;
+     }
+
+   int old_x, old_y, delta_y;
+   eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_get(&old_x,&old_y));
+   eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
+   delta_y = old_y - y;
+
+   //check if highlighted item is genlist descendant
+   Evas_Object * highlighted_obj = _elm_object_accessibility_currently_highlighted_get();
+   Evas_Object *parent = highlighted_obj;
+   if (eo_isa(highlighted_obj, ELM_WIDGET_CLASS))
+     {
+        while ((parent = elm_widget_parent_get(parent)))
+          if (parent == obj)
+            break;
+     }
+   else if (eo_isa(highlighted_obj, EDJE_OBJECT_CLASS))
+     {
+        while ((parent = evas_object_smart_parent_get(parent)))
+          if (parent == obj)
+            break;
+     }
+   // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+   else
+     {
+        WRN("Improper highlighted object: %p", highlighted_obj);
         return;
-      }
+     }
+   //
 
-    int old_x, old_y, delta_y;
-    eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_get(&old_x,&old_y));
-    eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
-    delta_y = old_y - y;
-
-    //check if highlighted item is genlist descendant
-    Evas_Object * highlighted_obj = _elm_object_accessibility_currently_highlighted_get();
-    Evas_Object *parent = highlighted_obj;
-    if (eo_isa(highlighted_obj, ELM_WIDGET_CLASS))
-      {
-         while ((parent = elm_widget_parent_get(parent)))
-           if (parent == obj)
-             break;
-      }
-    else if (eo_isa(highlighted_obj, EDJE_OBJECT_CLASS))
-      {
-         while ((parent = evas_object_smart_parent_get(parent)))
-           if (parent == obj)
-             break;
-      }
-    if (parent)
-      {
-         int obj_x, obj_y, w, h, hx, hy, hw, hh;
-         evas_object_geometry_get(obj, &obj_x, &obj_y, &w, &h);
-
-         evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
-
-         Elm_Gen_Item * next_previous_item = NULL;
-         int viewport_position_result = _is_item_in_viewport(obj_y, h, hy, hh);
-         //only highlight if move direction is correct
-         //sometimes highlighted item is brought in and it does not fit viewport
-         //however content goes to the viewport position so soon it will
-         //meet _is_item_in_viewport condition
-         if ((viewport_position_result < 0 && delta_y > 0) ||
-            (viewport_position_result > 0 && delta_y < 0))
-           {
-
-              Eina_List *realized_items = elm_genlist_realized_items_get(obj);
-              Eo *item;
-              Eina_List *l;
-              Eina_Bool traverse_direction = viewport_position_result > 0;
-              l = traverse_direction ? realized_items: eina_list_last(realized_items);
-
-              while(l)
-                {
-                   item = eina_list_data_get(l);
-                   ELM_GENLIST_ITEM_DATA_GET(item, it_data);
-                   next_previous_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it_data));
-                   evas_object_geometry_get(VIEW(next_previous_item), &hx, &hy, &hw, &hh);
-                   if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
-                     break;
-
-                   next_previous_item = NULL;
-
-                   l = traverse_direction ? eina_list_next(l): eina_list_prev(l);
-               }
-           }
-         if (next_previous_item)
-           eo_do(EO_OBJ(next_previous_item), elm_interface_atspi_component_highlight_grab());
-      }
+   if (parent)
+     {
+        int obj_x, obj_y, w, h, hx, hy, hw, hh;
+        evas_object_geometry_get(obj, &obj_x, &obj_y, &w, &h);
+
+        evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
+
+        Elm_Gen_Item * next_previous_item = NULL;
+        int viewport_position_result = _is_item_in_viewport(obj_y, h, hy, hh);
+        //only highlight if move direction is correct
+        //sometimes highlighted item is brought in and it does not fit viewport
+        //however content goes to the viewport position so soon it will
+        //meet _is_item_in_viewport condition
+        if ((viewport_position_result < 0 && delta_y > 0) ||
+           (viewport_position_result > 0 && delta_y < 0))
+          {
+
+             Eina_List *realized_items = elm_genlist_realized_items_get(obj);
+             Eo *item;
+             Eina_List *l;
+             Eina_Bool traverse_direction = viewport_position_result > 0;
+             l = traverse_direction ? realized_items: eina_list_last(realized_items);
+
+             while(l)
+               {
+                  item = eina_list_data_get(l);
+                  ELM_GENLIST_ITEM_DATA_GET(item, it_data);
+                  next_previous_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it_data));
+                  evas_object_geometry_get(VIEW(next_previous_item), &hx, &hy, &hw, &hh);
+                  if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
+                    break;
+
+                  next_previous_item = NULL;
+
+                  l = traverse_direction ? eina_list_next(l): eina_list_prev(l);
+              }
+          }
+        if (next_previous_item)
+          eo_do(EO_OBJ(next_previous_item), elm_interface_atspi_component_highlight_grab());
+     }
 }
 
 EOLIAN static Eina_Bool
index 2599114..67d394f 100644 (file)
@@ -270,7 +270,7 @@ _elm_list_item_content_focus_set(Elm_List_Item_Data *it, Elm_Focus_Direction dir
    Evas_Object *focus_chain[2];
    Evas_Object *focused = NULL;
    int idx;
-   
+
    if (it->icon && elm_object_widget_check(it->icon) && elm_object_focus_allow_get(it->icon))
      focus_chain[focus_objs++] = it->icon;
    if (it->end && elm_object_widget_check(it->end) && elm_object_focus_allow_get(it->end))
@@ -3379,6 +3379,13 @@ _elm_list_elm_interface_scrollable_content_pos_set(Eo *obj EINA_UNUSED, Elm_List
           if (parent == obj)
             break;
      }
+   // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+   else
+     {
+        WRN("Improper highlighted object: %p", highlighted_obj);
+        return;
+     }
+   //
 
    if (parent)
      {
index 5b864bd..f0e3821 100644 (file)
@@ -1839,6 +1839,10 @@ _elm_win_accessibility_highlight_obj_del(void *data,
 {
    ELM_WIN_DATA_GET(data, sd);
 
+   // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+   /* set _accessibility_currently_highlighted_obj to NULL */
+   elm_object_accessibility_highlight_set(obj, EINA_FALSE);
+   //
    _elm_win_accessibility_highlight_hide(sd->obj);
 }
 
index 6402845..94a8dc4 100644 (file)
@@ -8338,82 +8338,90 @@ _elm_genlist_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, E
 // TIZEN only (20150914) : Accessibility: updated highlight change during genlist and list scroll
 static int _is_item_in_viewport(int viewport_y, int viewport_h, int obj_y, int obj_h)
 {
-    if ((obj_y + obj_h/2) < viewport_y)
-      return 1;
-    else if ((obj_y + obj_h/2) > viewport_y + viewport_h)
-      return -1;
-    return 0;
+   if ((obj_y + obj_h/2) < viewport_y)
+     return 1;
+   else if ((obj_y + obj_h/2) > viewport_y + viewport_h)
+     return -1;
+   return 0;
 }
 
 EOLIAN static void
 _elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data *sid EINA_UNUSED, Evas_Coord x, Evas_Coord y, Eina_Bool sig)
 {
-    if (!_atspi_enabled())
-      {
-        eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
+   if (!_atspi_enabled())
+     {
+       eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
+       return;
+     }
+
+   int old_x, old_y, delta_y;
+   eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_get(&old_x,&old_y));
+   eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
+   delta_y = old_y - y;
+
+   //check if highlighted item is genlist descendant
+   Evas_Object * highlighted_obj = _elm_object_accessibility_currently_highlighted_get();
+   Evas_Object * parent = highlighted_obj;
+   if (eo_isa(highlighted_obj, ELM_WIDGET_CLASS))
+     {
+        while ((parent = elm_widget_parent_get(parent)))
+          if (parent == obj)
+            break;
+     }
+   else if (eo_isa(highlighted_obj, EDJE_OBJECT_CLASS))
+     {
+        while ((parent = evas_object_smart_parent_get(parent)))
+          if (parent == obj)
+            break;
+     }
+   // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+   else
+     {
+        WRN("Improper highlighted object: %p", highlighted_obj);
         return;
-      }
+     }
+   //
 
-    int old_x, old_y, delta_y;
-    eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_get(&old_x,&old_y));
-    eo_do_super(obj, MY_CLASS, elm_interface_scrollable_content_pos_set(x,y,sig));
-    delta_y = old_y - y;
+   if (parent)
+     {
+        int obj_x, obj_y, w, h, hx, hy, hw, hh;
+        evas_object_geometry_get(obj, &obj_x, &obj_y, &w, &h);
 
-    //check if highlighted item is genlist descendant
-    Evas_Object * highlighted_obj = _elm_object_accessibility_currently_highlighted_get();
-    Evas_Object * parent = highlighted_obj;
-    if (eo_isa(highlighted_obj, ELM_WIDGET_CLASS))
-      {
-         while ((parent = elm_widget_parent_get(parent)))
-           if (parent == obj)
-             break;
-      }
-    else if (eo_isa(highlighted_obj, EDJE_OBJECT_CLASS))
-      {
-         while ((parent = evas_object_smart_parent_get(parent)))
-           if (parent == obj)
-             break;
-      }
-    if (parent)
-      {
-         int obj_x, obj_y, w, h, hx, hy, hw, hh;
-         evas_object_geometry_get(obj, &obj_x, &obj_y, &w, &h);
-
-         evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
-
-         Elm_Gen_Item * next_previous_item = NULL;
-         int viewport_position_result = _is_item_in_viewport(obj_y, h, hy, hh);
-         //only highlight if move direction is correct
-         //sometimes highlighted item is brought in and it does not fit viewport
-         //however content goes to the viewport position so soon it will
-         //meet _is_item_in_viewport condition
-         if ((viewport_position_result < 0 && delta_y > 0) ||
-            (viewport_position_result > 0 && delta_y < 0))
-           {
-
-              Eina_List *realized_items = elm_genlist_realized_items_get(obj);
-              Eo *item;
-              Eina_List *l;
-              Eina_Bool traverse_direction = viewport_position_result > 0;
-              l = traverse_direction ? realized_items: eina_list_last(realized_items);
-
-              while(l)
-                {
-                   item = eina_list_data_get(l);
-                   ELM_GENLIST_ITEM_DATA_GET(item, it_data);
-                   next_previous_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it_data));
-                   evas_object_geometry_get(VIEW(next_previous_item), &hx, &hy, &hw, &hh);
-                   if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
-                     break;
+        evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
 
-                   next_previous_item = NULL;
+        Elm_Gen_Item * next_previous_item = NULL;
+        int viewport_position_result = _is_item_in_viewport(obj_y, h, hy, hh);
+        //only highlight if move direction is correct
+        //sometimes highlighted item is brought in and it does not fit viewport
+        //however content goes to the viewport position so soon it will
+        //meet _is_item_in_viewport condition
+        if ((viewport_position_result < 0 && delta_y > 0) ||
+           (viewport_position_result > 0 && delta_y < 0))
+          {
 
-                   l = traverse_direction ? eina_list_next(l): eina_list_prev(l);
-               }
-           }
-         if (next_previous_item)
-           eo_do(EO_OBJ(next_previous_item), elm_interface_atspi_component_highlight_grab());
-      }
+             Eina_List *realized_items = elm_genlist_realized_items_get(obj);
+             Eo *item;
+             Eina_List *l;
+             Eina_Bool traverse_direction = viewport_position_result > 0;
+             l = traverse_direction ? realized_items: eina_list_last(realized_items);
+
+             while(l)
+               {
+                  item = eina_list_data_get(l);
+                  ELM_GENLIST_ITEM_DATA_GET(item, it_data);
+                  next_previous_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it_data));
+                  evas_object_geometry_get(VIEW(next_previous_item), &hx, &hy, &hw, &hh);
+                  if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
+                    break;
+
+                  next_previous_item = NULL;
+
+                  l = traverse_direction ? eina_list_next(l): eina_list_prev(l);
+              }
+          }
+        if (next_previous_item)
+          eo_do(EO_OBJ(next_previous_item), elm_interface_atspi_component_highlight_grab());
+     }
 }
 // Tizen only (20150914)
 #include "elm_genlist.eo.c"