This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit cd35844386df24333d4c127d9e826e9bafdd2226
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Oct 31 11:14:58 2026 -0600

    edje: a part reached through an alias keeps its content on file change
    
    When an object's file or group changes, edje restores what the user
    put in its parts (swallows, box and table children, text) only for the
    parts the new group still has, and it looked them up among the group's
    real parts alone. A part that is a real part in the old group and only
    an alias in the new one was taken as gone: its content was hidden with
    a "Container part no longer exists" warning.
    
    Elementary hits this whenever a style is set on a widget that already
    has content and the new style reaches the content part through an
    alias, as efl/frame's pad_small, pad_*, outdent_* and outline do with
    efl.content. Content given to a widget while it is constructed makes
    that the common order. The restore calls already resolve aliases, so
    the aliases only need to count as parts that are still there.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/edje/edje_load.c              | 15 +++++++++++++++
 src/tests/edje/data/test_swallows.edc | 30 ++++++++++++++++++++++++++++++
 src/tests/edje/edje_test_swallow.c    | 28 ++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)

diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 24d1550faa..4b10f8f826 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1526,6 +1526,21 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
                   Eina_Iterator *it;
                   Eina_List *l, *ll;
 
+                  /* A part given by one of its aliases is still there: the
+                   * calls below resolve the alias. */
+                  if (part_match && ed->collection && ed->collection->alias)
+                    {
+                       Eina_Iterator *alias_it;
+                       const char *alias_name;
+
+                       alias_it = eina_hash_iterator_key_new(ed->collection->alias);
+                       EINA_ITERATOR_FOREACH(alias_it, alias_name)
+                         {
+                            eina_hash_add(part_match, alias_name, (void*)1);
+                         }
+                       eina_iterator_free(alias_it);
+                    }
+
                   it = eina_hash_iterator_data_new(collect);
                   EINA_ITERATOR_FOREACH(it, l)
                     {
diff --git a/src/tests/edje/data/test_swallows.edc b/src/tests/edje/data/test_swallows.edc
index b1b9e91e42..c192b67f44 100644
--- a/src/tests/edje/data/test_swallows.edc
+++ b/src/tests/edje/data/test_swallows.edc
@@ -20,4 +20,34 @@ collections {
          }
       }
    }
+
+   group {
+      name: "test_alias_group";
+      parts {
+         part {
+            name: "aliased";
+            type: SWALLOW;
+
+            description {
+               state: "default" 0.0;
+            }
+         }
+      }
+   }
+
+   group {
+      name: "test_alias_group_again";
+      parts {
+         alias: "aliased" "real";
+
+         part {
+            name: "real";
+            type: SWALLOW;
+
+            description {
+               state: "default" 0.0;
+            }
+         }
+      }
+   }
 }
diff --git a/src/tests/edje/edje_test_swallow.c b/src/tests/edje/edje_test_swallow.c
index a0e5b4eb96..e20943d69e 100644
--- a/src/tests/edje/edje_test_swallow.c
+++ b/src/tests/edje/edje_test_swallow.c
@@ -43,6 +43,33 @@ EFL_START_TEST(edje_test_swallows)
 }
 EFL_END_TEST
 
+/* A swallow given by a part alias survives the file being set again. */
+EFL_START_TEST(edje_test_swallows_alias_survives_file_reload)
+{
+   Evas *evas = _setup_evas();
+   Evas_Object *ly, *child;
+   Eina_Rect g;
+
+   ly = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas);
+   fail_unless(edje_object_file_set(ly, test_layout_get("test_swallows.edj"),
+                                     "test_alias_group"));
+   efl_gfx_entity_geometry_set(ly, EINA_RECT(10, 20, 100, 80));
+   child = efl_add(EFL_CANVAS_LAYOUT_CLASS, ly);
+   fail_if(!edje_object_part_swallow(ly, "aliased", child));
+
+   fail_unless(edje_object_file_set(ly, test_layout_get("test_swallows.edj"),
+                                     "test_alias_group_again"));
+   evas_smart_objects_calculate(evas);
+
+   ck_assert_ptr_eq(edje_object_part_swallow_get(ly, "real"), child);
+   ck_assert_ptr_eq(edje_object_part_swallow_get(ly, "aliased"), child);
+   fail_unless(evas_object_visible_get(child));
+   g = efl_gfx_entity_geometry_get(child);
+   ck_assert_int_eq(g.w, 100);
+   ck_assert_int_eq(g.h, 80);
+}
+EFL_END_TEST
+
 EFL_START_TEST(edje_test_swallows_lifetime)
 {
    Evas *evas = _setup_evas();
@@ -155,6 +182,7 @@ EFL_END_TEST
 void edje_test_swallow(TCase *tc)
 {
    tcase_add_test(tc, edje_test_swallows);
+   tcase_add_test(tc, edje_test_swallows_alias_survives_file_reload);
    tcase_add_test(tc, edje_test_swallows_lifetime);
    tcase_add_test(tc, edje_test_swallows_invalidate);
    tcase_add_test(tc, edje_test_swallows_eoapi);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to