edje_calc: Creation macro that perform edje calc, regardless of the edje size.
authorWoochanlee <wc0917.lee@samsung.com>
Tue, 26 Nov 2019 04:57:16 +0000 (13:57 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 26 Nov 2019 21:34:35 +0000 (06:34 +0900)
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

src/lib/edje/edje_calc.c
src/lib/edje/edje_util.c

index 2929609..bef66ee 100644 (file)
@@ -963,30 +963,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)
 {
@@ -997,14 +973,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);
index e5487d9..7bb87a3 100644 (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
 {
@@ -2039,7 +2053,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;
@@ -2281,7 +2295,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);
                     }
                }
@@ -2294,7 +2308,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
@@ -3748,7 +3762,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;