summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-10 14:24:48 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-07-10 14:40:42 -0400
commitaa921c553baaa2265c1a5b42e8bf89c9f343b30e (patch)
treeca3a58eed0f0699047ae71d425254c9690b77442
parent662572ecfea46adc77bca43d26362ecbaddf0690 (diff)
edje: change 'user_defined' member of Edje struct to be a hash
Summary: this is where all user-added data (e.g., swallowed objects, table/box packs, text strings) are stored. with this patch, it is now a hash by part name, storing a list of user-defined data for that part this simplifies a bit of code by deconstructing some list walks, and should end up being slightly faster for large edje objects with lots of user-defined data ideally no functional changes Depends on D9206 Reviewers: cedric Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9208
-rw-r--r--src/lib/edje/edje_load.c348
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/edje/edje_util.c247
3 files changed, 311 insertions, 286 deletions
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index fa2f4f7d58..786dae00d9 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -153,7 +153,7 @@ static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Ha
153static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it); 153static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it);
154static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source); 154static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source);
155 155
156static Eina_List *_edje_object_collect(Edje *ed); 156static Eina_Hash *_edje_object_collect(Edje *ed);
157 157
158static int _sort_defined_boxes(const void *a, const void *b); 158static int _sort_defined_boxes(const void *a, const void *b);
159 159
@@ -773,7 +773,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
773 Eina_List *textblocks = NULL; 773 Eina_List *textblocks = NULL;
774 Eina_List *sources = NULL; 774 Eina_List *sources = NULL;
775 Eina_List *externals = NULL; 775 Eina_List *externals = NULL;
776 Eina_List *collect = NULL; 776 Eina_Hash *collect = NULL;
777 unsigned int n; 777 unsigned int n;
778 Eina_Array parts; 778 Eina_Array parts;
779 int group_path_started = 0; 779 int group_path_started = 0;
@@ -1592,132 +1592,138 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1592 { 1592 {
1593 Edje_User_Defined *eud; 1593 Edje_User_Defined *eud;
1594 Eina_List *boxes = NULL; 1594 Eina_List *boxes = NULL;
1595 Eina_Iterator *it;
1596 Eina_List *l, *ll;
1595 1597
1596 EINA_LIST_FREE(collect, eud) 1598 it = eina_hash_iterator_data_new(collect);
1599 /* the eud structs get manually freed below */
1600 eina_hash_free_cb_set(collect, (void*)eina_list_free);
1601 EINA_ITERATOR_FOREACH(it, l)
1597 { 1602 {
1598 Evas_Object *child = NULL; 1603 EINA_LIST_FOREACH(l, ll, eud)
1599
1600 if (!eina_hash_find(part_match, eud->part))
1601 { 1604 {
1602 /* part no longer exists */ 1605 Evas_Object *child = NULL;
1603 switch (eud->type) 1606
1604 { 1607 if (!eina_hash_find(part_match, eud->part))
1605 case EDJE_USER_SWALLOW:
1606 child = eud->u.swallow.child;
1607 break;
1608 case EDJE_USER_BOX_PACK:
1609 child = eud->u.box.child;
1610 break;
1611 case EDJE_USER_TABLE_PACK:
1612 child = eud->u.table.child;
1613 break;
1614 case EDJE_USER_STRING:
1615 case EDJE_USER_DRAG_STEP:
1616 case EDJE_USER_DRAG_PAGE:
1617 case EDJE_USER_DRAG_VALUE:
1618 case EDJE_USER_DRAG_SIZE:
1619 case EDJE_USER_TEXT_STYLE:
1620 case EDJE_USER_TEXT_EXPAND:
1621 default:
1622 break;
1623 }
1624 if (child)
1625 { 1608 {
1626 WRN("Container part '%s' no longer exists, hiding previously-contained child object", eud->part); 1609 /* part no longer exists */
1627 evas_object_hide(child); 1610 switch (eud->type)
1611 {
1612 case EDJE_USER_SWALLOW:
1613 child = eud->u.swallow.child;
1614 break;
1615 case EDJE_USER_BOX_PACK:
1616 child = eud->u.box.child;
1617 break;
1618 case EDJE_USER_TABLE_PACK:
1619 child = eud->u.table.child;
1620 break;
1621 case EDJE_USER_STRING:
1622 case EDJE_USER_DRAG_STEP:
1623 case EDJE_USER_DRAG_PAGE:
1624 case EDJE_USER_DRAG_VALUE:
1625 case EDJE_USER_DRAG_SIZE:
1626 case EDJE_USER_TEXT_STYLE:
1627 case EDJE_USER_TEXT_EXPAND:
1628 default:
1629 break;
1630 }
1631 if (child)
1632 {
1633 WRN("Container part '%s' no longer exists, hiding previously-contained child object", eud->part);
1634 evas_object_hide(child);
1635 }
1628 } 1636 }
1629 } 1637 else
1630 else
1631 {
1632 switch (eud->type)
1633 { 1638 {
1634 case EDJE_USER_SWALLOW: 1639 switch (eud->type)
1635 edje_object_part_swallow(obj, eud->part, eud->u.swallow.child);
1636 child = eud->u.swallow.child;
1637 break;
1638
1639 case EDJE_USER_BOX_PACK:
1640 boxes = eina_list_append(boxes, eud);
1641 eud = NULL;
1642 break;
1643
1644 case EDJE_USER_TABLE_PACK:
1645 edje_object_part_table_pack(obj, eud->part, eud->u.table.child,
1646 eud->u.table.col, eud->u.table.row,
1647 eud->u.table.colspan, eud->u.table.rowspan);
1648 child = eud->u.table.child;
1649 break;
1650
1651 case EDJE_USER_DRAG_STEP:
1652 edje_object_part_drag_step_set(obj, eud->part,
1653 eud->u.drag_position.x,
1654 eud->u.drag_position.y);
1655 break;
1656
1657 case EDJE_USER_DRAG_PAGE:
1658 edje_object_part_drag_page_set(obj, eud->part,
1659 eud->u.drag_position.x,
1660 eud->u.drag_position.y);
1661 break;
1662
1663 case EDJE_USER_DRAG_VALUE:
1664 edje_object_part_drag_value_set(obj, eud->part,
1665 eud->u.drag_position.x,
1666 eud->u.drag_position.y);
1667 break;
1668
1669 case EDJE_USER_DRAG_SIZE:
1670 edje_object_part_drag_size_set(obj, eud->part,
1671 eud->u.drag_size.w,
1672 eud->u.drag_size.h);
1673 break;
1674
1675 case EDJE_USER_STRING:
1676 switch (eud->u.string.type)
1677 { 1640 {
1678 case EDJE_TEXT_TYPE_NORMAL: 1641 case EDJE_USER_SWALLOW:
1679 edje_object_part_text_set(obj, eud->part, eud->u.string.text); 1642 edje_object_part_swallow(obj, eud->part, eud->u.swallow.child);
1643 child = eud->u.swallow.child;
1680 break; 1644 break;
1681 case EDJE_TEXT_TYPE_ESCAPED: 1645
1682 edje_object_part_text_escaped_set(obj, eud->part, eud->u.string.text); 1646 case EDJE_USER_BOX_PACK:
1647 boxes = eina_list_append(boxes, eud);
1648 eud = NULL;
1683 break; 1649 break;
1684 case EDJE_TEXT_TYPE_UNESCAPED: 1650
1685 edje_object_part_text_unescaped_set(obj, eud->part, eud->u.string.text); 1651 case EDJE_USER_TABLE_PACK:
1652 edje_object_part_table_pack(obj, eud->part, eud->u.table.child,
1653 eud->u.table.col, eud->u.table.row,
1654 eud->u.table.colspan, eud->u.table.rowspan);
1655 child = eud->u.table.child;
1686 break; 1656 break;
1687 }
1688 eina_stringshare_del(eud->u.string.text);
1689 break;
1690 1657
1691 case EDJE_USER_TEXT_STYLE: 1658 case EDJE_USER_DRAG_STEP:
1692 { 1659 edje_object_part_drag_step_set(obj, eud->part,
1693 Edje_Part_Text_Prop *prop; 1660 eud->u.drag_position.x,
1694 EINA_LIST_FREE(eud->u.text_style.props, prop) 1661 eud->u.drag_position.y);
1662 break;
1663
1664 case EDJE_USER_DRAG_PAGE:
1665 edje_object_part_drag_page_set(obj, eud->part,
1666 eud->u.drag_position.x,
1667 eud->u.drag_position.y);
1668 break;
1669
1670 case EDJE_USER_DRAG_VALUE:
1671 edje_object_part_drag_value_set(obj, eud->part,
1672 eud->u.drag_position.x,
1673 eud->u.drag_position.y);
1674 break;
1675
1676 case EDJE_USER_DRAG_SIZE:
1677 edje_object_part_drag_size_set(obj, eud->part,
1678 eud->u.drag_size.w,
1679 eud->u.drag_size.h);
1680 break;
1681
1682 case EDJE_USER_STRING:
1683 switch (eud->u.string.type)
1695 { 1684 {
1696 _canvas_layout_user_text_apply(eud, obj, 1685 case EDJE_TEXT_TYPE_NORMAL:
1697 prop); 1686 edje_object_part_text_set(obj, eud->part, eud->u.string.text);
1698 free(prop); 1687 break;
1688 case EDJE_TEXT_TYPE_ESCAPED:
1689 edje_object_part_text_escaped_set(obj, eud->part, eud->u.string.text);
1690 break;
1691 case EDJE_TEXT_TYPE_UNESCAPED:
1692 edje_object_part_text_unescaped_set(obj, eud->part, eud->u.string.text);
1693 break;
1699 } 1694 }
1695 eina_stringshare_del(eud->u.string.text);
1696 break;
1697
1698 case EDJE_USER_TEXT_STYLE:
1699 {
1700 Edje_Part_Text_Prop *prop;
1701 EINA_LIST_FREE(eud->u.text_style.props, prop)
1702 {
1703 _canvas_layout_user_text_apply(eud, obj,
1704 prop);
1705 free(prop);
1706 }
1707 }
1708 break;
1709 case EDJE_USER_TEXT_EXPAND:
1710 {
1711 efl_canvas_layout_part_text_expand_set(
1712 efl_part(obj, eud->part),
1713 eud->u.text_expand.expand);
1714 }
1715 break;
1700 } 1716 }
1701 break;
1702 case EDJE_USER_TEXT_EXPAND:
1703 {
1704 efl_canvas_layout_part_text_expand_set(
1705 efl_part(obj, eud->part),
1706 eud->u.text_expand.expand);
1707 }
1708 break;
1709 } 1717 }
1710 } 1718 }
1711 if (eud) _edje_user_definition_remove(eud, child);
1712 } 1719 }
1720 eina_iterator_free(it);
1713 1721
1714 boxes = eina_list_sort(boxes, -1, _sort_defined_boxes); 1722 boxes = eina_list_sort(boxes, -1, _sort_defined_boxes);
1715 EINA_LIST_FREE(boxes, eud) 1723 EINA_LIST_FREE(boxes, eud)
1716 { 1724 edje_object_part_box_append(obj, eud->part, eud->u.box.child);
1717 edje_object_part_box_append(obj, eud->part, eud->u.box.child);
1718 _edje_user_definition_remove(eud, eud->u.box.child);
1719 }
1720 eina_hash_free(part_match); 1725 eina_hash_free(part_match);
1726 eina_hash_free(collect);
1721 } 1727 }
1722 if (_edje_language) 1728 if (_edje_language)
1723 snprintf(lang, sizeof(lang), "edje,language,%s", _edje_language); 1729 snprintf(lang, sizeof(lang), "edje,language,%s", _edje_language);
@@ -1833,88 +1839,94 @@ _sort_defined_boxes(const void *a, const void *b)
1833 return euda->u.box.index - eudb->u.box.index; 1839 return euda->u.box.index - eudb->u.box.index;
1834} 1840}
1835 1841
1836static Eina_List * 1842static Eina_Hash *
1837_edje_object_collect(Edje *ed) 1843_edje_object_collect(Edje *ed)
1838{ 1844{
1839 Edje_User_Defined *eud; 1845 Edje_User_Defined *eud;
1840 Eina_List *collect; 1846 Eina_Hash *collect;
1841 Eina_List *l; 1847 Eina_List *l, *ll;
1848 Eina_Iterator *it;
1842 1849
1843 collect = ed->user_defined; 1850 collect = ed->user_defined;
1844 ed->user_defined = NULL; 1851 ed->user_defined = NULL;
1845 1852
1846 EINA_LIST_FOREACH(collect, l, eud) 1853 it = eina_hash_iterator_data_new(collect);
1854 EINA_ITERATOR_FOREACH(it, l)
1847 { 1855 {
1848 switch (eud->type) 1856 EINA_LIST_FOREACH(l, ll, eud)
1849 { 1857 {
1850 case EDJE_USER_STRING: 1858 switch (eud->type)
1851 eud->u.string.text = eina_stringshare_ref(eud->u.string.text);
1852 break;
1853
1854 case EDJE_USER_BOX_PACK:
1855 if (eud->u.box.index == -1)
1856 { 1859 {
1857 Edje_User_Defined *search; 1860 case EDJE_USER_STRING:
1858 Edje_Real_Part *rp; 1861 eud->u.string.text = eina_stringshare_ref(eud->u.string.text);
1859 Eina_List *children; 1862 break;
1860 Eina_List *ls; 1863
1861 Evas_Object *child; 1864 case EDJE_USER_BOX_PACK:
1862 int idx = 0; 1865 if (eud->u.box.index == -1)
1863
1864 rp = _edje_real_part_recursive_get(&ed, eud->part);
1865 if (rp)
1866 { 1866 {
1867 if (rp->part->type != EDJE_PART_TYPE_BOX) continue; 1867 Edje_User_Defined *search;
1868 Edje_Real_Part *rp;
1869 Eina_List *children;
1870 Eina_List *ls;
1871 Evas_Object *child;
1872 int idx = 0;
1873
1874 rp = _edje_real_part_recursive_get(&ed, eud->part);
1875 if (rp)
1876 {
1877 if (rp->part->type != EDJE_PART_TYPE_BOX) continue;
1868 1878
1869 children = evas_object_box_children_get(rp->object); 1879 children = evas_object_box_children_get(rp->object);
1870 EINA_LIST_FREE(children, child) 1880 EINA_LIST_FREE(children, child)
1871 if (!evas_object_data_get(child, "\377 edje.box_item")) 1881 if (!evas_object_data_get(child, "\377 edje.box_item"))
1872 {
1873 EINA_LIST_FOREACH(l, ls, search)
1874 { 1882 {
1875 if (search->type == EDJE_USER_BOX_PACK && 1883 EINA_LIST_FOREACH(l, ls, search)
1876 search->u.box.child == child &&
1877 search->part == eud->part /* beauty of stringshare ! */)
1878 { 1884 {
1879 search->u.box.index = idx++; 1885 if (search->type == EDJE_USER_BOX_PACK &&
1880 break; 1886 search->u.box.child == child &&
1887 search->part == eud->part /* beauty of stringshare ! */)
1888 {
1889 search->u.box.index = idx++;
1890 break;
1891 }
1881 } 1892 }
1893 _edje_real_part_box_remove(eud->ed, rp, child);
1882 } 1894 }
1883 _edje_real_part_box_remove(eud->ed, rp, child); 1895 }
1884 }
1885 } 1896 }
1886 } 1897 break;
1887 break;
1888
1889 case EDJE_USER_TABLE_PACK:
1890 {
1891 Edje_Real_Part *rp;
1892 1898
1893 rp = _edje_real_part_recursive_get(&ed, eud->part); 1899 case EDJE_USER_TABLE_PACK:
1894 if (rp)
1895 { 1900 {
1896 if (rp->part->type != EDJE_PART_TYPE_TABLE) continue; 1901 Edje_Real_Part *rp;
1897 _edje_real_part_table_unpack(eud->ed, rp, eud->u.table.child); 1902
1903 rp = _edje_real_part_recursive_get(&ed, eud->part);
1904 if (rp)
1905 {
1906 if (rp->part->type != EDJE_PART_TYPE_TABLE) continue;
1907 _edje_real_part_table_unpack(eud->ed, rp, eud->u.table.child);
1908 }
1909 break;
1898 } 1910 }
1899 break;
1900 }
1901 1911
1902 case EDJE_USER_SWALLOW: 1912 case EDJE_USER_SWALLOW:
1903 edje_object_part_unswallow(NULL, eud->u.swallow.child); 1913 edje_object_part_unswallow(NULL, eud->u.swallow.child);
1904 break; 1914 break;
1905 1915
1906 case EDJE_USER_TEXT_STYLE: 1916 case EDJE_USER_TEXT_STYLE:
1907 _canvas_layout_user_text_collect(ed, eud); 1917 _canvas_layout_user_text_collect(ed, eud);
1908 break; 1918 break;
1909 1919
1910 case EDJE_USER_DRAG_STEP: 1920 case EDJE_USER_DRAG_STEP:
1911 case EDJE_USER_DRAG_PAGE: 1921 case EDJE_USER_DRAG_PAGE:
1912 case EDJE_USER_DRAG_VALUE: 1922 case EDJE_USER_DRAG_VALUE:
1913 case EDJE_USER_DRAG_SIZE: 1923 case EDJE_USER_DRAG_SIZE:
1914 case EDJE_USER_TEXT_EXPAND: 1924 case EDJE_USER_TEXT_EXPAND:
1915 break; 1925 break;
1926 }
1916 } 1927 }
1917 } 1928 }
1929 eina_iterator_free(it);
1918 1930
1919 return collect; 1931 return collect;
1920} 1932}
@@ -1938,7 +1950,6 @@ _edje_file_callbacks_del(Edje *ed, Evas *e)
1938void 1950void
1939_edje_file_del(Edje *ed) 1951_edje_file_del(Edje *ed)
1940{ 1952{
1941 Edje_User_Defined *eud;
1942 Evas *tev = NULL; 1953 Evas *tev = NULL;
1943 1954
1944 if (ed->obj && (!efl_invalidated_get(ed->obj))) 1955 if (ed->obj && (!efl_invalidated_get(ed->obj)))
@@ -1972,11 +1983,8 @@ _edje_file_del(Edje *ed)
1972 return; 1983 return;
1973 } 1984 }
1974 1985
1975 while (ed->user_defined) 1986 eina_hash_free(ed->user_defined);
1976 { 1987 ed->user_defined = NULL;
1977 eud = eina_list_data_get(ed->user_defined);
1978 _edje_user_definition_free(eud);
1979 }
1980 1988
1981 if (ed->table_parts) 1989 if (ed->table_parts)
1982 { 1990 {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 874a99f622..cedc4d6fa6 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1738,7 +1738,7 @@ struct _Edje
1738#endif 1738#endif
1739 double duration_scale; 1739 double duration_scale;
1740 double paused_at; 1740 double paused_at;
1741 Eina_List *user_defined; 1741 Eina_Hash *user_defined;
1742 lua_State *L; 1742 lua_State *L;
1743 Eina_Inlist *lua_objs; 1743 Eina_Inlist *lua_objs;
1744 1744
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 6dcf287d3b..e73da61d54 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -61,44 +61,67 @@ static void _edje_child_remove(Edje *ed, Edje_Real_Part *rp, Evas_Object *c
61 61
62Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje **ed, char **path); 62Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje **ed, char **path);
63 63
64static void
65_edje_user_definition_free_internal(Edje_User_Defined *eud)
66{
67 Evas_Object *child = NULL;
68 switch (eud->type)
69 {
70 case EDJE_USER_SWALLOW:
71 child = eud->u.swallow.child;
72 break;
73
74 case EDJE_USER_BOX_PACK:
75 child = eud->u.box.child;
76 break;
77
78 case EDJE_USER_TABLE_PACK:
79 child = eud->u.table.child;
80 break;
81
82 default: break;
83 }
84 if (child) evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, _edje_user_def_del_cb, eud);
85 eina_stringshare_del(eud->part);
86 free(eud);
87}
88
89static void
90_edje_user_definition_list_free_internal(Eina_List *l)
91{
92 Edje_User_Defined *eud;
93 EINA_LIST_FREE(l, eud)
94 _edje_user_definition_free_internal(eud);
95}
96
64static Edje_User_Defined * 97static Edje_User_Defined *
65_edje_user_definition_new(Edje_User_Defined_Type type, const char *part, Edje *ed) 98_edje_user_definition_new(Edje_User_Defined_Type type, const char *part, Edje *ed)
66{ 99{
67 Edje_User_Defined *eud; 100 Edje_User_Defined *eud;
68 101
102 if (!ed->user_defined)
103 ed->user_defined = eina_hash_string_superfast_new((Eina_Free_Cb)_edje_user_definition_list_free_internal);
104 EINA_SAFETY_ON_NULL_RETURN_VAL(ed->user_defined, NULL);
105
69 eud = malloc(sizeof (Edje_User_Defined)); 106 eud = malloc(sizeof (Edje_User_Defined));
70 if (!eud) return NULL; 107 if (!eud) return NULL;
71 108
72 eud->type = type; 109 eud->type = type;
73 eud->part = eina_stringshare_add(part); 110 eud->part = eina_stringshare_add(part);
74 eud->ed = ed; 111 eud->ed = ed;
75 ed->user_defined = eina_list_append(ed->user_defined, eud); 112 eina_hash_list_direct_append(ed->user_defined, eud->part, eud);
76 113
77 return eud; 114 return eud;
78} 115}
79 116
80void 117void
81_edje_user_definition_remove(Edje_User_Defined *eud, Evas_Object *child)
82{
83 eud->ed->user_defined = eina_list_remove(eud->ed->user_defined, eud);
84
85 if (child) evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, _edje_user_def_del_cb, eud);
86 eina_stringshare_del(eud->part);
87 free(eud);
88}
89
90void
91_edje_user_definition_free(Edje_User_Defined *eud) 118_edje_user_definition_free(Edje_User_Defined *eud)
92{ 119{
93 Evas_Object *child = NULL;
94 Edje_Real_Part *rp; 120 Edje_Real_Part *rp;
95 121
96 eud->ed->user_defined = eina_list_remove(eud->ed->user_defined, eud);
97
98 switch (eud->type) 122 switch (eud->type)
99 { 123 {
100 case EDJE_USER_SWALLOW: 124 case EDJE_USER_SWALLOW:
101 child = eud->u.swallow.child;
102 rp = _edje_real_part_recursive_get(&eud->ed, eud->part); 125 rp = _edje_real_part_recursive_get(&eud->ed, eud->part);
103 if (rp) 126 if (rp)
104 { 127 {
@@ -125,15 +148,13 @@ _edje_user_definition_free(Edje_User_Defined *eud)
125 break; 148 break;
126 149
127 case EDJE_USER_BOX_PACK: 150 case EDJE_USER_BOX_PACK:
128 child = eud->u.box.child;
129 rp = _edje_real_part_recursive_get(&eud->ed, eud->part); 151 rp = _edje_real_part_recursive_get(&eud->ed, eud->part);
130 if (rp) _edje_child_remove(eud->ed, rp, child); 152 if (rp) _edje_child_remove(eud->ed, rp, eud->u.box.child);
131 break; 153 break;
132 154
133 case EDJE_USER_TABLE_PACK: 155 case EDJE_USER_TABLE_PACK:
134 child = eud->u.table.child;
135 rp = _edje_real_part_recursive_get(&eud->ed, eud->part); 156 rp = _edje_real_part_recursive_get(&eud->ed, eud->part);
136 if (rp) _edje_child_remove(eud->ed, rp, child); 157 if (rp) _edje_child_remove(eud->ed, rp, eud->u.table.child);
137 break; 158 break;
138 159
139 case EDJE_USER_TEXT_STYLE: 160 case EDJE_USER_TEXT_STYLE:
@@ -155,7 +176,8 @@ _edje_user_definition_free(Edje_User_Defined *eud)
155 break; 176 break;
156 } 177 }
157 178
158 _edje_user_definition_remove(eud, child); 179 eina_hash_list_remove(eud->ed->user_defined, eud->part, eud);
180 _edje_user_definition_free_internal(eud);
159} 181}
160 182
161static void 183static void
@@ -2007,15 +2029,11 @@ Edje_User_Defined *
2007_edje_user_text_style_definition_fetch(Edje *ed, const char *part) 2029_edje_user_text_style_definition_fetch(Edje *ed, const char *part)
2008{ 2030{
2009 Edje_User_Defined *eud; 2031 Edje_User_Defined *eud;
2010 Eina_List *l; 2032 Eina_List *l, *ll;
2011 2033
2012 EINA_LIST_FOREACH(ed->user_defined, l, eud) 2034 l = eina_hash_find(ed->user_defined, part);
2013 { 2035 EINA_LIST_FOREACH(l, ll, eud)
2014 if (eud->type == EDJE_USER_TEXT_STYLE && !strcmp(eud->part, part)) 2036 if (eud->type == EDJE_USER_TEXT_STYLE) break;
2015 {
2016 break;
2017 }
2018 }
2019 2037
2020 if (!eud) 2038 if (!eud)
2021 { 2039 {
@@ -2032,15 +2050,11 @@ Edje_User_Defined *
2032_edje_user_text_expand_definition_fetch(Edje *ed, const char *part) 2050_edje_user_text_expand_definition_fetch(Edje *ed, const char *part)
2033{ 2051{
2034 Edje_User_Defined *eud; 2052 Edje_User_Defined *eud;
2035 Eina_List *l; 2053 Eina_List *l, *ll;
2036 2054
2037 EINA_LIST_FOREACH(ed->user_defined, l, eud) 2055 l = eina_hash_find(ed->user_defined, part);
2038 { 2056 EINA_LIST_FOREACH(l, ll, eud)
2039 if (eud->type == EDJE_USER_TEXT_EXPAND && !strcmp(eud->part, part)) 2057 if (eud->type == EDJE_USER_TEXT_EXPAND) break;
2040 {
2041 break;
2042 }
2043 }
2044 2058
2045 if (!eud) 2059 if (!eud)
2046 { 2060 {
@@ -2059,10 +2073,11 @@ _edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_
2059 rp. So on edje_object_file_set, we should first ref it, before destroying the old 2073 rp. So on edje_object_file_set, we should first ref it, before destroying the old
2060 layout. */ 2074 layout. */
2061 Edje_User_Defined *eud; 2075 Edje_User_Defined *eud;
2062 Eina_List *l; 2076 Eina_List *l, *ll;
2063 2077
2064 EINA_LIST_FOREACH(ed->user_defined, l, eud) 2078 l = eina_hash_find(ed->user_defined, part);
2065 if (eud->type == EDJE_USER_STRING && !strcmp(eud->part, part)) 2079 EINA_LIST_FOREACH(l, ll, eud)
2080 if (eud->type == EDJE_USER_STRING)
2066 { 2081 {
2067 if (!raw_text) 2082 if (!raw_text)
2068 { 2083 {
@@ -3349,18 +3364,24 @@ _efl_canvas_layout_content_remove(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *ob
3349{ 3364{
3350 Edje_Real_Part *rp; 3365 Edje_Real_Part *rp;
3351 Edje_User_Defined *eud; 3366 Edje_User_Defined *eud;
3352 Eina_List *l; 3367 Eina_Iterator *it;
3368 Eina_List *l, *ll;
3353 3369
3354 rp = _swallow_real_part_get(obj_swallow); 3370 rp = _swallow_real_part_get(obj_swallow);
3355 if (!rp) return EINA_FALSE; 3371 if (!rp) return EINA_FALSE;
3356 3372
3357 EINA_LIST_FOREACH(ed->user_defined, l, eud) 3373 it = eina_hash_iterator_data_new(ed->user_defined);
3358 if ((eud->type == EDJE_USER_SWALLOW) && (eud->u.swallow.child == obj_swallow)) 3374 EINA_ITERATOR_FOREACH(it, l)
3359 { 3375 {
3360 _edje_user_definition_free(eud); 3376 EINA_LIST_FOREACH(l, ll, eud)
3361 return EINA_TRUE; 3377 if ((eud->type == EDJE_USER_SWALLOW) && (eud->u.swallow.child == obj_swallow))
3362 } 3378 {
3363 3379 _edje_user_definition_free(eud);
3380 eina_iterator_free(it);
3381 return EINA_TRUE;
3382 }
3383 }
3384 eina_iterator_free(it);
3364 _edje_real_part_swallow_clear(ed, rp); 3385 _edje_real_part_swallow_clear(ed, rp);
3365 rp->typedata.swallow->swallowed_object = NULL; 3386 rp->typedata.swallow->swallowed_object = NULL;
3366 rp->typedata.swallow->swallow_params.min.w = 0; 3387 rp->typedata.swallow->swallow_params.min.w = 0;
@@ -3899,15 +3920,16 @@ _edje_object_part_drag_value_set(Edje *ed, const char *part, double dx, double d
3899{ 3920{
3900 Edje_Real_Part *rp; 3921 Edje_Real_Part *rp;
3901 Edje_User_Defined *eud; 3922 Edje_User_Defined *eud;
3902 Eina_List *l; 3923 Eina_List *l, *ll;
3903 3924
3904 if ((!ed) || (!part)) return EINA_FALSE; 3925 if ((!ed) || (!part)) return EINA_FALSE;
3905 rp = _edje_real_part_recursive_get(&ed, part); 3926 rp = _edje_real_part_recursive_get(&ed, part);
3906 if (!rp) return EINA_FALSE; 3927 if (!rp) return EINA_FALSE;
3907 if (!rp->drag) return EINA_FALSE; 3928 if (!rp->drag) return EINA_FALSE;
3908 3929
3909 EINA_LIST_FOREACH(ed->user_defined, l, eud) 3930 l = eina_hash_find(ed->user_defined, part);
3910 if (eud->type == EDJE_USER_DRAG_VALUE && !strcmp(part, eud->part)) 3931 EINA_LIST_FOREACH(l, ll, eud)
3932 if (eud->type == EDJE_USER_DRAG_VALUE)
3911 { 3933 {
3912 eud->u.drag_position.x = dx; 3934 eud->u.drag_position.x = dx;
3913 eud->u.drag_position.y = dy; 3935 eud->u.drag_position.y = dy;
@@ -3984,15 +4006,16 @@ _edje_object_part_drag_size_set(Edje *ed, const char *part, double dw, double dh
3984{ 4006{
3985 Edje_Real_Part *rp; 4007 Edje_Real_Part *rp;
3986 Edje_User_Defined *eud; 4008 Edje_User_Defined *eud;
3987 Eina_List *l; 4009 Eina_List *l, *ll;
3988 4010
3989 if ((!ed) || (!part)) return EINA_FALSE; 4011 if ((!ed) || (!part)) return EINA_FALSE;
3990 rp = _edje_real_part_recursive_get(&ed, part); 4012 rp = _edje_real_part_recursive_get(&ed, part);
3991 if (!rp) return EINA_FALSE; 4013 if (!rp) return EINA_FALSE;
3992 if (!rp->drag) return EINA_FALSE; 4014 if (!rp->drag) return EINA_FALSE;
3993 4015
3994 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4016 l = eina_hash_find(ed->user_defined, part);
3995 if (eud->type == EDJE_USER_DRAG_SIZE && !strcmp(part, eud->part)) 4017 EINA_LIST_FOREACH(l, ll, eud)
4018 if (eud->type == EDJE_USER_DRAG_SIZE)
3996 { 4019 {
3997 eud->u.drag_size.w = dw; 4020 eud->u.drag_size.w = dw;
3998 eud->u.drag_size.h = dh; 4021 eud->u.drag_size.h = dh;
@@ -4063,15 +4086,16 @@ _edje_object_part_drag_step_set(Edje *ed, const char *part, double dx, double dy
4063{ 4086{
4064 Edje_Real_Part *rp; 4087 Edje_Real_Part *rp;
4065 Edje_User_Defined *eud; 4088 Edje_User_Defined *eud;
4066 Eina_List *l; 4089 Eina_List *l, *ll;
4067 4090
4068 if ((!ed) || (!part)) return EINA_FALSE; 4091 if ((!ed) || (!part)) return EINA_FALSE;
4069 rp = _edje_real_part_recursive_get(&ed, part); 4092 rp = _edje_real_part_recursive_get(&ed, part);
4070 if (!rp) return EINA_FALSE; 4093 if (!rp) return EINA_FALSE;
4071 if (!rp->drag) return EINA_FALSE; 4094 if (!rp->drag) return EINA_FALSE;
4072 4095
4073 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4096 l = eina_hash_find(ed->user_defined, part);
4074 if (eud->type == EDJE_USER_DRAG_STEP && !strcmp(part, eud->part)) 4097 EINA_LIST_FOREACH(l, ll, eud)
4098 if (eud->type == EDJE_USER_DRAG_STEP)
4075 { 4099 {
4076 eud->u.drag_position.x = dx; 4100 eud->u.drag_position.x = dx;
4077 eud->u.drag_position.y = dy; 4101 eud->u.drag_position.y = dy;
@@ -4135,15 +4159,16 @@ _edje_object_part_drag_page_set(Edje *ed, const char *part, double dx, double dy
4135{ 4159{
4136 Edje_Real_Part *rp; 4160 Edje_Real_Part *rp;
4137 Edje_User_Defined *eud; 4161 Edje_User_Defined *eud;
4138 Eina_List *l; 4162 Eina_List *l, *ll;
4139 4163
4140 if ((!ed) || (!part)) return EINA_FALSE; 4164 if ((!ed) || (!part)) return EINA_FALSE;
4141 rp = _edje_real_part_recursive_get(&ed, part); 4165 rp = _edje_real_part_recursive_get(&ed, part);
4142 if (!rp) return EINA_FALSE; 4166 if (!rp) return EINA_FALSE;
4143 if (!rp->drag) return EINA_FALSE; 4167 if (!rp->drag) return EINA_FALSE;
4144 4168
4145 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4169 l = eina_hash_find(ed->user_defined, part);
4146 if (eud->type == EDJE_USER_DRAG_PAGE && !strcmp(part, eud->part)) 4170 EINA_LIST_FOREACH(l, ll, eud)
4171 if (eud->type == EDJE_USER_DRAG_PAGE)
4147 { 4172 {
4148 eud->u.drag_position.x = dx; 4173 eud->u.drag_position.x = dx;
4149 eud->u.drag_position.y = dy; 4174 eud->u.drag_position.y = dy;
@@ -4208,15 +4233,16 @@ _edje_object_part_drag_step(Edje *ed, const char *part, double dx, double dy)
4208 Edje_Real_Part *rp; 4233 Edje_Real_Part *rp;
4209 FLOAT_T px, py; 4234 FLOAT_T px, py;
4210 Edje_User_Defined *eud; 4235 Edje_User_Defined *eud;
4211 Eina_List *l; 4236 Eina_List *l, *ll;
4212 4237
4213 if ((!ed) || (!part)) return EINA_FALSE; 4238 if ((!ed) || (!part)) return EINA_FALSE;
4214 rp = _edje_real_part_recursive_get(&ed, part); 4239 rp = _edje_real_part_recursive_get(&ed, part);
4215 if (!rp) return EINA_FALSE; 4240 if (!rp) return EINA_FALSE;
4216 if (!rp->drag) return EINA_FALSE; 4241 if (!rp->drag) return EINA_FALSE;
4217 4242
4218 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4243 l = eina_hash_find(ed->user_defined, part);
4219 if (eud->type == EDJE_USER_DRAG_STEP && !strcmp(part, eud->part)) 4244 EINA_LIST_FOREACH(l, ll, eud)
4245 if (eud->type == EDJE_USER_DRAG_STEP)
4220 { 4246 {
4221 eud->u.drag_position.x = dx; 4247 eud->u.drag_position.x = dx;
4222 eud->u.drag_position.y = dy; 4248 eud->u.drag_position.y = dy;
@@ -4259,15 +4285,16 @@ _edje_object_part_drag_page(Edje *ed, const char *part, double dx, double dy)
4259 Edje_Real_Part *rp; 4285 Edje_Real_Part *rp;
4260 FLOAT_T px, py; 4286 FLOAT_T px, py;
4261 Edje_User_Defined *eud; 4287 Edje_User_Defined *eud;
4262 Eina_List *l; 4288 Eina_List *l, *ll;
4263 4289
4264 if ((!ed) || (!part)) return EINA_FALSE; 4290 if ((!ed) || (!part)) return EINA_FALSE;
4265 rp = _edje_real_part_recursive_get(&ed, part); 4291 rp = _edje_real_part_recursive_get(&ed, part);
4266 if (!rp) return EINA_FALSE; 4292 if (!rp) return EINA_FALSE;
4267 if (!rp->drag) return EINA_FALSE; 4293 if (!rp->drag) return EINA_FALSE;
4268 4294
4269 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4295 l = eina_hash_find(ed->user_defined, part);
4270 if (eud->type == EDJE_USER_DRAG_PAGE && !strcmp(part, eud->part)) 4296 EINA_LIST_FOREACH(l, ll, eud)
4297 if (eud->type == EDJE_USER_DRAG_PAGE)
4271 { 4298 {
4272 eud->u.drag_position.x = dx; 4299 eud->u.drag_position.x = dx;
4273 eud->u.drag_position.y = dy; 4300 eud->u.drag_position.y = dy;
@@ -4459,6 +4486,21 @@ _edje_part_box_insert_at(Edje *ed, const char *part, Evas_Object *child, unsigne
4459 return ret; 4486 return ret;
4460} 4487}
4461 4488
4489static void
4490_edje_part_box_remove_user_definition(Edje *ed, Eina_Stringshare *part, Evas_Object *child)
4491{
4492 Edje_User_Defined *eud;
4493 Eina_List *l, *ll;
4494
4495 l = eina_hash_find(ed->user_defined, part);
4496 EINA_LIST_FOREACH(l, ll, eud)
4497 if (eud->type == EDJE_USER_BOX_PACK && eud->u.box.child == child)
4498 {
4499 _edje_user_definition_free(eud);
4500 return;
4501 }
4502}
4503
4462Evas_Object * 4504Evas_Object *
4463_edje_part_box_remove(Edje *ed, const char *part, Evas_Object *child) 4505_edje_part_box_remove(Edje *ed, const char *part, Evas_Object *child)
4464{ 4506{
@@ -4473,18 +4515,7 @@ _edje_part_box_remove(Edje *ed, const char *part, Evas_Object *child)
4473 4515
4474 r = _edje_real_part_box_remove(ed, rp, child); 4516 r = _edje_real_part_box_remove(ed, rp, child);
4475 4517
4476 if (r) 4518 if (r) _edje_part_box_remove_user_definition(ed, part, r);
4477 {
4478 Edje_User_Defined *eud;
4479 Eina_List *l;
4480
4481 EINA_LIST_FOREACH(ed->user_defined, l, eud)
4482 if (eud->type == EDJE_USER_BOX_PACK && eud->u.box.child == child && !strcmp(eud->part, part))
4483 {
4484 _edje_user_definition_free(eud);
4485 return r;
4486 }
4487 }
4488 return r; 4519 return r;
4489} 4520}
4490 4521
@@ -4502,18 +4533,7 @@ _edje_part_box_remove_at(Edje *ed, const char *part, unsigned int pos)
4502 4533
4503 r = _edje_real_part_box_remove_at(ed, rp, pos); 4534 r = _edje_real_part_box_remove_at(ed, rp, pos);
4504 4535
4505 if (r) 4536 if (r) _edje_part_box_remove_user_definition(ed, part, r);
4506 {
4507 Edje_User_Defined *eud;
4508 Eina_List *l;
4509
4510 EINA_LIST_FOREACH(ed->user_defined, l, eud)
4511 if (eud->type == EDJE_USER_BOX_PACK && eud->u.box.child == r && !strcmp(eud->part, part))
4512 {
4513 _edje_user_definition_free(eud);
4514 return r;
4515 }
4516 }
4517 return r; 4537 return r;
4518} 4538}
4519 4539
@@ -4549,15 +4569,7 @@ _edje_part_box_remove_all(Edje *ed, const char *part, Eina_Bool clear)
4549 if (_edje_real_part_box_remove_all(ed, rp, clear)) 4569 if (_edje_real_part_box_remove_all(ed, rp, clear))
4550 { 4570 {
4551 ret = EINA_TRUE; 4571 ret = EINA_TRUE;
4552 Edje_User_Defined *eud; 4572 eina_hash_del_by_key(ed->user_defined, part);
4553 Eina_List *ll, *l;
4554
4555 EINA_LIST_FOREACH_SAFE(ed->user_defined, l, ll, eud)
4556 if (eud->type == EDJE_USER_BOX_PACK && !strcmp(eud->part, part))
4557 {
4558 _edje_user_definition_free(eud);
4559 return ret;
4560 }
4561 } 4573 }
4562 4574
4563 return ret; 4575 return ret;
@@ -4642,16 +4654,16 @@ _edje_child_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *child, void *ei
4642{ 4654{
4643 Edje_Real_Part *rp = data; 4655 Edje_Real_Part *rp = data;
4644 Edje_User_Defined *eud; 4656 Edje_User_Defined *eud;
4645 Eina_List *l; 4657 Eina_List *l, *ll;
4646 Edje *ed = evas_object_data_get(child, ".edje"); 4658 Edje *ed = evas_object_data_get(child, ".edje");
4647 4659
4648 if (!ed) return; 4660 if (!ed) return;
4649 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4661 l = eina_hash_find(ed->user_defined, rp->part->name);
4662 EINA_LIST_FOREACH(l, ll, eud)
4650 if (rp->part->type == EDJE_PART_TYPE_BOX) 4663 if (rp->part->type == EDJE_PART_TYPE_BOX)
4651 { 4664 {
4652 if (eud->type == EDJE_USER_BOX_PACK && 4665 if (eud->type == EDJE_USER_BOX_PACK &&
4653 eud->u.box.child == child && 4666 eud->u.box.child == child)
4654 !strcmp(rp->part->name, eud->part))
4655 { 4667 {
4656 _edje_user_definition_free(eud); 4668 _edje_user_definition_free(eud);
4657 break; 4669 break;
@@ -4660,8 +4672,7 @@ _edje_child_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *child, void *ei
4660 else if (rp->part->type == EDJE_PART_TYPE_TABLE) 4672 else if (rp->part->type == EDJE_PART_TYPE_TABLE)
4661 { 4673 {
4662 if (eud->type == EDJE_USER_TABLE_PACK && 4674 if (eud->type == EDJE_USER_TABLE_PACK &&
4663 eud->u.table.child == child && 4675 eud->u.table.child == child)
4664 !strcmp(rp->part->name, eud->part))
4665 { 4676 {
4666 _edje_user_definition_free(eud); 4677 _edje_user_definition_free(eud);
4667 break; 4678 break;
@@ -4952,12 +4963,12 @@ _edje_part_table_unpack(Edje *ed, const char *part, Evas_Object *child_obj)
4952 { 4963 {
4953 ret = EINA_TRUE; 4964 ret = EINA_TRUE;
4954 Edje_User_Defined *eud; 4965 Edje_User_Defined *eud;
4955 Eina_List *l; 4966 Eina_List *l, *ll;
4956 4967
4957 EINA_LIST_FOREACH(ed->user_defined, l, eud) 4968 l = eina_hash_find(ed->user_defined, part);
4969 EINA_LIST_FOREACH(l, ll, eud)
4958 if (eud->type == EDJE_USER_TABLE_PACK && 4970 if (eud->type == EDJE_USER_TABLE_PACK &&
4959 eud->u.table.child == child_obj && 4971 eud->u.table.child == child_obj)
4960 !strcmp(part, eud->part))
4961 { 4972 {
4962 _edje_user_definition_free(eud); 4973 _edje_user_definition_free(eud);
4963 break; 4974 break;
@@ -5881,18 +5892,24 @@ void
5881_edje_object_part_swallow_free_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 5892_edje_object_part_swallow_free_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
5882{ 5893{
5883 Edje_User_Defined *eud; 5894 Edje_User_Defined *eud;
5884 Eina_List *l; 5895 Eina_List *l, *ll;
5896 Eina_Iterator *it;
5885 Edje *ed; 5897 Edje *ed;
5886 Edje_Real_Part *rp; 5898 Edje_Real_Part *rp;
5887 5899
5888 ed = evas_object_data_get(obj, ".edje"); 5900 ed = evas_object_data_get(obj, ".edje");
5889 if (!ed) return; 5901 if (!ed) return;
5890 EINA_LIST_FOREACH(ed->user_defined, l, eud) 5902 it = eina_hash_iterator_data_new(ed->user_defined);
5891 if (eud->type == EDJE_USER_SWALLOW && eud->u.swallow.child == obj) 5903 EINA_ITERATOR_FOREACH(it, l)
5892 { 5904 {
5893 _edje_user_definition_free(eud); 5905 EINA_LIST_FOREACH(l, ll, eud)
5894 break; 5906 if (eud->type == EDJE_USER_SWALLOW && eud->u.swallow.child == obj)
5895 } 5907 {
5908 _edje_user_definition_free(eud);
5909 goto out;
5910 }
5911 }
5912out:
5896 rp = evas_object_data_get(obj, "\377 edje.swallowing_part"); 5913 rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
5897 if (rp && (rp->part->type == EDJE_PART_TYPE_SWALLOW)) 5914 if (rp && (rp->part->type == EDJE_PART_TYPE_SWALLOW))
5898 edje_object_part_unswallow(ed->obj, obj); 5915 edje_object_part_unswallow(ed->obj, obj);