edje: update color_class/text_class logic for textblock 12/92912/6
authorYoungbok Shin <youngb.shin@samsung.com>
Wed, 19 Oct 2016 09:56:59 +0000 (18:56 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Mon, 31 Oct 2016 10:15:04 +0000 (19:15 +0900)
@tizen_fix

Change-Id: Id20225abb2e50b799f7e2201d961649fa96c829d

src/lib/edje/edje_cache.c
src/lib/edje/edje_calc.c
src/lib/edje/edje_load.c
src/lib/edje/edje_private.h
src/lib/edje/edje_textblock_styles.c
src/lib/edje/edje_util.c

index e0c5baf..77ae872 100644 (file)
@@ -609,6 +609,124 @@ _edje_file_cache_shutdown(void)
    edje_file_cache_flush();
 }
 
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+static Eina_Bool
+_textblock_styles_color_class_cache_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
+{
+   Edje_File *edf = data;
+   char *class_name = fdata;
+   Eina_List *l, *ll;
+   Edje_Style *stl;
+   Edje_Color_Class *cc = NULL, *tag_cc;
+
+   if (!class_name) return EINA_FALSE;
+
+   cc = _edje_color_class_recursive_find(NULL, edf, class_name);
+
+   if (!cc)
+     {
+        ERR("There is no Edje_Color_Class for file color_class: %s", class_name);
+        return EINA_FALSE;
+     }
+
+   EINA_LIST_FOREACH(edf->styles, l, stl)
+     {
+        Edje_Style_Tag *tag;
+        Eina_Bool found = EINA_FALSE;
+
+        if (!stl->cache) continue;
+
+        EINA_LIST_FOREACH(stl->tags, ll, tag)
+          {
+             if (!tag->color_class) continue;
+
+             tag_cc = _edje_color_class_recursive_find(NULL, edf, tag->color_class);
+             if (tag_cc == cc)
+               {
+                  found = EINA_TRUE;
+                  break;
+               }
+             if (tag_cc && cc && !strcmp(tag_cc->name, cc->name))
+               {
+                  found = EINA_TRUE;
+                  break;
+               }
+          }
+        if (found)
+          stl->cache = EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+void
+_edje_file_textblock_styles_color_class_cache_free(const char *class_name)
+{
+   if (!class_name) return;
+   if (!_edje_file_hash) return;
+
+   eina_hash_foreach(_edje_file_hash, _textblock_styles_color_class_cache_free, class_name);
+}
+
+static Eina_Bool
+_textblock_styles_text_class_cache_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
+{
+   Edje_File *edf = data;
+   char *class_name = fdata;
+   Eina_List *l, *ll;
+   Edje_Style *stl;
+
+   EINA_LIST_FOREACH(edf->styles, l, stl)
+     {
+        Edje_Style_Tag *tag;
+        Eina_Bool found = EINA_FALSE;
+
+        if (!stl->cache) continue;
+
+        EINA_LIST_FOREACH(stl->tags, ll, tag)
+          {
+             if (!tag->text_class) continue;
+
+             if (!strcmp(tag->text_class, class_name))
+               {
+                  found = EINA_TRUE;
+                  break;
+               }
+          }
+        if (found)
+          stl->cache = EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+void
+_edje_file_textblock_styles_text_class_cache_free(const char *class_name)
+{
+   if (!class_name) return;
+   if (!_edje_file_hash) return;
+
+   eina_hash_foreach(_edje_file_hash, _textblock_styles_text_class_cache_free, class_name);
+}
+
+static Eina_Bool
+_textblock_styles_cache_update(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
+{
+   Edje_File *edf = data;
+   _edje_file_textblock_style_all_update(edf);
+
+   return EINA_TRUE;
+}
+
+void
+_edje_file_textblock_styles_cache_update(void)
+{
+   if (!_edje_file_hash) return;
+
+   eina_hash_foreach(_edje_file_hash, _textblock_styles_cache_update, NULL);
+}
+/* END */
+
 /*============================================================================*
 *                                 Global                                     *
 *============================================================================*/
index b9a1808..6e4e620 100644 (file)
@@ -1536,11 +1536,30 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
              if (ep->typedata.text->text) text = ep->typedata.text->text;
           }
 
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
         EINA_LIST_FOREACH(ed->file->styles, l, stl)
           {
              if ((stl->name) && (!strcmp(stl->name, style))) break;
              stl = NULL;
           }
+         */
+        /* check object level styles */
+        EINA_LIST_FOREACH(ed->styles, l, stl)
+          {
+             if ((stl->name) && (!strcmp(stl->name, style))) break;
+             stl = NULL;
+          }
+
+        /* check file level styles */
+        if (!stl)
+          {
+             EINA_LIST_FOREACH(ed->file->styles, l, stl)
+               {
+                  if ((stl->name) && (!strcmp(stl->name, style))) break;
+                  stl = NULL;
+               }
+          }
+        /* END */
 
         if (ep->part->scale)
           evas_object_scale_set(ep->object, TO_DOUBLE(sc));
@@ -2879,8 +2898,12 @@ _edje_part_recalc_single(Edje *ed,
    /* colors */
    if (ep->part->type != EDJE_PART_TYPE_SPACER)
      {
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
         if ((desc->color_class) && (*desc->color_class))
           cc = _edje_color_class_recursive_find(ed, desc->color_class);
+         */
+        if ((desc->color_class) && (*desc->color_class))
+          cc = _edje_color_class_recursive_find(ed, ed->file, desc->color_class);
 
         if (cc)
           {
index 4cb916f..8c2c805 100644 (file)
@@ -544,7 +544,11 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
           edje_module_load(ed->file->external_dir->entries[i].entry);
      }
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    _edje_textblock_style_all_update(ed);
+    */
+   _edje_file_textblock_style_all_update(ed->file);
+   /* END */
 
    ed->has_entries = EINA_FALSE;
    if (ed->file && ed->file->mo_dir)
index 7213afb..a486a93 100644 (file)
@@ -1676,6 +1676,10 @@ struct _Edje
 
    Eina_List            *groups;
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   Eina_List            *styles;
+   /* END */
+
    Edje_Perspective     *persp;
 
    const Edje_Signal_Callback_Group *callbacks;
@@ -2478,7 +2482,11 @@ const char *   _edje_text_font_get(const char *base, const char *new,
 Edje_Real_Part   *_edje_real_part_get(const Edje *ed, const char *part);
 Edje_Real_Part   *_edje_real_part_recursive_get(Edje **ed, const char *part);
 Edje_Color_Class *_edje_color_class_find(const Edje *ed, const char *color_class);
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
 Edje_Color_Class *_edje_color_class_recursive_find(const Edje *ed, const char *color_class);
+*/
+Edje_Color_Class *_edje_color_class_recursive_find(const Edje *ed, const Edje_File *edf, const char *color_class);
+/* END */
 void              _edje_color_class_member_add(Edje *ed, const char *color_class);
 void              _edje_color_class_member_del(Edje *ed, const char *color_class);
 void              _edje_color_class_member_clean(Edje *ed);
@@ -2608,10 +2616,15 @@ void          _edje_message_del             (Edje *ed);
 
 void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep);
 void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt);
-/* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
 void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class);
  */
-void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class, const char *color_class);
+void _edje_file_textblock_styles_color_class_cache_free(const char *class_name);
+void _edje_file_textblock_styles_text_class_cache_free(const char *class_name);
+void _edje_file_textblock_styles_cache_update(void);
+void _edje_file_textblock_style_all_update(Edje_File *edf);
+void _edje_textblock_styles_color_class_cache_free(Edje *ed, const char *class_name);
+void _edje_textblock_styles_text_class_cache_free(Edje *ed, const char *class_name);
 /* END */
 void _edje_textblock_style_all_update(Edje *ed);
 void _edje_textblock_style_parse_and_fix(Edje_File *edf);
index fd501ac..5195352 100644 (file)
@@ -253,6 +253,43 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret)
    return ret;
 }
 
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+static Edje_Style *
+_edje_textblock_style_copy(Edje_Style *stl)
+{
+   Edje_Style *new_stl;
+   Eina_List *l;
+   Edje_Style_Tag *tag;
+   Edje_Style_Tag *new_tag;
+
+   new_stl = calloc(1, sizeof(Edje_Style));
+   if (!new_stl) return NULL;
+
+   new_stl->name = (char *)eina_stringshare_add(stl->name);
+   new_stl->style = evas_textblock_style_new();
+   evas_textblock_style_set(new_stl->style, NULL);
+
+   EINA_LIST_FOREACH(stl->tags, l, tag)
+     {
+        new_tag = calloc(1, sizeof(Edje_Style_Tag));
+        if (!new_tag) continue;
+
+        new_tag->key = eina_stringshare_add(tag->key);
+        new_tag->value = eina_stringshare_add(tag->value);
+        new_tag->font = eina_stringshare_add(tag->font);
+        new_tag->font_size = tag->font_size;
+        new_tag->text_class = eina_stringshare_add(tag->text_class);
+        new_tag->color_class = eina_stringshare_add(tag->color_class);
+        new_tag->color = eina_stringshare_add(tag->color);
+        new_tag->outline_color = eina_stringshare_add(tag->outline_color);
+        new_tag->shadow_color = eina_stringshare_add(tag->shadow_color);
+
+        new_stl->tags = eina_list_append(new_stl->tags, new_tag);
+     }
+
+   return new_stl;
+}
+/* END */
 
 /* Update the given evas_style
  *
@@ -320,9 +357,9 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force)
         /* Configure fonts from text class if it exists */
         tc = _edje_text_class_find(ed, tag->text_class);
 
-        /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style */
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
         /* Configure color from color class if it exists */
-        cc = _edje_color_class_recursive_find(ed, tag->color_class);
+        cc = _edje_color_class_recursive_find(ed, ed->file, tag->color_class);
         /* END */
 
         /* Add and Handle tag parsed data */
@@ -453,10 +490,15 @@ _edje_textblock_style_all_update(Edje *ed)
    Eina_List *l;
    Edje_Style *stl;
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    if (!ed->file) return;
 
    EINA_LIST_FOREACH(ed->file->styles, l, stl)
       _edje_textblock_style_update(ed, stl, EINA_FALSE);
+    */
+   EINA_LIST_FOREACH(ed->styles, l, stl)
+      _edje_textblock_style_update(ed, stl, EINA_FALSE);
+   /* END */
 }
 
 static inline Edje_Style *
@@ -477,6 +519,71 @@ _edje_textblock_style_search(Edje *ed, const char *style)
    return stl;
 }
 
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+static void
+_edje_textblock_styles_cache_add(Edje *ed, Edje_Style *stl)
+{
+   Eina_List *l;
+   Edje_Style *new_stl;
+
+   if (!stl) return;
+
+   EINA_LIST_FOREACH(ed->styles, l, new_stl)
+     {
+        if (!strcmp(stl->name, new_stl->name))
+          return;
+     }
+
+   new_stl = _edje_textblock_style_copy(stl);
+   if (new_stl)
+     {
+        ed->styles = eina_list_append(ed->styles, new_stl);
+        _edje_textblock_style_update(ed, new_stl, EINA_TRUE);
+     }
+}
+
+static void
+_edje_textblock_styles_cache_del(Edje *ed, Edje_Style *stl)
+{
+   Eina_List *l;
+   Edje_Style *new_stl;
+   Eina_Bool found = EINA_FALSE;
+
+   if (!stl) return;
+
+   EINA_LIST_FOREACH(ed->styles, l, new_stl)
+     {
+        if (!strcmp(stl->name, new_stl->name))
+          {
+             found = EINA_TRUE;
+             break;
+          }
+     }
+   if (found)
+     {
+        Edje_Style_Tag *tag;
+
+        EINA_LIST_FREE(new_stl->tags, tag)
+          {
+             if (tag->value)  eina_stringshare_del(tag->value);
+             if (tag->key) eina_stringshare_del(tag->key);
+             if (tag->text_class) eina_stringshare_del(tag->text_class);
+             if (tag->font) eina_stringshare_del(tag->font);
+             if (tag->color_class) eina_stringshare_del(tag->color_class);
+             if (tag->color) eina_stringshare_del(tag->color);
+             if (tag->outline_color) eina_stringshare_del(tag->outline_color);
+             if (tag->shadow_color) eina_stringshare_del(tag->shadow_color);
+             free(tag);
+          }
+        if (new_stl->name) eina_stringshare_del(new_stl->name);
+        if (new_stl->style) evas_textblock_style_free(new_stl->style);
+        free(new_stl);
+
+        ed->styles = eina_list_remove_list(ed->styles, l);
+     }
+}
+/* END */
+
 static inline void
 _edje_textblock_style_member_add(Edje *ed, Edje_Style *stl)
 {
@@ -514,8 +621,12 @@ _edje_textblock_style_member_add(Edje *ed, Edje_Style *stl)
 
         /* Newly added text_class member should be updated
            according to the latest text_class's status. */
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
         if (force_update)
           _edje_textblock_style_update(ed, stl, EINA_TRUE);
+         */
+        if (force_update)
+          _edje_textblock_styles_cache_add(ed, stl);
         /* END */
      }
 }
@@ -584,6 +695,11 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt)
              if (tag->color_class)
                _edje_color_class_member_del(ed, tag->color_class);
              /* END */
+
+             /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+             if (tag->text_class || tag->color_class)
+               _edje_textblock_styles_cache_del(ed, stl);
+             /* END */
           }
      }
 
@@ -615,23 +731,15 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt)
      }
 }
 
-/* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
 void
 _edje_textblock_styles_cache_free(Edje *ed, const char *text_class, const char *color_class)
- */
-void
-_edje_textblock_styles_cache_free(Edje *ed, const char *text_class, const char *color_class)
-/* END */
 {
    Eina_List *l, *ll;
    Edje_Style *stl;
 
    if (!ed->file) return;
-   /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
    if (!text_class) return;
-    */
-   if (!text_class && !color_class) return;
-   /* END */
 
    EINA_LIST_FOREACH(ed->file->styles, l, stl)
      {
@@ -640,7 +748,6 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class, const char *
 
         EINA_LIST_FOREACH(stl->tags, ll, tag)
           {
-             /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
              if (!tag->text_class) continue;
 
              if (!strcmp(tag->text_class, text_class))
@@ -648,28 +755,92 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class, const char *
                   found = EINA_TRUE;
                   break;
                }
-              */
-             if (!tag->text_class && !tag->color_class) continue;
+          }
+        if (found)
+          stl->cache = EINA_FALSE;
+     }
+}
+ */
+
+void
+_edje_textblock_styles_color_class_cache_free(Edje *ed, const char *class_name)
+{
+   Eina_List *l, *ll;
+   Edje_Style *stl;
+   Edje_Color_Class *cc = NULL, *tag_cc;
+
+   if (!class_name) return;
+
+   cc = _edje_color_class_recursive_find(ed, ed->file, class_name);
 
-             if (tag->text_class && text_class &&
-                 !strcmp(tag->text_class, text_class))
+   if (!cc)
+     {
+        ERR("There is no Edje_Color_Class for color_class: %s", class_name);
+        return;
+     }
+
+   EINA_LIST_FOREACH(ed->styles, l, stl)
+     {
+        Edje_Style_Tag *tag;
+        Eina_Bool found = EINA_FALSE;
+
+        if (!stl->cache) continue;
+
+        EINA_LIST_FOREACH(stl->tags, ll, tag)
+          {
+             if (!tag->color_class) continue;
+
+             if (tag->color_class)
                {
-                  found = EINA_TRUE;
-                  break;
+                  tag_cc = _edje_color_class_recursive_find(ed, ed->file, tag->color_class);
+                  if (tag_cc == cc)
+                    {
+                       found = EINA_TRUE;
+                       break;
+                    }
+                  if (tag_cc && cc && !strcmp(tag_cc->name, cc->name))
+                    {
+                       found = EINA_TRUE;
+                       break;
+                    }
                }
+          }
+        if (found)
+          stl->cache = EINA_FALSE;
+     }
+}
 
-             if (tag->color_class && color_class &&
-                 !strcmp(tag->color_class, color_class))
+void
+_edje_textblock_styles_text_class_cache_free(Edje *ed, const char *class_name)
+{
+   Eina_List *l, *ll;
+   Edje_Style *stl;
+
+   if (!class_name) return;
+
+   EINA_LIST_FOREACH(ed->styles, l, stl)
+     {
+        Edje_Style_Tag *tag;
+        Eina_Bool found = EINA_FALSE;
+
+        if (!stl->cache) continue;
+
+        EINA_LIST_FOREACH(stl->tags, ll, tag)
+          {
+             if (!tag->text_class) continue;
+
+             if (tag->text_class && class_name &&
+                 !strcmp(tag->text_class, class_name))
                {
                   found = EINA_TRUE;
                   break;
                }
-             /* END */
           }
         if (found)
           stl->cache = EINA_FALSE;
      }
 }
+/* END */
 
 /* When we get to here the edje file had been read into memory
  * the name of the style is established as well as the name and
@@ -811,3 +982,184 @@ _edje_textblock_style_cleanup(Edje_File *edf)
      }
 }
 
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+void
+_edje_file_textblock_style_all_update(Edje_File *edf)
+{
+   Eina_List *l, *ll;
+   Edje_Style *stl;
+   Eina_Strbuf *txt = NULL;
+
+   if (!edf) return;
+
+   EINA_LIST_FOREACH(edf->styles, l, stl)
+     {
+        Edje_Style_Tag *tag;
+        Edje_Text_Class *tc;
+        Edje_Color_Class *cc;
+        int found = 0;
+        char *fontset = NULL, *fontsource = NULL;
+
+        /* Make sure the style is already defined */
+        if (!stl->style) break;
+
+        /* No need to compute it again and again and again */
+        if (stl->cache) continue;
+
+        /* Make sure the style contains a text_class */
+        EINA_LIST_FOREACH(stl->tags, ll, tag)
+          {
+             if (tag->text_class)
+               {
+                  found = 1;
+                  break;
+               }
+             if (tag->color_class)
+               {
+                  found = 1;
+                  break;
+               }
+          }
+
+        /* No text classes or color classes, goto next style */
+        if (!found) continue;
+        if (!txt)
+          txt = eina_strbuf_new();
+
+        if (_edje_fontset_append)
+          fontset = eina_str_escape(_edje_fontset_append);
+        fontsource = eina_str_escape(edf->path);
+
+        /* Build the style from each tag */
+        EINA_LIST_FOREACH(stl->tags, ll, tag)
+          {
+             if (!tag->key) continue;
+
+             /* Add Tag Key */
+             eina_strbuf_append(txt, tag->key);
+             eina_strbuf_append(txt, "='");
+
+             /* Configure fonts from text class if it exists */
+             tc = _edje_text_class_find(NULL, tag->text_class);
+
+             /* Configure color from color class if it exists */
+             cc = _edje_color_class_recursive_find(NULL, edf, tag->color_class);
+
+             /* Add and Handle tag parsed data */
+             eina_strbuf_append(txt, tag->value);
+
+             if (!strcmp(tag->key, "DEFAULT"))
+               {
+                  if (fontset)
+                    {
+                       eina_strbuf_append(txt, " ");
+                       eina_strbuf_append(txt, "font_fallbacks=");
+                       eina_strbuf_append(txt, fontset);
+                    }
+                  eina_strbuf_append(txt, " ");
+                  eina_strbuf_append(txt, "font_source=");
+                  eina_strbuf_append(txt, fontsource);
+               }
+             if (tag->font_size != 0)
+               {
+                  char font_size[32];
+
+                  if (tc && tc->size)
+                    snprintf(font_size, sizeof(font_size), "%f",
+                             (double)_edje_text_size_calc(tag->font_size, tc));
+                  else
+                    snprintf(font_size, sizeof(font_size), "%f",
+                             tag->font_size);
+
+                  eina_strbuf_append(txt, " ");
+                  eina_strbuf_append(txt, "font_size=");
+                  eina_strbuf_append(txt, font_size);
+               }
+             /* Add font name last to save evas from multiple loads */
+             if (tag->font)
+               {
+                  const char *f;
+                  char *sfont = NULL;
+
+                  eina_strbuf_append(txt, " ");
+                  eina_strbuf_append(txt, "font=");
+
+                  if (tc) f = _edje_text_font_get(tag->font, tc->font, &sfont);
+                  else f = tag->font;
+
+                  eina_strbuf_append_escaped(txt, f);
+
+                  if (sfont) free(sfont);
+               }
+             if (tag->color)
+               {
+                  eina_strbuf_append(txt, " ");
+                  eina_strbuf_append(txt, "color=");
+
+                  if (cc)
+                    {
+                       char *color;
+
+                       color = _edje_textblock_color_calc(tag->color,
+                                                          cc->r, cc->g, cc->b, cc->a);
+                       eina_strbuf_append_escaped(txt, (const char *)color);
+                       if (color) free(color);
+                    }
+                  else
+                    {
+                       eina_strbuf_append_escaped(txt, tag->color);
+                    }
+               }
+             if (tag->outline_color)
+               {
+                  eina_strbuf_append(txt, " ");
+                  eina_strbuf_append(txt, "outline_color=");
+
+                  if (cc)
+                    {
+                       char *color;
+
+                       color = _edje_textblock_color_calc(tag->outline_color,
+                                                          cc->r2, cc->g2, cc->b2, cc->a2);
+                       eina_strbuf_append_escaped(txt, (const char *)color);
+                       if (color) free(color);
+                    }
+                  else
+                    {
+                       eina_strbuf_append_escaped(txt, tag->outline_color);
+                    }
+               }
+             if (tag->shadow_color)
+               {
+                  eina_strbuf_append(txt, " ");
+                  eina_strbuf_append(txt, "shadow_color=");
+
+                  if (cc)
+                    {
+                       char *color;
+
+                       color = _edje_textblock_color_calc(tag->shadow_color,
+                                                          cc->r3, cc->g3, cc->b3, cc->a3);
+                       eina_strbuf_append_escaped(txt, (const char *)color);
+                       if (color) free(color);
+                    }
+                  else
+                    {
+                       eina_strbuf_append_escaped(txt, tag->shadow_color);
+                    }
+               }
+
+             eina_strbuf_append(txt, "'");
+          }
+        if (fontset) free(fontset);
+        if (fontsource) free(fontsource);
+
+        /* Configure the style */
+        stl->cache = EINA_TRUE;
+        evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt));
+        eina_strbuf_reset(txt);
+     }
+   if (txt)
+     eina_strbuf_free(txt);
+}
+/* END */
index f354fb1..1e8ab1f 100644 (file)
@@ -668,6 +668,11 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
    cc->b3 = b3;
    cc->a3 = a3;
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   _edje_file_textblock_styles_color_class_cache_free(color_class);
+   _edje_file_textblock_styles_cache_update();
+   /* END */
+
    members = eina_hash_find(_edje_color_class_member_hash, color_class);
    if (!members) return EINA_TRUE;
    it = eina_hash_iterator_data_new(members);
@@ -678,8 +683,8 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
 #ifdef EDJE_CALC_CACHE
         er->ed->all_part_change = EINA_TRUE;
 #endif
-        /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style */
-        _edje_textblock_styles_cache_free(er->ed, NULL, color_class);
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+        _edje_textblock_styles_color_class_cache_free(er->ed, color_class);
         _edje_textblock_style_all_update(er->ed);
         /* END */
         _edje_recalc(er->ed);
@@ -742,6 +747,11 @@ edje_color_class_del(const char *color_class)
    eina_stringshare_del(cc->name);
    free(cc);
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   _edje_file_textblock_styles_color_class_cache_free(color_class);
+   _edje_file_textblock_styles_cache_update();
+   /* END */
+
    members = eina_hash_find(_edje_color_class_member_hash, color_class);
    if (!members) return;
    it = eina_hash_iterator_data_new(members);
@@ -752,8 +762,8 @@ edje_color_class_del(const char *color_class)
 #ifdef EDJE_CALC_CACHE
         er->ed->all_part_change = EINA_TRUE;
 #endif
-        /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style */
-        _edje_textblock_styles_cache_free(er->ed, NULL, color_class);
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+        _edje_textblock_styles_color_class_cache_free(er->ed, color_class);
         _edje_textblock_style_all_update(er->ed);
         /* END */
         _edje_recalc(er->ed);
@@ -951,8 +961,8 @@ update_color_class:
                                       a3);
      }
 
-   /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style */
-   _edje_textblock_styles_cache_free(ed, NULL, color_class);
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   _edje_textblock_styles_color_class_cache_free(ed, color_class);
    _edje_textblock_style_all_update(ed);
    /* END */
    _edje_recalc(ed);
@@ -1031,8 +1041,8 @@ edje_object_color_class_del(Evas_Object *obj, const char *color_class)
 #ifdef EDJE_CALC_CACHE
    ed->all_part_change = EINA_TRUE;
 #endif
-   /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style */
-   _edje_textblock_styles_cache_free(ed, NULL, color_class);
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   _edje_textblock_styles_color_class_cache_free(ed, color_class);
    _edje_textblock_style_all_update(ed);
    /* END */
    _edje_recalc(ed);
@@ -1200,6 +1210,11 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
         tc->size = size;
      }
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   _edje_file_textblock_styles_text_class_cache_free(text_class);
+   _edje_file_textblock_styles_cache_update();
+   /* END */
+
    /* Tell all members of the text class to recalc */
    members = eina_hash_find(_edje_text_class_member_hash, text_class);
    it = eina_hash_iterator_data_new(members);
@@ -1207,10 +1222,10 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
      {
         er->ed->dirty = EINA_TRUE;
         er->ed->recalc_call = EINA_TRUE;
-        /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
         _edje_textblock_styles_cache_free(er->ed, text_class);
          */
-        _edje_textblock_styles_cache_free(er->ed, text_class, NULL);
+        _edje_textblock_styles_text_class_cache_free(er->ed, text_class);
         /* END */
         _edje_textblock_style_all_update(er->ed);
 #ifdef EDJE_CALC_CACHE
@@ -1264,15 +1279,20 @@ edje_text_class_del(const char *text_class)
    eina_stringshare_del(tc->font);
    free(tc);
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock */
+   _edje_file_textblock_styles_text_class_cache_free(text_class);
+   _edje_file_textblock_styles_cache_update();
+   /* END */
+
    members = eina_hash_find(_edje_text_class_member_hash, text_class);
    it = eina_hash_iterator_data_new(members);
    EINA_ITERATOR_FOREACH(it, er)
      {
         er->ed->dirty = EINA_TRUE;
-        /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
+        /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
         _edje_textblock_styles_cache_free(er->ed, text_class);
          */
-        _edje_textblock_styles_cache_free(er->ed, text_class, NULL);
+        _edje_textblock_styles_text_class_cache_free(er->ed, text_class);
         /* END */
         _edje_textblock_style_all_update(er->ed);
 #ifdef EDJE_CALC_CACHE
@@ -1369,10 +1389,10 @@ _edje_object_text_class_set(Eo *obj EINA_UNUSED, Edje *ed, const char *text_clas
 #ifdef EDJE_CALC_CACHE
    ed->text_part_change = EINA_TRUE;
 #endif
-   /* TIZEN_ONLY(20160908): Apply color_class to TEXTBLOCK part's style
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    _edje_textblock_styles_cache_free(ed, text_class);
     */
-   _edje_textblock_styles_cache_free(ed, text_class, NULL);
+   _edje_textblock_styles_text_class_cache_free(ed, text_class);
    /* END */
    _edje_textblock_style_all_update(ed);
    _edje_recalc(ed);
@@ -5667,6 +5687,7 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char *key)
    return data;
 }
 
+/* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
 Edje_Color_Class *
 _edje_color_class_recursive_find(const Edje *ed, const char *color_class)
 {
@@ -5674,20 +5695,44 @@ _edje_color_class_recursive_find(const Edje *ed, const char *color_class)
 
    if ((!ed) || (!color_class)) return NULL;
 
-   /* first look through the object scope */
+   // first look through the object scope //
    cc = _edje_hash_find_helper(ed->color_classes, color_class);
    if (cc) return cc;
 
+   // next look through the global scope //
+   cc = _edje_hash_find_helper(_edje_color_class_hash, color_class);
+   if (cc) return cc;
+
+   // finally, look through the file scope //
+   cc = _edje_hash_find_helper(ed->file->color_hash, color_class);
+   if (cc) return cc;
+
+   return NULL;
+}
+ */
+
+Edje_Color_Class *
+_edje_color_class_recursive_find(const Edje *ed, const Edje_File *edf, const char *color_class)
+{
+   Edje_Color_Class *cc = NULL;
+
+   if (!color_class) return NULL;
+
+   /* first look through the object scope */
+   if (ed) cc = _edje_hash_find_helper(ed->color_classes, color_class);
+   if (cc) return cc;
+
    /* next look through the global scope */
    cc = _edje_hash_find_helper(_edje_color_class_hash, color_class);
    if (cc) return cc;
 
    /* finally, look through the file scope */
-   cc = _edje_hash_find_helper(ed->file->color_hash, color_class);
+   if (edf) cc = _edje_hash_find_helper(edf->color_hash, color_class);
    if (cc) return cc;
 
    return NULL;
 }
+/* END */
 //
 
 Edje_Color_Class *
@@ -5695,10 +5740,18 @@ _edje_color_class_find(const Edje *ed, const char *color_class)
 {
    Edje_Color_Class *cc = NULL;
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    if ((!ed) || (!color_class)) return NULL;
+    */
+   if (!color_class) return NULL;
+   /* END */
 
    /* first look through the object scope */
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    cc = eina_hash_find(ed->color_classes, color_class);
+    */
+   if (ed) cc = eina_hash_find(ed->color_classes, color_class);
+   /* END */
    if (cc) return cc;
 
    /* next look through the global scope */
@@ -5706,7 +5759,11 @@ _edje_color_class_find(const Edje *ed, const char *color_class)
    if (cc) return cc;
 
    /* finally, look through the file scope */
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    cc = eina_hash_find(ed->file->color_hash, color_class);
+    */
+   if (ed) cc = eina_hash_find(ed->file->color_hash, color_class);
+   /* END */
 
    if (cc) return cc;
 
@@ -5778,9 +5835,20 @@ _edje_text_class_find(Edje *ed, const char *text_class)
    Eina_List *l;
    Edje_Text_Class *tc;
 
+   /* TIZEN_ONLY(20161019): update color_class/text_class logic for textblock
    if ((!ed) || (!text_class)) return NULL;
    EINA_LIST_FOREACH(ed->text_classes, l, tc)
      if ((tc->name) && (!strcmp(text_class, tc->name))) return tc;
+    */
+   if (!text_class) return NULL;
+
+   if (ed)
+     {
+        EINA_LIST_FOREACH(ed->text_classes, l, tc)
+           if ((tc->name) && (!strcmp(text_class, tc->name))) return tc;
+     }
+   /* END */
+
    return eina_hash_find(_edje_text_class_hash, text_class);
 }