Diff
Modified: trunk/Source/WebKit2/ChangeLog (132534 => 132535)
--- trunk/Source/WebKit2/ChangeLog 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/ChangeLog 2012-10-25 21:15:25 UTC (rev 132535)
@@ -1,3 +1,50 @@
+2012-10-25 Christophe Dumez <[email protected]>
+
+ [EFL][WK2] Add Ewk_Popup_Menu API
+ https://bugs.webkit.org/show_bug.cgi?id=100404
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add new Ewk_Popup_Menu API to complete the existing
+ Ewk_Popup_Menu_Item one. This way, we can move the
+ popup menu code out of Ewk_View.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/EWebKit2.h:
+ * UIProcess/API/efl/EwkViewImpl.cpp:
+ (EwkViewImpl::EwkViewImpl):
+ (EwkViewImpl::~EwkViewImpl):
+ (EwkViewImpl::requestPopupMenu):
+ (EwkViewImpl::closePopupMenu):
+ * UIProcess/API/efl/EwkViewImpl.h:
+ (EwkViewImpl):
+ * UIProcess/API/efl/ewk_popup_menu.cpp: Added.
+ (Ewk_Popup_Menu::Ewk_Popup_Menu):
+ (Ewk_Popup_Menu::~Ewk_Popup_Menu):
+ (Ewk_Popup_Menu::close):
+ (Ewk_Popup_Menu::items):
+ (Ewk_Popup_Menu::selectedIndex):
+ (Ewk_Popup_Menu::setSelectedIndex):
+ (ewk_popup_menu_close):
+ (ewk_popup_menu_selected_index_set):
+ (ewk_popup_menu_selected_index_get):
+ (ewk_popup_menu_items_get):
+ * UIProcess/API/efl/ewk_popup_menu.h: Added.
+ * UIProcess/API/efl/ewk_popup_menu_private.h: Copied from Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp.
+ (WebKit):
+ (Ewk_Popup_Menu):
+ (Ewk_Popup_Menu::create):
+ * UIProcess/API/efl/ewk_view.cpp:
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp: Added.
+ (checkBasicPopupMenuItem):
+ (selectItemAfterDelayed):
+ (showPopupMenu):
+ (TEST_F):
+ * UIProcess/API/efl/tests/test_ewk2_view.cpp:
+ * UIProcess/efl/WebPopupMenuProxyEfl.cpp:
+ (WebKit::WebPopupMenuProxyEfl::hidePopupMenu):
+
2012-10-25 Jocelyn Turcotte <[email protected]>
[Qt] Close the IconDatabase before the WebContext gets destroyed
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (132534 => 132535)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-10-25 21:15:25 UTC (rev 132535)
@@ -55,6 +55,7 @@
UIProcess/API/efl/ewk_main.cpp
UIProcess/API/efl/ewk_navigation_data.cpp
UIProcess/API/efl/ewk_navigation_policy_decision.cpp
+ UIProcess/API/efl/ewk_popup_menu.cpp
UIProcess/API/efl/ewk_popup_menu_item.cpp
UIProcess/API/efl/ewk_resource.cpp
UIProcess/API/efl/ewk_settings.cpp
@@ -250,6 +251,7 @@
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_main.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_data.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu_item.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_resource.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_settings.h"
@@ -346,6 +348,7 @@
test_ewk2_favicon_database
test_ewk2_refptr_evas_object
test_ewk2_intents
+ test_ewk2_popup_menu
test_ewk2_settings
test_ewk2_text_checker
test_ewk2_view
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-10-25 21:15:25 UTC (rev 132535)
@@ -41,6 +41,7 @@
#include "ewk_main.h"
#include "ewk_navigation_data.h"
#include "ewk_navigation_policy_decision.h"
+#include "ewk_popup_menu.h"
#include "ewk_popup_menu_item.h"
#include "ewk_resource.h"
#include "ewk_settings.h"
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp 2012-10-25 21:15:25 UTC (rev 132535)
@@ -39,6 +39,7 @@
#include "ewk_context_private.h"
#include "ewk_favicon_database_private.h"
#include "ewk_popup_menu_item_private.h"
+#include "ewk_popup_menu_private.h"
#include "ewk_private.h"
#include "ewk_settings_private.h"
#include "ewk_view.h"
@@ -130,14 +131,14 @@
}
EwkViewImpl::EwkViewImpl(Evas_Object* view)
- : popupMenuProxy(0)
- , popupMenuItems(0)
#if USE(ACCELERATED_COMPOSITING)
- , evasGl(0)
+ : evasGl(0)
, evasGlContext(0)
, evasGlSurface(0)
+ , m_view(view)
+#else
+ : m_view(view)
#endif
- , m_view(view)
, m_settings(Ewk_Settings::create(this))
, m_inputMethodContext(createIMFContext(smartData()))
, m_inputMethodContextFocused(false)
@@ -155,9 +156,6 @@
EwkViewImpl::~EwkViewImpl()
{
- void* item;
- EINA_LIST_FREE(popupMenuItems, item)
- delete static_cast<Ewk_Popup_Menu_Item*>(item);
}
Ewk_View_Smart_Data* EwkViewImpl::smartData()
@@ -874,29 +872,38 @@
COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL);
COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR);
-void EwkViewImpl::requestPopupMenu(WebPopupMenuProxyEfl* popupMenu, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex)
+void EwkViewImpl::requestPopupMenu(WebPopupMenuProxyEfl* popupMenuProxy, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex)
{
Ewk_View_Smart_Data* sd = smartData();
ASSERT(sd->api);
- ASSERT(popupMenu);
+ ASSERT(popupMenuProxy);
if (!sd->api->popup_menu_show)
return;
- if (popupMenuProxy)
- ewk_view_popup_menu_close(m_view);
- popupMenuProxy = popupMenu;
+ if (m_popupMenu)
+ closePopupMenu();
- Eina_List* popupItems = 0;
- const size_t size = items.size();
- for (size_t i = 0; i < size; ++i)
- popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
- popupMenuItems = popupItems;
+ m_popupMenu = Ewk_Popup_Menu::create(this, popupMenuProxy, items, selectedIndex);
- sd->api->popup_menu_show(sd, rect, static_cast<Ewk_Text_Direction>(textDirection), pageScaleFactor, popupItems, selectedIndex);
+ sd->api->popup_menu_show(sd, rect, static_cast<Ewk_Text_Direction>(textDirection), pageScaleFactor, m_popupMenu.get());
}
+void EwkViewImpl::closePopupMenu()
+{
+ if (!m_popupMenu)
+ return;
+
+ Ewk_View_Smart_Data* sd = smartData();
+ ASSERT(sd->api);
+
+ if (sd->api->popup_menu_hide)
+ sd->api->popup_menu_hide(sd);
+
+ m_popupMenu.clear();
+}
+
/**
* @internal
* Calls a smart member function for _javascript_ alert().
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h 2012-10-25 21:15:25 UTC (rev 132535)
@@ -91,6 +91,7 @@
class Ewk_Intent_Service;
class Ewk_Navigation_Policy_Decision;
class Ewk_Resource;
+class Ewk_Popup_Menu;
class Ewk_Settings;
class Ewk_Url_Request;
class Ewk_Url_Response;
@@ -163,6 +164,8 @@
void closePage();
void requestPopupMenu(WebKit::WebPopupMenuProxyEfl*, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex);
+ void closePopupMenu();
+
void updateTextInputState();
void requestJSAlertPopup(const WKEinaSharedString& message);
@@ -228,9 +231,6 @@
OwnPtr<Ewk_Back_Forward_List> backForwardList;
RefPtr<Ewk_Context> context;
- WebKit::WebPopupMenuProxyEfl* popupMenuProxy;
- Eina_List* popupMenuItems;
-
#if USE(ACCELERATED_COMPOSITING)
Evas_GL* evasGl;
Evas_GL_Context* evasGlContext;
@@ -273,6 +273,7 @@
WKRetainPtr<WKColorPickerResultListenerRef> m_colorPickerResultListener;
WebCore::Timer<EwkViewImpl> m_displayTimer;
WTF::Vector <WebCore::IntRect> m_dirtyRects;
+ OwnPtr<Ewk_Popup_Menu> m_popupMenu;
typedef HashMap<WKPageRef, const Evas_Object*> PageViewMap;
static PageViewMap pageViewMap;
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp (0 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp 2012-10-25 21:15:25 UTC (rev 132535)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ewk_popup_menu.h"
+
+#include "EwkViewImpl.h"
+#include "WebPopupMenuProxyEfl.h"
+#include "ewk_popup_menu_item_private.h"
+#include "ewk_popup_menu_private.h"
+
+using namespace WebKit;
+
+Ewk_Popup_Menu::Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex)
+ : m_viewImpl(viewImpl)
+ , m_popupMenuProxy(popupMenuProxy)
+ , m_popupMenuItems(0)
+ , m_selectedIndex(selectedIndex)
+{
+ const size_t size = items.size();
+ for (size_t i = 0; i < size; ++i)
+ m_popupMenuItems = eina_list_append(m_popupMenuItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
+}
+
+Ewk_Popup_Menu::~Ewk_Popup_Menu()
+{
+ void* item;
+ EINA_LIST_FREE(m_popupMenuItems, item)
+ delete static_cast<Ewk_Popup_Menu_Item*>(item);
+}
+
+void Ewk_Popup_Menu::close()
+{
+ m_viewImpl->closePopupMenu();
+}
+
+const Eina_List* Ewk_Popup_Menu::items() const
+{
+ return m_popupMenuItems;
+}
+
+unsigned Ewk_Popup_Menu::selectedIndex() const
+{
+ return m_selectedIndex;
+}
+
+bool Ewk_Popup_Menu::setSelectedIndex(unsigned selectedIndex)
+{
+ if (!m_popupMenuProxy)
+ return false;
+
+ if (selectedIndex >= eina_list_count(m_popupMenuItems))
+ return false;
+
+ if (m_selectedIndex == selectedIndex)
+ return true;
+
+ m_selectedIndex = selectedIndex;
+ m_popupMenuProxy->valueChanged(selectedIndex);
+
+ return true;
+}
+
+Eina_Bool ewk_popup_menu_close(Ewk_Popup_Menu* popupMenu)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, false);
+
+ popupMenu->close();
+
+ return true;
+}
+
+Eina_Bool ewk_popup_menu_selected_index_set(Ewk_Popup_Menu* popupMenu, unsigned selectedIndex)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, false);
+
+ return popupMenu->setSelectedIndex(selectedIndex);
+}
+
+unsigned ewk_popup_menu_selected_index_get(const Ewk_Popup_Menu* popupMenu)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, 0);
+
+ return popupMenu->selectedIndex();
+}
+
+const Eina_List* ewk_popup_menu_items_get(const Ewk_Popup_Menu* popupMenu)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(popupMenu, 0);
+
+ return popupMenu->items();
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h (0 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h 2012-10-25 21:15:25 UTC (rev 132535)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file ewk_popup_menu.h
+ * @brief Describes the Ewk Popup Menu API.
+ */
+
+#ifndef ewk_popup_menu_h
+#define ewk_popup_menu_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for Ewk_Popup_Menu */
+typedef struct Ewk_Popup_Menu Ewk_Popup_Menu;
+
+/**
+ * Selects index of current popup menu.
+ *
+ * @param popup_menu popup menu object
+ * @param index index of item to select
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (e.g. the index is out of range)
+ */
+EAPI Eina_Bool ewk_popup_menu_selected_index_set(Ewk_Popup_Menu *popup_menu, unsigned index);
+
+/**
+ * Returns the index of the currently selected item in the popup menu.
+ *
+ * @param popup_menu popup menu object
+ *
+ * @return index of the currently selected popup item on success, @c 0 otherwise
+ */
+EAPI unsigned ewk_popup_menu_selected_index_get(const Ewk_Popup_Menu *popup_menu);
+
+/**
+ * Closes current popup menu.
+ *
+ * The Ewk_Popup_Menu object becomes invalid after calling this function.
+ *
+ * @param popup_menu popup menu object
+ *
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_popup_menu_close(Ewk_Popup_Menu *popup_menu);
+
+/**
+ * Retrieve the popup menu items
+ *
+ * @param popup_menu popup menu object
+ *
+ * @return @c list of popup menu items on success, @c NULL otherwise
+ */
+EAPI const Eina_List *ewk_popup_menu_items_get(const Ewk_Popup_Menu *popup_menu);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_popup_menu_h */
Copied: trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h (from rev 132534, trunk/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp) (0 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h 2012-10-25 21:15:25 UTC (rev 132535)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_popup_menu_private_h
+#define ewk_popup_menu_private_h
+
+#include <Eina.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebPopupItem;
+class WebPopupMenuProxyEfl;
+}
+
+class EwkViewImpl;
+
+class Ewk_Popup_Menu {
+public:
+ static PassOwnPtr<Ewk_Popup_Menu> create(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex)
+ {
+ return adoptPtr(new Ewk_Popup_Menu(viewImpl, popupMenuProxy, items, selectedIndex));
+ }
+ ~Ewk_Popup_Menu();
+
+ void close();
+
+ const Eina_List* items() const;
+
+ bool setSelectedIndex(unsigned selectedIndex);
+ unsigned selectedIndex() const;
+
+private:
+ Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl*, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex);
+
+ EwkViewImpl* m_viewImpl;
+ WebKit::WebPopupMenuProxyEfl* m_popupMenuProxy;
+ Eina_List* m_popupMenuItems;
+ unsigned m_selectedIndex;
+};
+
+#endif // ewk_popup_menu_private_h
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-10-25 21:15:25 UTC (rev 132535)
@@ -39,15 +39,12 @@
#include "WKString.h"
#include "WebContext.h"
#include "WebPageGroup.h"
-#include "WebPopupItem.h"
-#include "WebPopupMenuProxyEfl.h"
#include "WebPreferences.h"
#include "ewk_back_forward_list_private.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
#include "ewk_favicon_database_private.h"
#include "ewk_intent_private.h"
-#include "ewk_popup_menu_item_private.h"
#include "ewk_private.h"
#include "ewk_settings_private.h"
#include "ewk_view_private.h"
@@ -974,41 +971,6 @@
return true;
}
-Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
-
- if (!impl->popupMenuProxy)
- return false;
-
- impl->popupMenuProxy = 0;
-
- if (smartData->api->popup_menu_hide)
- smartData->api->popup_menu_hide(smartData);
-
- void* item;
- EINA_LIST_FREE(impl->popupMenuItems, item)
- delete static_cast<Ewk_Popup_Menu_Item*>(item);
-
- return true;
-}
-
-Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
-{
- EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
- EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
-
- if (selectedIndex >= eina_list_count(impl->popupMenuItems))
- return false;
-
- impl->popupMenuProxy->valueChanged(selectedIndex);
-
- return true;
-}
-
Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-10-25 21:15:25 UTC (rev 132535)
@@ -79,6 +79,7 @@
#include "ewk_download_job.h"
#include "ewk_error.h"
#include "ewk_intent.h"
+#include "ewk_popup_menu.h"
#include "ewk_resource.h"
#include "ewk_settings.h"
#include "ewk_touch.h"
@@ -104,7 +105,7 @@
Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
unsigned long version;
- Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List *items, int selected_index);
+ Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Ewk_Popup_Menu *menu);
Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd);
// event handling:
@@ -689,27 +690,6 @@
EAPI Eina_Bool ewk_view_text_matches_count(Evas_Object *o, const char *text, Ewk_Find_Options options, unsigned max_match_count);
/**
- * Selects index of current popup menu.
- *
- * @param o view object contains popup menu.
- * @param index index of item to select
- *
- * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
- * popup menu is not selected or index is out of range)
- */
-EAPI Eina_Bool ewk_view_popup_menu_select(Evas_Object *o, unsigned int index);
-
-/**
- * Closes current popup menu.
- *
- * @param o view object contains popup menu.
- *
- * @return @c EINA_TRUE on success, @c EINA_FALSE on failure (probably
- * popup menu is not selected)
- */
-EAPI Eina_Bool ewk_view_popup_menu_close(Evas_Object *o);
-
-/**
* Sets whether the ewk_view supports the mouse events or not.
*
* The ewk_view will support the mouse events if EINA_TRUE or not support the
Added: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp (0 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp 2012-10-25 21:15:25 UTC (rev 132535)
@@ -0,0 +1,105 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+ Copyright (C) 2012 Intel Corporation. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static Ewk_Popup_Menu* s_popupMenu = 0;
+
+static inline void checkBasicPopupMenuItem(Ewk_Popup_Menu_Item* item, const char* title, bool enabled)
+{
+ EXPECT_EQ(EWK_POPUP_MENU_ITEM, ewk_popup_menu_item_type_get(item));
+ EXPECT_STREQ(title, ewk_popup_menu_item_text_get(item));
+ EXPECT_EQ(enabled, ewk_popup_menu_item_enabled_get(item));
+}
+
+static Eina_Bool selectItemAfterDelayed(void* data)
+{
+ EXPECT_TRUE(ewk_popup_menu_selected_index_set(static_cast<Ewk_Popup_Menu*>(data), 0));
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool showPopupMenu(Ewk_View_Smart_Data* smartData, Eina_Rectangle, Ewk_Text_Direction, double, Ewk_Popup_Menu* popupMenu)
+{
+ s_popupMenu = popupMenu;
+
+ EXPECT_EQ(2, ewk_popup_menu_selected_index_get(popupMenu));
+
+ const Eina_List* list = ewk_popup_menu_items_get(popupMenu);
+
+ Ewk_Popup_Menu_Item* item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 0));
+ checkBasicPopupMenuItem(item, "first", true);
+ EXPECT_EQ(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, ewk_popup_menu_item_text_direction_get(item));
+ EXPECT_STREQ("", ewk_popup_menu_item_tooltip_get(item));
+ EXPECT_STREQ("", ewk_popup_menu_item_accessibility_text_get(item));
+ EXPECT_FALSE(ewk_popup_menu_item_is_label_get(item));
+ EXPECT_FALSE(ewk_popup_menu_item_selected_get(item));
+
+ item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 1));
+ checkBasicPopupMenuItem(item, "second", false);
+ EXPECT_FALSE(ewk_popup_menu_item_enabled_get(item));
+
+ item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 2));
+ checkBasicPopupMenuItem(item, "third", true);
+ EXPECT_EQ(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, ewk_popup_menu_item_text_direction_get(item));
+ EXPECT_STREQ("tooltip", ewk_popup_menu_item_tooltip_get(item));
+ EXPECT_STREQ("aria", ewk_popup_menu_item_accessibility_text_get(item));
+ EXPECT_TRUE(ewk_popup_menu_item_selected_get(item));
+
+ item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 3));
+ checkBasicPopupMenuItem(item, "label", false);
+ EXPECT_TRUE(ewk_popup_menu_item_is_label_get(item));
+
+ item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 4));
+ checkBasicPopupMenuItem(item, " forth", true);
+
+ item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 5));
+ EXPECT_EQ(EWK_POPUP_MENU_UNKNOWN, ewk_popup_menu_item_type_get(item));
+ EXPECT_STREQ(0, ewk_popup_menu_item_text_get(item));
+
+ ecore_timer_add(0, selectItemAfterDelayed, popupMenu);
+ return true;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_popup_menu_select_item)
+{
+ const char* selectHTML =
+ "<!doctype html><body><select _onchange_=\"document.title=this.value;\">"
+ "<option>first</option><option disabled>second</option><option selected dir=\"rtl\" title=\"tooltip\" aria-label=\"aria\">third</option>"
+ "<optgroup label=\"label\"><option>forth</option></optgroup>"
+ "</select></body>";
+
+ ewkViewClass()->popup_menu_show = showPopupMenu;
+
+ ewk_view_html_string_load(webView(), selectHTML, "file:///", 0);
+ ASSERT_TRUE(waitUntilLoadFinished());
+ mouseClick(30, 20);
+ ASSERT_TRUE(waitUntilTitleChangedTo("first"));
+
+ ASSERT_TRUE(s_popupMenu);
+ EXPECT_TRUE(ewk_popup_menu_close(s_popupMenu));
+}
Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp 2012-10-25 21:15:25 UTC (rev 132535)
@@ -201,76 +201,6 @@
evas_object_smart_callback_del(webView(), "form,submission,request", onFormAboutToBeSubmitted);
}
-static inline void checkBasicPopupMenuItem(Ewk_Popup_Menu_Item* item, const char* title, bool enabled)
-{
- EXPECT_EQ(EWK_POPUP_MENU_ITEM, ewk_popup_menu_item_type_get(item));
- EXPECT_STREQ(title, ewk_popup_menu_item_text_get(item));
- EXPECT_EQ(enabled, ewk_popup_menu_item_enabled_get(item));
-}
-
-static Eina_Bool selectItemAfterDelayed(void* data)
-{
- EXPECT_TRUE(ewk_view_popup_menu_select(static_cast<Evas_Object*>(data), 0));
- return ECORE_CALLBACK_CANCEL;
-}
-
-static Eina_Bool showPopupMenu(Ewk_View_Smart_Data* smartData, Eina_Rectangle, Ewk_Text_Direction, double, Eina_List* list, int selectedIndex)
-{
- EXPECT_EQ(2, selectedIndex);
-
- Ewk_Popup_Menu_Item* item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 0));
- checkBasicPopupMenuItem(item, "first", true);
- EXPECT_EQ(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, ewk_popup_menu_item_text_direction_get(item));
- EXPECT_STREQ("", ewk_popup_menu_item_tooltip_get(item));
- EXPECT_STREQ("", ewk_popup_menu_item_accessibility_text_get(item));
- EXPECT_FALSE(ewk_popup_menu_item_is_label_get(item));
- EXPECT_FALSE(ewk_popup_menu_item_selected_get(item));
-
- item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 1));
- checkBasicPopupMenuItem(item, "second", false);
- EXPECT_FALSE(ewk_popup_menu_item_enabled_get(item));
-
- item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 2));
- checkBasicPopupMenuItem(item, "third", true);
- EXPECT_EQ(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, ewk_popup_menu_item_text_direction_get(item));
- EXPECT_STREQ("tooltip", ewk_popup_menu_item_tooltip_get(item));
- EXPECT_STREQ("aria", ewk_popup_menu_item_accessibility_text_get(item));
- EXPECT_TRUE(ewk_popup_menu_item_selected_get(item));
-
- item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 3));
- checkBasicPopupMenuItem(item, "label", false);
- EXPECT_TRUE(ewk_popup_menu_item_is_label_get(item));
-
- item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 4));
- checkBasicPopupMenuItem(item, " forth", true);
-
- item = static_cast<Ewk_Popup_Menu_Item*>(eina_list_nth(list, 5));
- EXPECT_EQ(EWK_POPUP_MENU_UNKNOWN, ewk_popup_menu_item_type_get(item));
- EXPECT_STREQ(0, ewk_popup_menu_item_text_get(item));
-
- ecore_timer_add(0, selectItemAfterDelayed, smartData->self);
- return true;
-}
-
-TEST_F(EWK2UnitTestBase, ewk_view_popup_menu_select)
-{
- const char* selectHTML =
- "<!doctype html><body><select _onchange_=\"document.title=this.value;\">"
- "<option>first</option><option disabled>second</option><option selected dir=\"rtl\" title=\"tooltip\" aria-label=\"aria\">third</option>"
- "<optgroup label=\"label\"><option>forth</option></optgroup>"
- "</select></body>";
-
- ewkViewClass()->popup_menu_show = showPopupMenu;
-
- ewk_view_html_string_load(webView(), selectHTML, "file:///", 0);
- ASSERT_TRUE(waitUntilLoadFinished());
- mouseClick(30, 20);
- ASSERT_TRUE(waitUntilTitleChangedTo("first"));
-
- EXPECT_TRUE(ewk_view_popup_menu_close(webView()));
- EXPECT_FALSE(ewk_view_popup_menu_select(webView(), 0));
-}
-
TEST_F(EWK2UnitTestBase, ewk_view_settings_get)
{
Ewk_Settings* settings = ewk_view_settings_get(webView());
Modified: trunk/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp (132534 => 132535)
--- trunk/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp 2012-10-25 21:08:53 UTC (rev 132534)
+++ trunk/Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp 2012-10-25 21:15:25 UTC (rev 132535)
@@ -49,7 +49,7 @@
void WebPopupMenuProxyEfl::hidePopupMenu()
{
- ewk_view_popup_menu_close(m_viewImpl->view());
+ m_viewImpl->closePopupMenu();
}
void WebPopupMenuProxyEfl::valueChanged(int newSelectedIndex)