edje_cc: fix inheriting script from other group 80/87280/3
authorJee-Yong Um <conr2d@gmail.com>
Wed, 7 Sep 2016 08:13:24 +0000 (17:13 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 7 Sep 2016 12:54:29 +0000 (05:54 -0700)
Summary:
If a group inherits from the other, group script block is copied
only when there are program script blocks in parent group.
This patch makes edje_cc always copies group script block,
but allows to override group script block in child group.
The content of reverted D3799 is included. That reveals this inconsistency.

Reviewers: cedric

Subscribers: Jaehyun_Cho, woohyun, jpeg

Differential Revision: https://phab.enlightenment.org/D3802

Change-Id: I047fda5a8b40d41a4262a8d499e117e08bfa2d94

src/bin/edje/edje_cc_handlers.c

index 1cd56f6..00c693a 100644 (file)
@@ -163,6 +163,7 @@ static Edje_Part_Description_Common *parent_desc = NULL;
 static Edje_Program *current_program = NULL;
 static Eina_List *current_program_lookups = NULL;
 Eina_Bool current_group_inherit = EINA_FALSE;
+Eina_Bool script_override = EINA_FALSE;
 static Edje_Program *sequencing = NULL;
 static Eina_List *sequencing_lookups = NULL;
 
@@ -3549,8 +3550,8 @@ ob_collections_group(void)
    current_part = NULL;
    current_desc = NULL;
 
-
    current_group_inherit = EINA_FALSE;
+   script_override = EINA_FALSE;
 
    current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
    current_de->id = eina_list_count(edje_collections);
@@ -4113,6 +4114,11 @@ st_collections_group_inherit(void)
    cd2 = eina_list_nth(codes, de->id);
    cd = eina_list_data_get(eina_list_last(codes));
 
+   cd->is_lua = cd2->is_lua;
+   cd->shared = cd2->shared;
+   cd->original = cd2->original;
+   script_override = EINA_TRUE;
+
    EINA_LIST_FOREACH(cd2->programs, l, cp2)
      {
         cp = mem_alloc(SZ(Code_Program));
@@ -4121,9 +4127,6 @@ st_collections_group_inherit(void)
         cp->l2 = cp2->l2;
         cp->script = STRDUP(cp2->script);
         cp->original = STRDUP(cp2->original);
-        cd->is_lua = cd2->is_lua;
-        cd->shared = cd2->shared;
-        cd->original = cd2->original;
         cd->programs = eina_list_append(cd->programs, cp);
         data_queue_copied_anonymous_lookup(pc, &(cp2->id), &(cp->id));
      }
@@ -4460,9 +4463,18 @@ ob_collections_group_script(void)
             cd->l2 = get_verbatim_line2();
             if (cd->shared)
               {
-                 ERR("parse error %s:%i. There is already an existing script section for the group",
-                     file_in, line - 1);
-                 exit(-1);
+                  if (script_override)
+                    {
+                       free(cd->shared);
+                       free(cd->original);
+                       script_override = EINA_FALSE;
+                    }
+                  else
+                    {
+                       ERR("parse error %s:%i. There is already an existing script section for the group",
+                           file_in, line - 1);
+                       exit(-1);
+                    }
               }
             cd->shared = s;
              cd->original = strdup(s);