cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0725ff620b77dd004cba856fc794af868c24203f

commit 0725ff620b77dd004cba856fc794af868c24203f
Author: Daniel Hirt <[email protected]>
Date:   Sat Oct 14 22:21:54 2017 +0300

    Canvas text: update style pad when no format nodes are present
    
    This updates the style pad even if there are no format nodes.
    An example of this is having a default style set to the object.
    
    Signed-off-by: Cedric BAIL <[email protected]>
---
 src/lib/evas/canvas/evas_object_textblock.c | 13 +++++++++++++
 src/tests/evas/evas_test_textblock.c        | 15 +++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 7d91e68770..b62b5cc80b 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -4193,6 +4193,8 @@ _text_item_update_sizes(Ctxt *c, 
Evas_Object_Textblock_Text_Item *ti)
    int shad_sz = 0, shad_dst = 0, out_sz = 0;
    int dx = 0, minx = 0, maxx = 0, shx1, shx2;
    Evas_Object_Protected_Data *obj = c->evas_o;
+   int l, r, t, b;
+   l = r = t = b = 0;
 
    if (fmt->font.font)
      {
@@ -4289,6 +4291,16 @@ _text_item_update_sizes(Ctxt *c, 
Evas_Object_Textblock_Text_Item *ti)
    ti->parent.h = th;
    ti->parent.adv = advw;
    ti->parent.x = 0;
+
+   l = -minx;
+   r = maxx;
+   // Get height padding as well
+   evas_text_style_pad_get(fmt->style, NULL, NULL, &t, &b);
+
+   if (l > c->style_pad.l) c->style_pad.l = l;
+   if (r > c->style_pad.r) c->style_pad.r = r;
+   if (t > c->style_pad.t) c->style_pad.t = t;
+   if (b > c->style_pad.b) c->style_pad.b = b;
 }
 
 /**
@@ -6575,6 +6587,7 @@ _layout_done(Ctxt *c, Evas_Coord *w_ret, Evas_Coord 
*h_ret)
         c->o->style_pad.b = c->style_pad.b;
         _paragraphs_clear(c);
         LYDBG("ZZ: ... layout #2\n");
+        c->o->content_changed = 0;
         _layout(c->obj, c->w, c->h, w_ret, h_ret);
         efl_event_callback_call(c->obj, 
EFL_CANVAS_TEXT_EVENT_STYLE_INSETS_CHANGED, NULL);
 
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index 6700bdc3e6..24f0d27135 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -3668,6 +3668,21 @@ START_TEST(evas_textblock_style)
    ck_assert_int_eq(nw, 0);
    ck_assert_int_eq(nw, nh);
 
+   evas_textblock_style_set(newst,
+         "DEFAULT='" TEST_FONT " font_size=10 color=#000"
+         "  style=glow text_class=entry'");
+   evas_object_textblock_style_set(tb, newst);
+   evas_object_textblock_text_markup_set(tb, "Hello");
+   evas_object_textblock_size_formatted_get(tb, &w, &h);
+
+   evas_textblock_style_set(newst,
+         "DEFAULT='" TEST_FONT " font_size=10 color=#000 text_class=entry'");
+   evas_object_textblock_style_set(tb, newst);
+   evas_object_textblock_text_markup_set(tb,
+         "<style=glow>Hello");
+   evas_object_textblock_size_formatted_get(tb, &nw, &nh);
+   ck_assert_int_eq(w, nw);
+   ck_assert_int_eq(h, nh);
    END_TB_TEST();
 }
 END_TEST

-- 


Reply via email to