From 4c8bd08bb7f36586c54ada7709a7f66efd72952b Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Mon, 11 Dec 2017 19:07:46 +0530 Subject: [PATCH] elm: [ATSPI] Show object highlighted by highlight_grab when object is out of scroll Show item object of elm_genlist, elm_gengrid, elm_toolbar, elm_list and other object( in scroller) when out of scroll view. @tizen_fix orignal patch: d8bdb91a65cb678258ac3704d11610520aa8948d,0b4c76fdcbbd91710a81c9072b5571e6d3fffcec Change-Id: Ia1f06c35601b7803c489cf2c64b83b582f33b58f --- src/lib/elementary/elm_gengrid.c | 59 +---------- src/lib/elementary/elm_genlist.c | 66 +++++------- src/lib/elementary/elm_list.c | 20 ++-- src/lib/elementary/elm_toolbar.c | 9 +- src/lib/elementary/elm_widget.c | 213 ++++++++++++++++++++++++++++++++++----- 5 files changed, 228 insertions(+), 139 deletions(-) diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index dcd32b9..89d33b7 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -5515,65 +5515,16 @@ _elm_gengrid_item_efl_access_name_get(Eo *eo_it, Elm_Gen_Item *it) //TIZEN_ONLY(20171114): Region show on item elements fixed EOLIAN static Eina_Bool -_elm_gengrid_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_Gen_Item *it) +_elm_gengrid_item_efl_access_component_highlight_grab(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it) { ELM_GENGRID_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, EINA_FALSE); - // if item is realized check if in viewport - if (VIEW(it)) - { - Evas_Coord wx, wy, ww, wh, x, y, w, h; - evas_object_geometry_get(WIDGET(it), &wx, &wy, &ww, &wh); - evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); - switch (_is_item_in_viewport(wx, wy, ww, wh, x, y, w, h)) - { - case -1: - case -2: - elm_gengrid_item_show(eo_it, ELM_GENGRID_ITEM_SCROLLTO_TOP); - break; - case 1: - case 2: - elm_gengrid_item_show(eo_it, ELM_GENGRID_ITEM_SCROLLTO_BOTTOM); - break; - default: - elm_gengrid_item_show(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN); - } - } - else // if item is not realized we should search if we are over or below viewport - { - int idx, top, bottom; - Eina_List *realized = elm_gengrid_realized_items_get(WIDGET(it)); - if (realized) - { - // index of realized element on top of viewport - top = elm_obj_gengrid_item_index_get(eina_list_nth(realized, 0)); - // index of realized element on bottom of viewport - bottom = elm_obj_gengrid_item_index_get(eina_list_last_data_get(realized)); - idx = elm_obj_gengrid_item_index_get(eo_it); - eina_list_free(realized); - if (idx < top) - elm_gengrid_item_show(eo_it, ELM_GENGRID_ITEM_SCROLLTO_BOTTOM); - else if (idx > bottom) - elm_gengrid_item_show(eo_it, ELM_GENGRID_ITEM_SCROLLTO_TOP); - else - elm_gengrid_item_show(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN); - } - } - - //TIZEN_ONLY (20151009) : Accessibility: updated highlight change during gengrid scroll - if (VIEW(it)) - elm_object_accessibility_highlight_set(VIEW(it), EINA_TRUE); - else - sd->atspi_item_to_highlight = it;//it will be highlighted when realized + //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll + efl_access_component_highlight_grab(efl_super(EO_OBJ(it), ELM_GENGRID_ITEM_CLASS)); // - //TIZEN_ONLY(20170717) : expose highlight information on atspi - efl_access_active_descendant_changed_signal_emit(WIDGET(it), eo_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_it); - // + if (!VIEW(it)) + sd->atspi_item_to_highlight = it;//it will be highlighted when realized return EINA_TRUE; } diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index 3b54b4e..be0eca1 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -9058,50 +9058,33 @@ _elm_genlist_elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Genlist_Data EOLIAN static Eina_Bool _elm_genlist_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_Gen_Item *it) { - ELM_GENLIST_DATA_GET(WIDGET(it), sd); - Eina_Bool ret = EINA_TRUE; + ELM_GENLIST_DATA_GET(WIDGET(it), sd); - // if item is realized check if in viewport - if (VIEW(it)) - { +#ifndef TIZEN_PROFILE_WEARABLE + //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll + efl_access_component_highlight_grab(efl_super(EO_OBJ(it), ELM_GENLIST_ITEM_CLASS)); + // +#else + // if item is realized check if in viewport + if (VIEW(it)) + { Evas_Coord wy, wh, y, h; evas_object_geometry_get(WIDGET(it), NULL, &wy, NULL, &wh); evas_object_geometry_get(VIEW(it), NULL, &y, NULL, &h); - int res = _is_item_in_viewport(wy, wh, y, h); - if (res > 0) - { - // new item is above current - elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM); - } - else if (res < 0) - { - // new item is below current - elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_TOP); - } - else - elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN); - } - else // if item is not realized we should search if we are over or below viewport - { + //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile + elm_genlist_item_bring_in(eo_it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + // + } + else // if item is not realized we should search if we are over or below viewport + { Eina_List *realized; - int idx, top, bottom; realized = elm_genlist_realized_items_get(WIDGET(it)); if (realized) { - // index of realized element on top of viewport - top = elm_obj_genlist_item_index_get(eina_list_nth(realized, 0)); - // index of realized element on bottom of viewport - bottom = elm_obj_genlist_item_index_get(eina_list_last_data_get(realized)); - idx = elm_obj_genlist_item_index_get(eo_it); - eina_list_free(realized); - if (idx < top) - elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM); - else if (idx > bottom) - elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_TOP); - else - elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_item_bring_in(eo_it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + eina_list_free(realized); } - } + } if (VIEW(it)) elm_object_accessibility_highlight_set(EO_OBJ(it), EINA_TRUE); @@ -9114,6 +9097,7 @@ _elm_genlist_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_Gen_Item *i // 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)); // +#endif if (VIEW(it)) { @@ -9123,18 +9107,18 @@ _elm_genlist_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_Gen_Item *i } else { +#ifndef TIZEN_PROFILE_WEARABLE //TIZEN_ONLY(20170724): grab highlight using unrealized item elm_genlist_item_bring_in(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN); // +#endif sd->atspi_item_to_highlight = it;//it will be highlighted when realized } - efl_access_active_descendant_changed_signal_emit(WIDGET(it), eo_it); - - //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile - edje_object_signal_emit(VIEW(it), SIGNAL_ITEM_HIGHLIGHTED, "elm"); - // - return ret; + //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile + edje_object_signal_emit(VIEW(it), SIGNAL_ITEM_HIGHLIGHTED, "elm"); + // + return EINA_TRUE; } EOLIAN static Eina_Bool diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index 7809b7b..f18c2b0 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -3338,9 +3338,9 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_list, Elm_List_Data) //TIZEN_ONLY(20171114): list: enhance accessibility scroll and highlight 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) + if ((obj_y + obj_h/2) <= viewport_y) return 1; - else if ((obj_y + obj_h/2) > viewport_y + viewport_h) + else if ((obj_y + obj_h/2) >= viewport_y + viewport_h) return -1; return 0; } @@ -3433,10 +3433,14 @@ _elm_list_elm_interface_scrollable_content_pos_set(Eo *obj EINA_UNUSED, Elm_List EOLIAN static Eina_Bool _elm_list_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_List_Item_Data *it) { - Evas_Coord wy, wh, x, y, w, h, bx, by, bw, bh; ELM_LIST_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, EINA_FALSE); - Eina_Bool ret; +#ifndef TIZEN_PROFILE_WEARABLE + //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll + efl_access_component_highlight_grab(efl_super(EO_OBJ(it), ELM_LIST_ITEM_CLASS)); + // +#else + Evas_Coord wy, wh, x, y, w, h, bx, by, bw, bh; evas_object_geometry_get(WIDGET(it), NULL, &wy, NULL, &wh); evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); int res = _is_item_in_viewport(wy, wh, y, h); @@ -3465,11 +3469,9 @@ _elm_list_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_List_Item_Data elm_object_accessibility_highlight_set(eo_it, EINA_TRUE); efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_HIGHLIGHTED, EINA_TRUE); // - //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)); - // - return ret; +#endif + + return EINA_TRUE; } // diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 5f3e798..02ceaae 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -3982,13 +3982,8 @@ EOLIAN static Eina_Bool _elm_toolbar_item_efl_access_component_highlight_grab(Eo *eo_it, Elm_Toolbar_Item_Data *it) { elm_toolbar_item_show(eo_it, ELM_TOOLBAR_ITEM_SCROLLTO_IN); - elm_object_accessibility_highlight_set(VIEW(it), EINA_TRUE); - // TIZEN_ONLY(20171114): atspi: expose highlight information on atspi - efl_access_active_descendant_changed_signal_emit(WIDGET(it), eo_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_it); + //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll + efl_access_component_highlight_grab(efl_super(EO_OBJ(it), ELM_TOOLBAR_ITEM_CLASS)); // return EINA_TRUE; } diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index fbfe24d..88fbbc9 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -4182,6 +4182,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 (efl_isa(parent, ELM_INTERFACE_SCROLLABLE_MIXIN)) + { + evas_object_geometry_get(parent, &wx, &wy, NULL, NULL); + elm_interface_scrollable_content_size_get(parent, &ww, &wh); + elm_interface_scrollable_content_pos_get(parent, &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 Efl_Access_State_Set _elm_widget_item_efl_access_state_set_get(Eo *eo_item, Elm_Widget_Item_Data *item) { @@ -4207,13 +4247,17 @@ _elm_widget_item_efl_access_state_set_get(Eo *eo_item, Elm_Widget_Item_Data *ite { STATE_TYPE_SET(states, EFL_ACCESS_STATE_ENABLED); STATE_TYPE_SET(states, EFL_ACCESS_STATE_SENSITIVE); - STATE_TYPE_SET(states, EFL_ACCESS_STATE_VISIBLE); } if (_elm_widget_item_onscreen_is(eo_item)) STATE_TYPE_SET(states, EFL_ACCESS_STATE_SHOWING); + //TIZEN_ONLY(20170207) : [ATSPI] enhance expose highlight information on atspi + if (evas_object_visible_get(item->view)) + STATE_TYPE_SET(states, EFL_ACCESS_STATE_VISIBLE); + // + //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, EFL_ACCESS_STATE_HIGHLIGHTABLE); else STATE_TYPE_UNSET(states, EFL_ACCESS_STATE_HIGHLIGHTABLE); @@ -5886,34 +5930,17 @@ _elm_widget_item_efl_access_component_highlight_grab(Eo *obj, Elm_Widget_Item_Da // } // return EINA_FALSE; - if (!obj) return EINA_FALSE; + if (!sd) return EINA_FALSE; + if (!sd->view) return EINA_FALSE; - Evas_Object *o = elm_object_parent_widget_get(sd->view); - if (_elm_scrollable_is(o)) - { - Evas_Coord bx, by, bw, bh; - Evas_Coord x, y, w, h; - Evas_Object *w1 = elm_object_parent_widget_get(o); - evas_object_geometry_get(sd->view, &x, &y, &w, &h); - evas_object_geometry_get(o, &bx, &by, &bw, &bh); - x -= bx; - y -= by; - // TIZEN_ONLY(20171115): [PATCH] Fix for accessibility highlight - switch (_elm_config->focus_autoscroll_mode) - { - case ELM_FOCUS_AUTOSCROLL_MODE_SHOW: - elm_interface_scrollable_content_region_show(w1, x, y, w, h); - break; - case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN: - elm_interface_scrollable_region_bring_in(w1, x, y, w, h); - break; - default: - break; - } - // - } + //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll + _accessible_highlight_region_show(sd->view); + // + + if (!sd->eo_obj) return EINA_FALSE; + elm_object_accessibility_highlight_set(sd->eo_obj, EINA_TRUE); + if (!obj) return EINA_FALSE; - elm_object_accessibility_highlight_set(sd->view, EINA_TRUE); efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_HIGHLIGHTED, EINA_TRUE); //TIZEN_ONLY(20170412) Make atspi,(un)highlighted work on widget item evas_object_smart_callback_call(sd->widget, SIG_WIDGET_ATSPI_HIGHLIGHTED, obj); @@ -6633,12 +6660,142 @@ _elm_widget_efl_access_component_accessible_at_point_get(Eo *obj, Elm_Widget_Sma // } // +//TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll +Eina_Bool +_accessible_object_on_screen_is(Eo *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool is_complete) +{ + if(!obj) return EINA_FALSE; + + Evas_Object *target = obj; + Evas_Object *parent = NULL; + Evas_Coord px, py, sx, sy, sw, sh, ox, oy, ow, oh; + + if (elm_widget_is(target)) + parent = elm_widget_parent_get(target); + else + parent = elm_widget_parent_widget_get(target); + + while (parent) + { + if (efl_isa(parent, ELM_INTERFACE_SCROLLABLE_MIXIN)) + { + evas_object_geometry_get(parent, &sx, &sy, &sw, &sh); + px = ox = x; + py = oy = y; + ow = w; + oh = h; + ox = is_complete ? ox : ox + ow; + oy = is_complete ? oy : oy + oh; + ox = ox > sx ? ox : sx; + oy = oy > sy ? oy : sy; + ow = px + ow < sx + sw ? px + ow - ox : sx + sw - ox; + oh = py + oh < sy + sh ? py + oh - oy : sy + sh - oy; + } + if (ow <= 0 || oh <= 0) + return EINA_FALSE; + + parent = elm_widget_parent_get(parent); + } + return EINA_TRUE; +} + +Eina_List * +_accessible_scrollable_parent_list_get(Eo *obj) +{ + if(!obj) return NULL; + + Evas_Object *parent = NULL; + Eina_List *plist = NULL; + + if (elm_widget_is(obj)) + parent = elm_widget_parent_get(obj); + else + parent = elm_widget_parent_widget_get(obj); + + while (parent) + { + if (_elm_scrollable_is(parent)) + plist = eina_list_append(plist, parent); + + parent = elm_widget_parent_get(parent); + } + return plist; +} + +void +_accessible_highlight_region_show(Eo* obj) +{ + if(!obj) return ; + + Evas_Object *target = obj; + Evas_Object *parent = NULL; + Evas_Object *parent_sub = NULL; + Eina_List *plist, *plist_sub; + Eina_List *l, *l2; + + Evas_Coord target_x, target_y, target_w, target_h; + + evas_object_geometry_get(target, &target_x, &target_y, &target_w, &target_h); + + plist = _accessible_scrollable_parent_list_get(target); + if(!plist) return ; + EINA_LIST_FOREACH(plist, l, parent) + { + if(!_accessible_object_on_screen_is(target, target_x, target_y, target_w, target_h, EINA_TRUE)) + { + plist_sub = _accessible_scrollable_parent_list_get(parent); + plist_sub = eina_list_prepend(plist_sub, parent); + EINA_LIST_FOREACH(plist_sub, l2, parent_sub) + { + Evas_Coord scroll_x, scroll_y; + Evas_Coord scroll_x_back, scroll_y_back; + Evas_Coord x, y, w, h; + Evas_Coord px, py; + + elm_interface_scrollable_content_region_get(parent_sub, &scroll_x_back, &scroll_y_back, NULL, NULL); + evas_object_geometry_get(parent_sub, &px, &py, NULL, NULL); + x = target_x; y = target_y; w = target_w; h = target_h; + + x -= (px - scroll_x_back); + y -= (py - scroll_y_back); + switch (_elm_config->focus_autoscroll_mode) + { + case ELM_FOCUS_AUTOSCROLL_MODE_SHOW: + elm_interface_scrollable_content_region_show(parent_sub, x, y, w, h); + break; + case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN: + elm_interface_scrollable_region_bring_in(parent_sub, x, y, w, h); + break; + default: + break; + } + elm_interface_scrollable_content_region_get(parent_sub, &scroll_x, &scroll_y, NULL, NULL); + + target_x -= (scroll_x - scroll_x_back); + target_y -= (scroll_y - scroll_y_back); + + if(_accessible_object_on_screen_is(target, target_x, target_y, target_w, target_h, EINA_FALSE)) + break; + } + eina_list_free(plist_sub); + } + } + + eina_list_free(plist); +} +// + EOLIAN static Eina_Bool _elm_widget_efl_access_component_highlight_grab(Eo *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED) { + if(!obj) return EINA_FALSE; if(!_elm_atspi_enabled()) return EINA_FALSE; + //TIZEN_ONLY(20170119): Show the object highlighted by highlight_grab when the object is completely out of the scroll + _accessible_highlight_region_show(obj); + // + elm_widget_focus_region_show(obj); elm_object_accessibility_highlight_set(obj, EINA_TRUE); efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_HIGHLIGHTED, EINA_TRUE); -- 2.7.4