summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-10-14 22:21:54 +0300
committerCedric BAIL <cedric@osg.samsung.com>2017-11-10 10:29:44 -0800
commit0725ff620b77dd004cba856fc794af868c24203f (patch)
tree75ecb130763db0aa3eaae4645d3d873118e22d62 /src
parent20ecea1615e484b18a651fc4983b99abb85146eb (diff)
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 <cedric@osg.samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c13
-rw-r--r--src/tests/evas/evas_test_textblock.c15
2 files changed, 28 insertions, 0 deletions
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)
4193 int shad_sz = 0, shad_dst = 0, out_sz = 0; 4193 int shad_sz = 0, shad_dst = 0, out_sz = 0;
4194 int dx = 0, minx = 0, maxx = 0, shx1, shx2; 4194 int dx = 0, minx = 0, maxx = 0, shx1, shx2;
4195 Evas_Object_Protected_Data *obj = c->evas_o; 4195 Evas_Object_Protected_Data *obj = c->evas_o;
4196 int l, r, t, b;
4197 l = r = t = b = 0;
4196 4198
4197 if (fmt->font.font) 4199 if (fmt->font.font)
4198 { 4200 {
@@ -4289,6 +4291,16 @@ _text_item_update_sizes(Ctxt *c, Evas_Object_Textblock_Text_Item *ti)
4289 ti->parent.h = th; 4291 ti->parent.h = th;
4290 ti->parent.adv = advw; 4292 ti->parent.adv = advw;
4291 ti->parent.x = 0; 4293 ti->parent.x = 0;
4294
4295 l = -minx;
4296 r = maxx;
4297 // Get height padding as well
4298 evas_text_style_pad_get(fmt->style, NULL, NULL, &t, &b);
4299
4300 if (l > c->style_pad.l) c->style_pad.l = l;
4301 if (r > c->style_pad.r) c->style_pad.r = r;
4302 if (t > c->style_pad.t) c->style_pad.t = t;
4303 if (b > c->style_pad.b) c->style_pad.b = b;
4292} 4304}
4293 4305
4294/** 4306/**
@@ -6575,6 +6587,7 @@ _layout_done(Ctxt *c, Evas_Coord *w_ret, Evas_Coord *h_ret)
6575 c->o->style_pad.b = c->style_pad.b; 6587 c->o->style_pad.b = c->style_pad.b;
6576 _paragraphs_clear(c); 6588 _paragraphs_clear(c);
6577 LYDBG("ZZ: ... layout #2\n"); 6589 LYDBG("ZZ: ... layout #2\n");
6590 c->o->content_changed = 0;
6578 _layout(c->obj, c->w, c->h, w_ret, h_ret); 6591 _layout(c->obj, c->w, c->h, w_ret, h_ret);
6579 efl_event_callback_call(c->obj, EFL_CANVAS_TEXT_EVENT_STYLE_INSETS_CHANGED, NULL); 6592 efl_event_callback_call(c->obj, EFL_CANVAS_TEXT_EVENT_STYLE_INSETS_CHANGED, NULL);
6580 6593
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)
3668 ck_assert_int_eq(nw, 0); 3668 ck_assert_int_eq(nw, 0);
3669 ck_assert_int_eq(nw, nh); 3669 ck_assert_int_eq(nw, nh);
3670 3670
3671 evas_textblock_style_set(newst,
3672 "DEFAULT='" TEST_FONT " font_size=10 color=#000"
3673 " style=glow text_class=entry'");
3674 evas_object_textblock_style_set(tb, newst);
3675 evas_object_textblock_text_markup_set(tb, "Hello");
3676 evas_object_textblock_size_formatted_get(tb, &w, &h);
3677
3678 evas_textblock_style_set(newst,
3679 "DEFAULT='" TEST_FONT " font_size=10 color=#000 text_class=entry'");
3680 evas_object_textblock_style_set(tb, newst);
3681 evas_object_textblock_text_markup_set(tb,
3682 "<style=glow>Hello");
3683 evas_object_textblock_size_formatted_get(tb, &nw, &nh);
3684 ck_assert_int_eq(w, nw);
3685 ck_assert_int_eq(h, nh);
3671 END_TB_TEST(); 3686 END_TB_TEST();
3672} 3687}
3673END_TEST 3688END_TEST