herdsman pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=59e9e2ddc873dc8f0fd6fd8e1e68707d955c0401

commit 59e9e2ddc873dc8f0fd6fd8e1e68707d955c0401
Author: Daniel Hirt <daniel.h...@samsung.com>
Date:   Wed Dec 2 14:37:58 2015 +0200

    Evas textblock: fix height on line wrapping
    
    Line advance should finalize the line with its last item, and not the
    item we're currently wrapping. This fixes T1583, where some line
    wrapping cases would look different than their equivalent <ps>
    versions.
    
    @fix
---
 src/lib/evas/canvas/evas_object_textblock.c | 8 +++++++-
 src/tests/evas/evas_test_textblock.c        | 9 +++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 879659c..30cfb91 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -3642,6 +3642,8 @@ loop_advance:
 static void
 _layout_line_advance(Ctxt *c, Evas_Object_Textblock_Format *fmt)
 {
+   Evas_Object_Textblock_Format *last_fmt = fmt;
+
    if (c->hyphen_ti)
      {
         c->ln->items = (Evas_Object_Textblock_Item *)
@@ -3652,7 +3654,11 @@ _layout_line_advance(Ctxt *c, 
Evas_Object_Textblock_Format *fmt)
            eina_list_append(c->o->hyphen_items, c->hyphen_ti);
         c->hyphen_ti = NULL;
      }
-   _layout_line_finalize(c, fmt);
+   if (c->ln->items)
+     {
+        last_fmt = _ITEM(EINA_INLIST_GET(c->ln->items)->last)->format;
+     }
+   _layout_line_finalize(c, last_fmt);
    _layout_line_new(c, fmt);
 }
 
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index ad16793..a14f599 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2162,6 +2162,15 @@ START_TEST(evas_textblock_wrapping)
         ck_assert_int_eq(bret, ret);
      }
 
+   /* Check that line wrap produces the same height values as paragraph break 
*/
+   evas_object_resize(tb, 1, 100);
+   evas_object_textblock_text_markup_set(tb, "<wrap=word>hello world");
+   evas_object_textblock_size_formatted_get(tb, NULL, &bh);
+   evas_object_textblock_text_markup_set(tb, "hello<ps>world");
+   evas_object_textblock_size_formatted_get(tb, NULL, &h);
+
+   ck_assert_int_eq(bh, h);
+
    END_TB_TEST();
 }
 END_TEST

-- 


Reply via email to