diff options
author | Shinwoo Kim <cinoo.kim@samsung.com> | 2015-12-31 13:49:56 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-12-31 13:53:02 +0900 |
commit | fe70f0c080d2f168b5674cd4aa804ec95617739d (patch) | |
tree | 832100c90bd26ce2dd5bd01f38d4067a684f81da | |
parent | 7dcd467f2413f610ac873d67fcd66ad8c24b09eb (diff) | |
download | efl-fe70f0c080d2f168b5674cd4aa804ec95617739d.tar.gz |
edje: enhance circular dependency error message of edje calculation
Summary: enhance error message of edje calculation
Test Plan: check edje having circular dependency
Reviewers: raster, cedric, jpeg
Subscribers: seoz
Differential Revision: https://phab.enlightenment.org/D3484
-rw-r--r-- | src/lib/edje/edje_calc.c | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 0505580e63..d5163483c5 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3614,6 +3614,117 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, #define Rel1Y 1 #define Rel2X 2 #define Rel2Y 3 +Eina_Bool circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Eina_List **clist) +{ + Edje_Real_Part *rp = NULL; + + if (cep && !strcmp(ep->part->name, cep->part->name)) + { + return EINA_TRUE; + } + + if ((ep->calculating & FLAG_X)) + { + if (ep->param1.description) + { + if (ep->param1.description->rel1.id_x >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param1.description->rel1.id_x]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + if (ep->param1.description->rel2.id_x >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param1.description->rel2.id_x]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + } + + if (ep->param2) + { + if (ep->param2->description->rel1.id_x >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param2->description->rel1.id_x]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + if (ep->param2->description->rel2.id_x >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param2->description->rel2.id_x]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + } + } + if ((ep->calculating & FLAG_Y)) + { + if (ep->param1.description) + { + if (ep->param1.description->rel1.id_y >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param1.description->rel1.id_y]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + if (ep->param1.description->rel2.id_y >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param1.description->rel2.id_y]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + } + if (ep->param2) + { + if (ep->param2->description->rel1.id_y >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param2->description->rel1.id_y]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + if (ep->param2->description->rel2.id_y >= 0) + { + if (!cep) cep = ep; + rp = ed->table_parts[cep->param2->description->rel2.id_y]; + if (circular_dependency_find(ed, ep, rp, clist)) + { + *clist = eina_list_prepend(*clist, rp->part->name); + return EINA_TRUE; + } + } + } + } + + return EINA_FALSE; +} void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state) @@ -3686,6 +3797,23 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta ep->part->name, axes, ep->calculating, faxes, flags); + + Eina_List *clist = NULL; + Eina_List *l = NULL; + char *part_name; + char depends_path[PATH_MAX] = ""; + circular_dependency_find(ed, ep, NULL, &clist); + strncat(depends_path, ep->part->name, + sizeof(ep->part->name) - strlen(ep->part->name) - 1); + EINA_LIST_FOREACH(clist, l, part_name) + { + strncat(depends_path, " -> ", + sizeof(depends_path) - strlen(depends_path) - 1); + strncat(depends_path, part_name, + sizeof(depends_path) - strlen(depends_path) - 1); + } + ERR("Circular dependency: %s", depends_path); + eina_list_free(clist); #endif return; } |