Atspi: enhance finding next and prev item on screen's edge 51/173851/4 accepted/tizen/4.0/unified/20180330.060739 submit/tizen_4.0/20180328.070153 submit/tizen_4.0/20180329.042932
authorJunsuChoi <jsuya.choi@samsung.com>
Mon, 26 Mar 2018 10:29:32 +0000 (19:29 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 28 Mar 2018 07:04:20 +0000 (07:04 +0000)
1) The content of list is checked that is screen out when genlist's content_pos_set is called.
   Therefore, the content of the item is excluded from check that is screen out.

2) the content_pos_set of genlist differs by 1 pixel from the final call when scrolled up and down.
   If the item size is 360x360 on a 360x360 size screen, scrolling upward (0,360) to (0, 0)
   will be called until the y coordinate of the highlight object in content_pos_set is 1.
   But downward is not same. if scrolling downward (0,0) to (0,360)
   will be called y coordinate of highlight object in final called content_pos_set is 360.
   This part can be modified according to the content_pos_set call convention.

3) delta_y means the direction of the scroll. However, old_y and y do not have the proper orientation
   when content_pos_set is called twice. Therefore, we use delta_y_backup temporarily.

[dlogutil]

When scroll up

E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = 0, y = 0
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = -45, hy = 0, y = 45
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = -45, y = 45
...
...

E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = -1, hy = -358, y = 359
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = -359, y = 359
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = -1, hy = -359, y = 360
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = -359, y = 360

When scroll down

E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = 0, y = 360
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 43, hy = 0, y = 317
...
...
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 2, hy = 357, y = 1
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = 359, y = 1
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 1, hy = 359, y = 0
E/EFL     ( 3219): elementary<3219> elm_genlist.c:9997 _elm_genlist_elm_interface_scrollable_content_pos_set()  delta_y = 0, hy = 360, y = 0

Change-Id: Iaa32c138009efa5d04f5b2447af1ba230c912d06

src/lib/elm_win.c
src/mobile_lib/elm_genlist.c
src/mobile_lib/elm_widget_genlist.h

index d3e42bd..e03b6c1 100644 (file)
@@ -1028,6 +1028,21 @@ _elm_win_focus_highlight_anim_setup(Elm_Win_Data *sd,
    edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
 }
 
+// TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
+EAPI Eina_Bool
+_elm_win_accessibility_parent_is_item(Evas_Object *obj)
+{
+   Evas_Object *parent;
+   eo_do(obj, parent = elm_interface_atspi_accessible_parent_get());
+   while (parent)
+     {
+        if (eo_isa(parent, ELM_WIDGET_ITEM_CLASS)) return EINA_TRUE;
+        eo_do(parent, parent = elm_interface_atspi_accessible_parent_get());
+     }
+   return EINA_FALSE;
+}
+//
+
 static void
 _elm_win_accessibility_highlight_simple_setup(Elm_Win_Data *sd,
                                       Evas_Object *obj)
@@ -1053,7 +1068,10 @@ _elm_win_accessibility_highlight_simple_setup(Elm_Win_Data *sd,
           && eo_isa(target, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
           {
              eo_do(target, role = elm_interface_atspi_accessible_role_get());
-             if (role && role != ELM_ATSPI_ROLE_MENU_ITEM && role != ELM_ATSPI_ROLE_LIST_ITEM)
+             if (role && role != ELM_ATSPI_ROLE_MENU_ITEM && role != ELM_ATSPI_ROLE_LIST_ITEM
+                 // TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
+                 && ! _elm_win_accessibility_parent_is_item(target))
+                 //
                {
                   elm_interface_atspi_accessible_move_outed_signal_emit(target, ELM_ATSPI_MOVE_OUTED_TOP_LEFT);
                   sd->accessibility_highlight.cur.need_moved = EINA_FALSE;
@@ -1065,7 +1083,10 @@ _elm_win_accessibility_highlight_simple_setup(Elm_Win_Data *sd,
                 && eo_isa(target, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
           {
              eo_do(target, role = elm_interface_atspi_accessible_role_get());
-             if (role && role != ELM_ATSPI_ROLE_MENU_ITEM && role != ELM_ATSPI_ROLE_LIST_ITEM)
+             if (role && role != ELM_ATSPI_ROLE_MENU_ITEM && role != ELM_ATSPI_ROLE_LIST_ITEM
+                 // TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
+                 && ! _elm_win_accessibility_parent_is_item(target))
+                 //
                {
                   elm_interface_atspi_accessible_move_outed_signal_emit(target, ELM_ATSPI_MOVE_OUTED_BOTTOM_RIGHT);
                   sd->accessibility_highlight.cur.need_moved = EINA_FALSE;
index 7234745..1d0e6c9 100644 (file)
@@ -8778,51 +8778,16 @@ _elm_genlist_item_elm_interface_atspi_component_highlight_grab(Eo *eo_it, Elm_Ge
 {
    ELM_GENLIST_DATA_GET(WIDGET(it), sd);
 
-   if (!TIZEN_PROFILE_WEARABLE)
-     {
-        //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll
-        eo_do_super(EO_OBJ(it), ELM_GENLIST_ITEM_CLASS, elm_interface_atspi_component_highlight_grab());
-        //
-     }
-   else
-     {
-        // TIZEN_ONLY(20171011) : atspi : Do not center align when genlist item is highlighted in wearable profile
-        //FIXME : First, last item is called centered because it may not have a proxy image.
-        //        This part will be revised in the next version.
-        Eina_List *realized = elm_genlist_realized_items_get(WIDGET(it));
-        if (VIEW(it) || realized)
-          {
-             Elm_Object_Item *first_it = elm_genlist_first_item_get(WIDGET(it));
-             Elm_Object_Item *last_it = elm_genlist_last_item_get(WIDGET(it));
-             if (first_it == eo_it || last_it == eo_it)
-               elm_genlist_item_bring_in(eo_it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
-             else
-               elm_genlist_item_bring_in(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN);
-           }
-        if (realized)
-          eina_list_free(realized);
-        //
-
-        if (VIEW(it))
-           elm_object_accessibility_highlight_set(EO_OBJ(it), EINA_TRUE);
-        ///TIZEN_ONLY(20170717) : expose highlight information on atspi
-        elm_interface_atspi_accessible_state_changed_signal_emit(EO_OBJ(it), ELM_ATSPI_STATE_HIGHLIGHTED, EINA_TRUE);
-        ///
+   //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll
+   eo_do_super(EO_OBJ(it), ELM_GENLIST_ITEM_CLASS, elm_interface_atspi_component_highlight_grab());
 
-        //TIZEN_ONLY(20170412) Make atspi,(un)highlighted work on widget item
-        // If you call eo_do_super, then you do NOT have to call smart callback.
-        evas_object_smart_callback_call(WIDGET(it), "atspi,highlighted", EO_OBJ(it));
-        //
-     }
+   //TIZEN_ONLY(20170412) Make atspi,(un)highlighted work on widget item
+   // If you call eo_do_super, then you do NOT have to call smart callback.
+   evas_object_smart_callback_call(WIDGET(it), "atspi,highlighted", EO_OBJ(it));
+   //
 
 
-   if (VIEW(it))
-     {
-        //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile
-        sd->currently_highlighted_item = it;
-        //
-     }
-   else
+   if (!VIEW(it))
      {
        if (!TIZEN_PROFILE_WEARABLE)
          {
@@ -8830,7 +8795,6 @@ _elm_genlist_item_elm_interface_atspi_component_highlight_grab(Eo *eo_it, Elm_Ge
             elm_genlist_item_bring_in(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN);
             //
          }
-       sd->atspi_item_to_highlight = it;//it will be highlighted when realized
      }
 
    //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile
@@ -9143,7 +9107,7 @@ static int _is_item_in_viewport(int viewport_y, int viewport_h, int obj_y, int o
 }
 
 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)
+_elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data *sd, Evas_Coord x, Evas_Coord y, Eina_Bool sig)
 {
    if (!_elm_atspi_enabled())
      {
@@ -9193,13 +9157,24 @@ _elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data
         evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
 
         Elm_Gen_Item * next_previous_item = NULL;
+        // TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
+        /* FIXME : the content_pos_set of genlist differs by 1 pixel from the final call when scrolled up and down.
+                   If the item size is 360x360 on a 360x360 size screen, scrolling upward (0,360) to (0, 0)
+                   will be called until the y coordinate of the highlight object in content_pos_set is 1.
+                   But downward is not same. if scrolling downward (0,0) to (0,360)
+                   will be called y coordinate of highlight object in final called content_pos_set is 360.
+                   This part can be modified according to the content_pos_set call convention.
+        */
+        if(sd->scroll_delta_y_backup < 0)
+          hy = hy - 1;
+        //
         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))
+        if ((viewport_position_result < 0 && (delta_y != 0 ? delta_y > 0 : sd->scroll_delta_y_backup > 0)) ||
+           (viewport_position_result > 0 && (delta_y != 0 ? delta_y < 0 : sd->scroll_delta_y_backup < 0)))
           {
 
              Eina_List *realized_items = elm_genlist_realized_items_get(obj);
@@ -9214,6 +9189,9 @@ _elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data
                   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);
+                  //FIXME : the content_pos_set of genlist differs by 1 pixel from the final call when scrolled up and down.
+                  if(sd->scroll_delta_y_backup < 0)
+                    hy = hy - 1;
                   if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
                     break;
 
@@ -9228,6 +9206,12 @@ _elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data
              elm_interface_atspi_accessible_state_changed_signal_emit(EO_OBJ(next_previous_item), ELM_ATSPI_STATE_HIGHLIGHTED, EINA_TRUE);
           }
      }
+   // TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
+   /* FIXME : delta_y means the direction of the scroll. However, old_y and y do not have the proper orientation
+              when content_pos_set is called twice. Therefore, we use delta_y_backup temporarily.
+   */
+   sd->scroll_delta_y_backup = delta_y;
+   //
 }
 // Tizen only (20150914)
 #include "elm_genlist.eo.c"
index 6f6fa6d..b633b1e 100644 (file)
@@ -206,6 +206,9 @@ struct _Elm_Genlist_Data
    Elm_Gen_Item                         *highlighted_item;
    Evas_Coord                            viewport_w, viewport_h;
    Elm_Gen_Item                         *atspi_item_to_highlight;
+   // TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
+   int                                   scroll_delta_y_backup;
+   //
    Elm_Gen_Item                         *aligned_item;
    //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile
    Elm_Gen_Item                         *currently_highlighted_item;