From: Mike Blumenkrantz Date: Fri, 16 Aug 2019 19:12:25 +0000 (-0400) Subject: efl_ui/text: attempt to size more accurately in non-scroll mode X-Git-Tag: submit/tizen/20190821.073037~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b07281783356eb9922d2028eb1ccb2a80a1fdb7e;p=platform%2Fupstream%2Fefl.git efl_ui/text: attempt to size more accurately in non-scroll mode the internal text object provides a min size based on its current geometry, so temporarily match the geometry of the overall object in order to provide a somewhat more accurate calculation sooner for this object Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9598 --- diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 6c8a24d..631cd1b 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -911,8 +911,17 @@ _efl_ui_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Data *sd) } else { + Eina_Size2D text_sz = efl_gfx_entity_size_get(sd->text_obj); edje_object_size_min_calc(wd->resize_obj, &edmin.w, &edmin.h); - efl_canvas_text_size_formatted_get(sd->text_obj, &min.w, &min.h); + efl_event_freeze(sd->text_obj); + efl_gfx_entity_size_set(sd->text_obj, EINA_SIZE2D(sz.w, 0)); + /* ignore current object size for single-line since we always need to know the actual size */ + if (sd->single_line) + efl_canvas_text_size_native_get(sd->text_obj, &min.w, &min.h); + else + efl_canvas_text_size_formatted_get(sd->text_obj, &min.w, &min.h); + efl_gfx_entity_size_set(sd->text_obj, text_sz); + efl_event_thaw(sd->text_obj); min.w += edmin.w; min.h += edmin.h; efl_gfx_hint_size_restricted_min_set(obj, min);