From: Youngbok Shin Date: Wed, 6 Aug 2014 09:40:02 +0000 (+0100) Subject: textblock: Update visual_pos before calling _size_native_calc_line_finalize. X-Git-Tag: v1.11.0-beta2~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a87f322f4efc3e18d7350765ec747973b13535a;p=platform%2Fupstream%2Fefl.git textblock: Update visual_pos before calling _size_native_calc_line_finalize. Summary: In items loop of _size_native_calc_line_finalize, last_it should be replaced with new item according to position. But, visual_pos is not prepared and it is always zero in the function. So, we need to update visual_pos. And when textblock only has LTR text, we can replace last_it according to item list sequence. @fix Test Plan: It includes test cases using the following test case. 1. "i" 2. "。i" Reviewers: seoz, woohyun, sohyun, tasn Subscribers: raster, herdsman, cedric Differential Revision: https://phab.enlightenment.org/D859 --- diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index a3aa98e219..8547090b5e 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -10482,6 +10482,7 @@ _size_native_calc_line_finalize(const Evas_Object *eo_obj, Eina_List *items, { Evas_Object_Textblock_Item *it, *last_it = NULL; Eina_List *i; + Eina_Bool is_bidi = EINA_FALSE; it = eina_list_data_get(items); *w = 0; @@ -10505,8 +10506,10 @@ _size_native_calc_line_finalize(const Evas_Object *eo_obj, Eina_List *items, /* Add margins. */ if (it->format) *w = it->format->margin.l + it->format->margin.r; - } + if (it->ln && it->ln->par) + is_bidi = it->ln->par->is_bidi; + } /* Adjust all the item sizes according to the final line size, * and update the x positions of all the items of the line. */ @@ -10539,11 +10542,21 @@ loop_advance: *w += it->adv; /* Only conditional if we have bidi support, otherwise, just set it. */ + if (it->w > 0) + { #ifdef BIDI_SUPPORT - if (!last_it || (it->visual_pos > last_it->visual_pos)) + if (is_bidi) + { + if (!last_it || (it->visual_pos > last_it->visual_pos)) + { + last_it = it; + } + } + else #endif - { - last_it = it; + { + last_it = it; + } } } @@ -10645,6 +10658,7 @@ _evas_textblock_size_native_get(Eo *eo_obj, Evas_Textblock_Data *o, Evas_Coord * EINA_INLIST_FOREACH(o->paragraphs, par) { Evas_Coord tw, th; + _layout_paragraph_render(o, par); _size_native_calc_paragraph_size(eo_obj, o, par, &position, &tw, &th); if (tw > wmax) wmax = tw; diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 76aede3229..78d83ef25f 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -2898,6 +2898,18 @@ START_TEST(evas_textblock_size) fail_if((w != nw) || (h != nh)); fail_if(w <= 0); + evas_object_textblock_text_markup_set(tb, "i。"); + evas_object_textblock_size_formatted_get(tb, &w, &h); + evas_object_textblock_size_native_get(tb, &nw, &nh); + ck_assert_int_eq(w, nw); + ck_assert_int_eq(h, nh); + + evas_object_textblock_text_markup_set(tb, "。i"); + evas_object_textblock_size_formatted_get(tb, &w, &h); + evas_object_textblock_size_native_get(tb, &nw, &nh); + ck_assert_int_eq(w, nw); + ck_assert_int_eq(h, nh); + /* This time with margins. */ { Evas_Textblock_Style *newst;