tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3252e3bf78881cf03729737cd8fd2b0c746e512d

commit 3252e3bf78881cf03729737cd8fd2b0c746e512d
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Mon Jan 4 15:00:56 2016 +0000

    Evas Textblock: Fix ellipsis when textblock is resized to formatted h.
    
    Summary:
    it->h is sum of max ascent and max descent. It shouldn't be used
    when handle ellipsis. Because, Evas Textblock uses these values for
    each lines differently according to its location.
    (start, end, else, single)
    So, for handling ellipsis exactly, it has to be fixed.
    
    Test Plan: A test case is included in Evas Test suite.
    
    Reviewers: woohyun, tasn, herdsman
    
    Subscribers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D3475
---
 src/lib/evas/canvas/evas_object_textblock.c | 16 +++++++++++++++-
 src/tests/evas/evas_test_textblock.c        | 10 ++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index bfa7cf5..b28de11 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -5227,8 +5227,22 @@ _layout_par(Ctxt *c)
               * fast path.
               * Other values of 0.0 <= ellipsis < 1.0 are handled in
               * _layout_par_ellipsis_items */
+             int ascent = 0, descent = 0, maxasc = 0, maxdesc = 0;
+             _layout_item_ascent_descent_adjust(c->obj, &ascent, &descent,
+                                                it, it->format);
+
+             if (c->position == TEXTBLOCK_POSITION_START)
+               _layout_item_max_ascent_descent_calc(c->obj, &maxasc, &maxdesc,
+                                                    it, 
TEXTBLOCK_POSITION_SINGLE);
+             else
+               _layout_item_max_ascent_descent_calc(c->obj, &maxasc, &maxdesc,
+                                                    it, 
TEXTBLOCK_POSITION_END);
+
+             if (ascent > maxasc) maxasc = ascent;
+             if (descent > maxdesc) maxdesc = descent;
+
              if ((it->format->ellipsis == 1.0) && (c->h >= 0) &&
-                   ((2 * it->h + c->y >
+                   ((ascent + descent + maxasc + maxdesc + c->y >
                      c->h - c->o->style_pad.t - c->o->style_pad.b) ||
                     (!it->format->wrap_word && !it->format->wrap_char &&
                      !it->format->wrap_mixed && 
!it->format->wrap_hyphenation)))
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index 528e640..332a658 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2202,6 +2202,16 @@ START_TEST(evas_textblock_wrapping)
 
    ck_assert_int_eq(bh, h);
 
+   /* Check that unnecessary ellipsis is not applied */
+   evas_object_textblock_text_markup_set(tb, "This is test for ellipsis with 
formatted height.");
+   evas_textblock_cursor_format_prepend(cur, "+ wrap=mixed");
+   evas_object_resize(tb, 100, 100);
+   evas_object_textblock_size_formatted_get(tb, NULL, &bh);
+   evas_object_resize(tb, 100, bh);
+   evas_textblock_cursor_format_prepend(cur, "+ wrap=mixed ellipsis=1.0");
+   evas_object_textblock_size_formatted_get(tb, NULL, &h);
+   ck_assert_int_ge(h, bh);
+
    END_TB_TEST();
 }
 END_TEST

-- 


Reply via email to