forked from enlightenment/efl
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
This commit is contained in:
parent
5be33ba1aa
commit
c39855a8ac
|
@ -5415,8 +5415,16 @@ _layout_par(Ctxt *c)
|
||||||
|
|
||||||
/* After this par we are no longer at the beginning, as there
|
/* After this par we are no longer at the beginning, as there
|
||||||
* must be some text in the par. */
|
* must be some text in the par. */
|
||||||
if (c->position == TEXTBLOCK_POSITION_START)
|
if (!EINA_INLIST_GET(c->par)->next)
|
||||||
c->position = TEXTBLOCK_POSITION_ELSE;
|
{
|
||||||
|
c->position = (c->position == TEXTBLOCK_POSITION_START) ?
|
||||||
|
TEXTBLOCK_POSITION_SINGLE : TEXTBLOCK_POSITION_END;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (c->position == TEXTBLOCK_POSITION_START)
|
||||||
|
c->position = TEXTBLOCK_POSITION_ELSE;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5486,6 +5494,12 @@ _layout_par(Ctxt *c)
|
||||||
|
|
||||||
Eina_Bool item_preadv = EINA_FALSE;
|
Eina_Bool item_preadv = EINA_FALSE;
|
||||||
Evas_Textblock_Obstacle *obs = NULL;
|
Evas_Textblock_Obstacle *obs = NULL;
|
||||||
|
|
||||||
|
/* Initialize wmax by 0.
|
||||||
|
It means the width calculation will be processed.
|
||||||
|
So, it does not need to use previous calculated width. */
|
||||||
|
if (c->wmax == -1) c->wmax = 0;
|
||||||
|
|
||||||
for (i = c->par->logical_items ; i ; )
|
for (i = c->par->logical_items ; i ; )
|
||||||
{
|
{
|
||||||
Evas_Coord prevdescent = 0, prevascent = 0;
|
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)
|
||||||
c->x = c->y = 0;
|
c->x = c->y = 0;
|
||||||
c->w = w;
|
c->w = w;
|
||||||
c->h = h;
|
c->h = h;
|
||||||
c->wmax = c->hmax = 0;
|
c->wmax = c->hmax = -1;
|
||||||
c->ascent = c->descent = 0;
|
c->ascent = c->descent = 0;
|
||||||
c->maxascent = c->maxdescent = 0;
|
c->maxascent = c->maxdescent = 0;
|
||||||
c->marginl = c->marginr = 0;
|
c->marginl = c->marginr = 0;
|
||||||
|
@ -6426,8 +6440,14 @@ _relayout(const Evas_Object *eo_obj)
|
||||||
{
|
{
|
||||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||||
Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
|
Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
|
||||||
_layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h,
|
Evas_Coord fw, fh;
|
||||||
&o->formatted.w, &o->formatted.h);
|
|
||||||
|
_layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, &fw, &fh);
|
||||||
|
|
||||||
|
/* If formatted width/height from _layout() is -1,
|
||||||
|
It means the size calculation was skipped. */
|
||||||
|
if (fw >= 0) o->formatted.w = fw;
|
||||||
|
if (fh >= 0) o->formatted.h = fh;
|
||||||
o->formatted.valid = 1;
|
o->formatted.valid = 1;
|
||||||
o->formatted.oneline_h = 0;
|
o->formatted.oneline_h = 0;
|
||||||
o->last_w = obj->cur->geometry.w;
|
o->last_w = obj->cur->geometry.w;
|
||||||
|
|
Loading…
Reference in New Issue