forked from enlightenment/efl
edje_calc: Exception handling if no calculation is required.
If there is no object swllowed, do not run part_calc on it. This swallow will be calculated if there is an associated part, otherwise it will not need to be calculated. When the app is launched, a lot of edje calculation logic is executed. Most of the edje size is missing, so the calculation result is meaningless. Added code to prevent this. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10605
This commit is contained in:
parent
2288c92bc5
commit
37b55172b0
|
@ -988,6 +988,13 @@ _edje_recalc_table_parts(Edje *ed
|
|||
for (i = 0; i < ed->table_parts_size; i++)
|
||||
{
|
||||
ep = ed->table_parts[i];
|
||||
|
||||
//Ignore if the real part doesn't have swallowed object
|
||||
if ((ep->part->type == EDJE_PART_TYPE_SWALLOW) &&
|
||||
(ep->typedata.swallow) &&
|
||||
(!ep->typedata.swallow->swallowed_object))
|
||||
continue;
|
||||
|
||||
if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
|
||||
_edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
|
||||
}
|
||||
|
@ -996,6 +1003,25 @@ _edje_recalc_table_parts(Edje *ed
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_edje_recalc_textblock_style_text_set(Edje *ed)
|
||||
{
|
||||
unsigned short i;
|
||||
Edje_Real_Part *ep;
|
||||
Edje_Part_Description_Text *chosen_desc;
|
||||
|
||||
for (i = 0; i < ed->table_parts_size; i++)
|
||||
{
|
||||
ep = ed->table_parts[i];
|
||||
|
||||
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
||||
{
|
||||
_edje_part_textblock_style_text_set
|
||||
(ed, ep, (Edje_Part_Description_Text *)ep->chosen_description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_edje_recalc_do(Edje *ed)
|
||||
{
|
||||
|
@ -1005,6 +1031,17 @@ _edje_recalc_do(Edje *ed)
|
|||
Eina_Bool need_reinit_state = EINA_FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
//Do nothing if the edje has no size, Regardless of the edje part size calc,
|
||||
//the text and style has to be set.
|
||||
if ((EINA_UNLIKELY(!ed->has_size)) && (!ed->calc_only) && (ed->w == 0) && (ed->h == 0))
|
||||
{
|
||||
_edje_recalc_textblock_style_text_set(ed);
|
||||
|
||||
return;
|
||||
}
|
||||
ed->has_size = EINA_TRUE;
|
||||
|
||||
need_calc = evas_object_smart_need_recalculate_get(ed->obj);
|
||||
evas_object_smart_need_recalculate_set(ed->obj, 0);
|
||||
if (!ed->dirty) return;
|
||||
|
|
|
@ -1807,6 +1807,7 @@ struct _Edje
|
|||
Eina_Bool text_part_change : 1;
|
||||
Eina_Bool all_part_change : 1;
|
||||
#endif
|
||||
Eina_Bool has_size : 1;
|
||||
};
|
||||
|
||||
struct _Edje_Calc_Params_Map
|
||||
|
|
|
@ -416,22 +416,11 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_edje_part_recalc_single_textblock(FLOAT_T sc,
|
||||
Edje *ed,
|
||||
Eina_Bool
|
||||
_edje_part_textblock_style_text_set(Edje *ed,
|
||||
Edje_Real_Part *ep,
|
||||
Edje_Part_Description_Text *chosen_desc,
|
||||
Edje_Calc_Params *params,
|
||||
int *minw, int *minh,
|
||||
int *maxw, int *maxh)
|
||||
Edje_Part_Description_Text *chosen_desc)
|
||||
{
|
||||
if ((ep->type != EDJE_RP_TYPE_TEXT) ||
|
||||
(!ep->typedata.text))
|
||||
return;
|
||||
|
||||
if (chosen_desc)
|
||||
{
|
||||
Evas_Coord tw, th;
|
||||
const char *text = "";
|
||||
const char *style = "";
|
||||
Evas_Textblock_Style *stl = NULL;
|
||||
|
@ -478,14 +467,12 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
|
|||
if (chosen_desc->text.text.translated)
|
||||
text = chosen_desc->text.text.translated;
|
||||
}
|
||||
if (!text)
|
||||
text = edje_string_get(&chosen_desc->text.text);
|
||||
|
||||
if (!text) text = edje_string_get(&chosen_desc->text.text);
|
||||
|
||||
if (ep->typedata.text->text) text = ep->typedata.text->text;
|
||||
}
|
||||
|
||||
if (ep->part->scale)
|
||||
evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
|
||||
stl = _edje_textblock_style_get(ed, style);
|
||||
if (stl)
|
||||
{
|
||||
|
@ -501,6 +488,36 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
|
|||
evas_object_textblock_text_markup_set(ep->object, text);
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_edje_part_recalc_single_textblock(FLOAT_T sc,
|
||||
Edje *ed,
|
||||
Edje_Real_Part *ep,
|
||||
Edje_Part_Description_Text *chosen_desc,
|
||||
Edje_Calc_Params *params,
|
||||
int *minw, int *minh,
|
||||
int *maxw, int *maxh)
|
||||
{
|
||||
if ((ep->type != EDJE_RP_TYPE_TEXT) ||
|
||||
(!ep->typedata.text))
|
||||
return;
|
||||
|
||||
if (chosen_desc)
|
||||
{
|
||||
Evas_Coord tw, th;
|
||||
|
||||
if (ep->part->scale)
|
||||
evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
|
||||
//Gets textblock's style and text to set evas_object_textblock properties.
|
||||
//If there is no style for it. don't need to calc.
|
||||
if (_edje_part_textblock_style_text_set(ed, ep, chosen_desc))
|
||||
{
|
||||
if ((chosen_desc->text.fit_x) || (chosen_desc->text.fit_y))
|
||||
{
|
||||
double base_s = 1.0;
|
||||
|
|
Loading…
Reference in New Issue