edje_calc: Creation macro that perform edje calc, regardless of the edje size.

Summary: edje_recalc_do() needs to be executed regardless of the size of edje in order to deliver edje properties for the API that the user calls.

Reviewers: cedric, Hermet, Jaehyun_Cho, smohanty

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10724
This commit is contained in:
Woochanlee 2019-11-26 13:57:16 +09:00 committed by Hermet Park
parent 256c792837
commit 4ebbe0ad04
2 changed files with 20 additions and 35 deletions

View File

@ -1003,30 +1003,6 @@ _edje_recalc_table_parts(Edje *ed
#endif
}
// Defined in edje_textblock.c
Eina_Bool
_edje_part_textblock_style_text_set(Edje *ed,
Edje_Real_Part *ep,
Edje_Part_Description_Text *chosen_desc);
void
_edje_recalc_textblock_style_text_set(Edje *ed)
{
unsigned short i;
Edje_Real_Part *ep;
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)
{
@ -1037,14 +1013,9 @@ _edje_recalc_do(Edje *ed)
#endif
//Do nothing if the edje has no size, Regardless of the edje part size calc,
//the text and style has to be set.
//Do nothing if the edje has no size,
if ((EINA_UNLIKELY(!ed->has_size)) && (!ed->calc_only) && (ed->w == 0) && (ed->h == 0))
{
_edje_recalc_textblock_style_text_set(ed);
return;
}
return;
ed->has_size = EINA_TRUE;
need_calc = evas_object_smart_need_recalculate_get(ed->obj);

View File

@ -4,6 +4,20 @@
#include "../evas/canvas/evas_line_eo.h"
#include "../evas/canvas/evas_text_eo.h"
//In implementations that gets properties for user-created edje,
//edje calculation should be performed regardless of the size of edje.
#define EDJE_RECALC_DO(ed) \
do { \
Eina_Bool calc_flag = EINA_FALSE; \
if (!ed->has_size) \
{ \
ed->has_size = EINA_TRUE; \
calc_flag = EINA_TRUE; \
} \
_edje_recalc_do(ed); \
if (calc_flag) ed->has_size = EINA_FALSE; \
} while (0)
typedef struct _Edje_Box_Layout Edje_Box_Layout;
struct _Edje_Box_Layout
{
@ -1945,7 +1959,7 @@ edje_object_part_object_get(const Eo *obj, const char *part)
if ((!ed) || (!part)) return NULL;
/* Need to recalc before providing the object. */
if (!ed->freeze) _edje_recalc_do(ed);
if (!ed->freeze) EDJE_RECALC_DO(ed);
rp = _edje_real_part_recursive_get(&ed, part);
if (!rp) return NULL;
@ -2187,7 +2201,7 @@ _edje_efl_text_text_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part,
#else
if (ed->dirty)
#endif
_edje_recalc_do(ed);
EDJE_RECALC_DO(ed);
entry = evas_object_textblock_text_markup_get(rp->object);
}
}
@ -2200,7 +2214,7 @@ _edje_efl_text_text_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part,
#else
if (ed->dirty)
#endif
_edje_recalc_do(ed);
EDJE_RECALC_DO(ed);
entry = efl_text_markup_get(rp->object);
}
else
@ -3580,7 +3594,7 @@ _efl_canvas_layout_efl_layout_group_group_size_max_get(const Eo *obj EINA_UNUSED
return EINA_SIZE2D(0, 0);
/* Need to recalc before providing the object. */
if (!ed->freeze) _edje_recalc_do(ed);
if (!ed->freeze) EDJE_RECALC_DO(ed);
sz = ed->collection->prop.max;