raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=276513f58be6d0e859bd7108301d522ce0d1a6b0

commit 276513f58be6d0e859bd7108301d522ce0d1a6b0
Author: Carsten Haitzler <ras...@rasterman.com>
Date:   Mon Aug 9 19:03:38 2021 +0100

    edje - fix up colorclass lookups to always be recrusvie now
---
 src/lib/edje/edje_calc.c    |  2 +-
 src/lib/edje/edje_embryo.c  |  2 +-
 src/lib/edje/edje_lua2.c    |  2 +-
 src/lib/edje/edje_private.h |  1 -
 src/lib/edje/edje_util.c    | 55 +++------------------------------------------
 5 files changed, 6 insertions(+), 56 deletions(-)

diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 221e7b645d..7d66345955 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -2560,7 +2560,7 @@ _edje_part_recalc_single_filter(Edje *ed,
                        if (r && (r[1] == ')') && (r[2] == '\0'))
                          {
                             *r = '\0';
-                            cc = _edje_color_class_find(ed, ccname);
+                            cc = _edje_color_class_recursive_find(ed, ccname);
                             if (cc)
                               {
                                  static const char fmt[] =
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c
index bb3828ab3d..0b3c3b0dc7 100644
--- a/src/lib/edje/edje_embryo.c
+++ b/src/lib/edje/edje_embryo.c
@@ -1619,7 +1619,7 @@ _edje_embryo_fn_get_color_class(Embryo_Program *ep, 
Embryo_Cell *params)
    ed = embryo_program_data_get(ep);
    GETSTR(class, params[1]);
    if (!class) return 0;
-   c_class = _edje_color_class_find(ed, class);
+   c_class = _edje_color_class_recursive_find(ed, class);
    if (!c_class) return 0;
    SETINT(c_class->r, params[2]);
    SETINT(c_class->g, params[3]);
diff --git a/src/lib/edje/edje_lua2.c b/src/lib/edje/edje_lua2.c
index 6032528815..28e6667fda 100644
--- a/src/lib/edje/edje_lua2.c
+++ b/src/lib/edje/edje_lua2.c
@@ -1458,7 +1458,7 @@ _elua_color_class(lua_State *L) // Stack usage [-(10|14), 
+(11|15), ?]
         edje_color_class_set(class, r, g, b, a, r, g, b, a, r, g, b, a);
      }
 
-   c_class = _edje_color_class_find(ed, class);
+   c_class = _edje_color_class_recursive_find(ed, class);
    if (!c_class) return 0;
 
    _elua_ret(L, "%r %g %b %a", c_class->r, c_class->g, c_class->b, c_class->a);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index c0e3f6c247..1d289123a7 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2538,7 +2538,6 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
 
 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);
 // The color_class has to be a pointer to an Eet owned string.
 Edje_Color_Class *_edje_color_class_recursive_find(const Edje *ed, const char 
*color_class);
 void              _edje_color_class_on_del(Edje *ed, Edje_Part *ep);
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index bfbd7c2649..f4d2b4c57f 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -840,7 +840,7 @@ _edje_color_class_active_iterator_next(Eina_Iterator *it, 
void **data)
       It is being assumed that the color key are the same for all object here.
       This can some times not be the case, but for now we should be fine.
     */
-   cc = _edje_color_class_find(ed, tuple->key);
+   cc = _edje_color_class_recursive_find(ed, tuple->key);
    if (!cc) return EINA_FALSE;
    et->cc = *cc;
 
@@ -972,7 +972,7 @@ 
_efl_canvas_layout_efl_gfx_color_class_color_class_get(const Eo *obj EINA_UNUSED
    if (!color_class)
      cc = NULL;
    else
-     cc = _edje_color_class_find(ed, color_class);
+     cc = _edje_color_class_recursive_find(ed, color_class);
 
    return _edje_color_class_get_internal(cc, layer, r, g, b, a);
 }
@@ -986,7 +986,7 @@ edje_object_color_class_description_get(const Evas_Object 
*obj, const char *colo
 EOLIAN const char *
 _efl_canvas_layout_efl_gfx_color_class_color_class_description_get(const Eo 
*obj EINA_UNUSED, Edje *ed, const char *color_class)
 {
-   Edje_Color_Class *cc = _edje_color_class_find(ed, color_class);
+   Edje_Color_Class *cc = _edje_color_class_recursive_find(ed, color_class);
    return cc ? cc->desc : NULL;
 }
 
@@ -5854,55 +5854,6 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char 
*key)
    return data;
 }
 
-Edje_Color_Class *
-_edje_color_class_find(const Edje *ed, const char *color_class)
-{
-   Edje_Color_Class *cc = NULL;
-
-   if ((!ed) || (!color_class)) return NULL;
-
-   /* first look through the object scope */
-   cc = eina_hash_find(ed->color_classes, color_class);
-   if (cc) return cc;
-
-   /* next look through the global scope */
-   cc = eina_hash_find(_edje_color_class_hash, color_class);
-   if (cc) return cc;
-
-   /* finally, look through the file scope */
-   if (ed->file)
-     cc = eina_hash_find(ed->file->color_hash, color_class);
-   if (cc) return cc;
-
-   // fall back to parent class. expecting classes like:
-   // /bg <- fallback for /bg/*
-   // /bg/normal <- fallback for /bg/normal/*
-   // /bg/normal/button <- mid grey
-   // etc.
-   if (color_class[0] == '/')
-     {
-        size_t len = strlen(color_class);
-        char *color_class_parent = alloca(len + 1);
-        const char *src = color_class;
-        char *last_slash = NULL, *dst = color_class_parent;
-
-        for (;; src++, dst++)
-          {
-             *dst = *src;
-             if (*dst == '/') last_slash = dst;
-             if (*dst == 0) break;
-          }
-        if (last_slash)
-          {
-             if (last_slash == color_class_parent)
-               return NULL;
-             *last_slash = 0;
-          }
-        return _edje_color_class_find(ed, color_class_parent);
-     }
-   return NULL;
-}
-
 Edje_Color_Class *
 _edje_color_class_recursive_find_helper(const Edje *ed, Eina_Hash *hash, const 
char *color_class)
 {

-- 


Reply via email to