summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-02-14 16:16:26 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-14 16:17:02 +0900
commitc39855a8ac6f86c2dd8b1856ed70f85e0e521f3e (patch)
tree5216779875113a93b06873ba80022540222ed2d2
parent5be33ba1aa50f62fb504c080ed6440ffa5192356 (diff)
evas textblock: keep previous size when the calculation is skipped
Summary: When a size calculation is skipped because of some reasons, Evas Textblock should keep same size with the previous size. @fix Test Plan: N/A Reviewers: raster, herdsman, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4659
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 2d2af2cbe0..fc0f5cc833 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -5415,8 +5415,16 @@ _layout_par(Ctxt *c)
5415 5415
5416 /* After this par we are no longer at the beginning, as there 5416 /* After this par we are no longer at the beginning, as there
5417 * must be some text in the par. */ 5417 * must be some text in the par. */
5418 if (c->position == TEXTBLOCK_POSITION_START) 5418 if (!EINA_INLIST_GET(c->par)->next)
5419 c->position = TEXTBLOCK_POSITION_ELSE; 5419 {
5420 c->position = (c->position == TEXTBLOCK_POSITION_START) ?
5421 TEXTBLOCK_POSITION_SINGLE : TEXTBLOCK_POSITION_END;
5422 }
5423 else
5424 {
5425 if (c->position == TEXTBLOCK_POSITION_START)
5426 c->position = TEXTBLOCK_POSITION_ELSE;
5427 }
5420 5428
5421 return 0; 5429 return 0;
5422 } 5430 }
@@ -5486,6 +5494,12 @@ _layout_par(Ctxt *c)
5486 5494
5487 Eina_Bool item_preadv = EINA_FALSE; 5495 Eina_Bool item_preadv = EINA_FALSE;
5488 Evas_Textblock_Obstacle *obs = NULL; 5496 Evas_Textblock_Obstacle *obs = NULL;
5497
5498 /* Initialize wmax by 0.
5499 It means the width calculation will be processed.
5500 So, it does not need to use previous calculated width. */
5501 if (c->wmax == -1) c->wmax = 0;
5502
5489 for (i = c->par->logical_items ; i ; ) 5503 for (i = c->par->logical_items ; i ; )
5490 { 5504 {
5491 Evas_Coord prevdescent = 0, prevascent = 0; 5505 Evas_Coord prevdescent = 0, prevascent = 0;
@@ -6244,7 +6258,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
6244 c->x = c->y = 0; 6258 c->x = c->y = 0;
6245 c->w = w; 6259 c->w = w;
6246 c->h = h; 6260 c->h = h;
6247 c->wmax = c->hmax = 0; 6261 c->wmax = c->hmax = -1;
6248 c->ascent = c->descent = 0; 6262 c->ascent = c->descent = 0;
6249 c->maxascent = c->maxdescent = 0; 6263 c->maxascent = c->maxdescent = 0;
6250 c->marginl = c->marginr = 0; 6264 c->marginl = c->marginr = 0;
@@ -6426,8 +6440,14 @@ _relayout(const Evas_Object *eo_obj)
6426{ 6440{
6427 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 6441 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
6428 Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); 6442 Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
6429 _layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, 6443 Evas_Coord fw, fh;
6430 &o->formatted.w, &o->formatted.h); 6444
6445 _layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, &fw, &fh);
6446
6447 /* If formatted width/height from _layout() is -1,
6448 It means the size calculation was skipped. */
6449 if (fw >= 0) o->formatted.w = fw;
6450 if (fh >= 0) o->formatted.h = fh;
6431 o->formatted.valid = 1; 6451 o->formatted.valid = 1;
6432 o->formatted.oneline_h = 0; 6452 o->formatted.oneline_h = 0;
6433 o->last_w = obj->cur->geometry.w; 6453 o->last_w = obj->cur->geometry.w;