From b3e241fc29dd061cd897101b9a1767d9ff346a77 Mon Sep 17 00:00:00 2001 From: Hyerim Bae Date: Wed, 22 Aug 2012 18:49:55 +0900 Subject: [PATCH] [Title] Modify to use elm genlist instead of elm list. [Issue#] WEB-1017 [Problem] The performance is too slow if the item count is over 3000. [Cause] elm list has such a problem originally. [Solution] Use elm genlist. [Team] Browser UI [Developer] Hyerim Bae (hyerim.bae) [Request] N/A Change-Id: Iba5caf31e4e23aeb77cd31981d79a01cbd6672fb --- .../UIProcess/API/efl/tizen/ewk_popup_picker.cpp | 34 +++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/ewk_popup_picker.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/ewk_popup_picker.cpp index 0bff41e..06910f5 100644 --- a/Source/WebKit2/UIProcess/API/efl/tizen/ewk_popup_picker.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/ewk_popup_picker.cpp @@ -31,21 +31,19 @@ void menuItemActivated(void* data, Evas_Object* obj, void* event_info) { Ewk_Popup_Picker* picker = static_cast(data); - Elm_Object_Item* selected = elm_list_selected_item_get(obj); + Elm_Object_Item* selected = elm_genlist_selected_item_get(obj); void* it; - const Eina_List* l; - const Eina_List* items; Elm_Object_Item* currentItem = picker->firstItem; int i = 0; - items = elm_list_items_get(obj); - EINA_LIST_FOREACH(items, l, it) { + + while (currentItem) { if(currentItem == selected) break; - - currentItem = elm_list_item_next(currentItem); + currentItem = elm_genlist_item_next_get(currentItem); i++; } + picker->selectedIndex = i; ewk_view_popup_menu_select(picker->parent, i); } @@ -58,6 +56,14 @@ void listClosed(void *data, Evas_Object *obj, const char *emission, const char * ewk_view_popup_menu_close(picker->parent); } +static char* _listLabelGet(void* data, Evas_Object* obj, const char* part) +{ + Ewk_Popup_Menu_Item* menuItem = static_cast(data); + + if (!strncmp(part, "elm.text", strlen("elm.text"))) + return strdup(ewk_popup_menu_item_text_get(menuItem)); +} + Ewk_Popup_Picker* ewk_popup_picker_new(Evas_Object* parent, Eina_List* items, int selectedIndex) { Ewk_Popup_Picker* picker = new Ewk_Popup_Picker; @@ -74,10 +80,18 @@ Ewk_Popup_Picker* ewk_popup_picker_new(Evas_Object* parent, Eina_List* items, in "mouse,clicked,1", "dimm", listClosed, picker); } - picker->popupList = elm_list_add(parent); + picker->popupList = elm_genlist_add(parent); evas_object_size_hint_weight_set(picker->popupList, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(picker->popupList, EVAS_HINT_FILL, EVAS_HINT_FILL); + static Elm_Genlist_Item_Class itemClass; + + itemClass.item_style = "1text"; + itemClass.func.text_get = _listLabelGet; + itemClass.func.content_get = 0; + itemClass.func.state_get = 0; + itemClass.func.del = 0; + void* itemv; const Eina_List* l; @@ -86,11 +100,11 @@ Ewk_Popup_Picker* ewk_popup_picker_new(Evas_Object* parent, Eina_List* items, in EINA_LIST_FOREACH(items, l, itemv) { Ewk_Popup_Menu_Item* menuItem = static_cast(itemv); - Elm_Object_Item* itemObject = elm_list_item_append(picker->popupList, menuItem->text, 0, 0, 0, 0); + Elm_Object_Item* itemObject = elm_genlist_item_append(picker->popupList, &itemClass, menuItem, 0, ELM_GENLIST_ITEM_NONE, 0, 0); if (!index) picker->firstItem = itemObject; if (selectedIndex == index) - elm_list_item_selected_set(itemObject, true); + elm_genlist_item_selected_set(itemObject, true); index++; } -- 2.7.4