[EFL][WK2] Use C API in ewk_context_menu
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2013 13:43:27 +0000 (13:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2013 13:43:27 +0000 (13:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109698

Patch by Michał Pakuła vel Rutka <m.pakula@samsung.com> on 2013-04-15
Reviewed by Andreas Kling.

EFL port unlike others does not handle context menus inside WebKit but exposes an API:
ewk_context_menu and ewk_context_menu_item, and leaves context menu to application.
Currently EFL port's context menu API uses internal C++ classes, while it should use WK2 C API,
to avoid violating layering.
This patch changes EFL context menu API to use only WK2 C API.

* UIProcess/API/efl/EwkView.cpp:
(EwkView::showContextMenu):
* UIProcess/API/efl/EwkView.h:
(WebKit):
(EwkView):
* UIProcess/API/efl/ewk_context_menu.cpp:
(EwkContextMenu::EwkContextMenu):
(EwkContextMenu::contextMenuItemSelected):
(ewk_context_menu_item_select):
(getWKTagFromEwkAction):
* UIProcess/API/efl/ewk_context_menu_item.cpp:
(EwkContextMenuItem::EwkContextMenuItem):
(getEwkActionFromWKTag):
* UIProcess/API/efl/ewk_context_menu_item.h:
* UIProcess/API/efl/ewk_context_menu_item_private.h:
(EwkContextMenuItem::create):
(EwkContextMenuItem):
* UIProcess/API/efl/ewk_context_menu_private.h:
(EwkContextMenu::create):
(EwkContextMenu):
* UIProcess/efl/ContextMenuClientEfl.cpp:
(showContextMenu):
(hideContextMenu):
(ContextMenuClientEfl::ContextMenuClientEfl):
* UIProcess/efl/ContextMenuClientEfl.h:
(WebKit::ContextMenuClientEfl::view):
* UIProcess/efl/WebContextMenuProxyEfl.cpp:
(WebKit::WebContextMenuProxyEfl::showContextMenu):
(WebKit::WebContextMenuProxyEfl::hideContextMenu):
* UIProcess/efl/WebContextMenuProxyEfl.h:
(WebContextMenuProxyEfl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/efl/EwkView.cpp
Source/WebKit2/UIProcess/API/efl/EwkView.h
Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h
Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.cpp
Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.h
Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.cpp
Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.h

index 96cab53..aa77d61 100644 (file)
@@ -1,3 +1,48 @@
+2013-04-15  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
+
+        [EFL][WK2] Use C API in ewk_context_menu
+        https://bugs.webkit.org/show_bug.cgi?id=109698
+
+        Reviewed by Andreas Kling.
+
+        EFL port unlike others does not handle context menus inside WebKit but exposes an API:
+        ewk_context_menu and ewk_context_menu_item, and leaves context menu to application.
+        Currently EFL port's context menu API uses internal C++ classes, while it should use WK2 C API,
+        to avoid violating layering.
+        This patch changes EFL context menu API to use only WK2 C API.
+
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkView::showContextMenu):
+        * UIProcess/API/efl/EwkView.h:
+        (WebKit):
+        (EwkView):
+        * UIProcess/API/efl/ewk_context_menu.cpp:
+        (EwkContextMenu::EwkContextMenu):
+        (EwkContextMenu::contextMenuItemSelected):
+        (ewk_context_menu_item_select):
+        (getWKTagFromEwkAction):
+        * UIProcess/API/efl/ewk_context_menu_item.cpp:
+        (EwkContextMenuItem::EwkContextMenuItem):
+        (getEwkActionFromWKTag):
+        * UIProcess/API/efl/ewk_context_menu_item.h:
+        * UIProcess/API/efl/ewk_context_menu_item_private.h:
+        (EwkContextMenuItem::create):
+        (EwkContextMenuItem):
+        * UIProcess/API/efl/ewk_context_menu_private.h:
+        (EwkContextMenu::create):
+        (EwkContextMenu):
+        * UIProcess/efl/ContextMenuClientEfl.cpp:
+        (showContextMenu):
+        (hideContextMenu):
+        (ContextMenuClientEfl::ContextMenuClientEfl):
+        * UIProcess/efl/ContextMenuClientEfl.h:
+        (WebKit::ContextMenuClientEfl::view):
+        * UIProcess/efl/WebContextMenuProxyEfl.cpp:
+        (WebKit::WebContextMenuProxyEfl::showContextMenu):
+        (WebKit::WebContextMenuProxyEfl::hideContextMenu):
+        * UIProcess/efl/WebContextMenuProxyEfl.h:
+        (WebContextMenuProxyEfl):
+
 2013-04-15  Balazs Kelemen  <kbalazs@webkit.org>
 
         [CoordGfx] Background color should not be part of GraphicsLayerState
index 33167d9..315b2b9 100644 (file)
@@ -804,7 +804,7 @@ void EwkView::dismissColorPicker()
 COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR);
 
-void EwkView::showContextMenu(WebContextMenuProxyEfl* contextMenuProxy, const WebCore::IntPoint& position, const Vector<WebContextMenuItemData>& items)
+void EwkView::showContextMenu(WKPoint position, WKArrayRef items)
 {
     Ewk_View_Smart_Data* sd = smartData();
     ASSERT(sd->api);
@@ -817,9 +817,9 @@ void EwkView::showContextMenu(WebContextMenuProxyEfl* contextMenuProxy, const We
     if (m_contextMenu)
         hideContextMenu();
 
-    m_contextMenu = Ewk_Context_Menu::create(this, contextMenuProxy, items);
+    m_contextMenu = Ewk_Context_Menu::create(this, items);
 
-    sd->api->context_menu_show(sd, position.x(), position.y(), m_contextMenu.get());
+    sd->api->context_menu_show(sd, position.x, position.y, m_contextMenu.get());
 }
 
 void EwkView::hideContextMenu()
index a58b6dc..fbc834c 100644 (file)
@@ -66,8 +66,6 @@ class ViewClientEfl;
 class PageViewportController;
 class PageViewportControllerClientEfl;
 #endif
-class WebContextMenuItemData;
-class WebContextMenuProxyEfl;
 class WebPageGroup;
 class WebPageProxy;
 
@@ -176,7 +174,7 @@ public:
     void requestPopupMenu(WKPopupMenuListenerRef, const WKRect&, WKPopupItemTextDirection, double pageScaleFactor, WKArrayRef items, int32_t selectedIndex);
     void closePopupMenu();
 
-    void showContextMenu(WebKit::WebContextMenuProxyEfl*, const WebCore::IntPoint& position, const Vector<WebKit::WebContextMenuItemData>& items);
+    void showContextMenu(WKPoint position, WKArrayRef items);
     void hideContextMenu();
 
     void updateTextInputState();
index 98a431a..a54cbba 100644 (file)
 
 #include "APIObject.h"
 #include "EwkView.h"
-#include "WebContextMenuItemData.h"
-#include "WebContextMenuProxyEfl.h"
+#include "WKArray.h"
+#include "WKContextMenuItem.h"
+#include "WKString.h"
 #include "ewk_context_menu_item.h"
 #include "ewk_context_menu_item_private.h"
 #include "ewk_context_menu_private.h"
 
 using namespace WebKit;
 
-EwkContextMenu::EwkContextMenu(EwkView* view, WebContextMenuProxyEfl* contextMenuProxy, const Vector<WebKit::WebContextMenuItemData>& items)
+static WKContextMenuItemTag getWKTagFromEwkAction(Ewk_Context_Menu_Item_Action action);
+
+EwkContextMenu::EwkContextMenu(EwkView* view, WKArrayRef items)
     : m_viewImpl(view)
-    , m_contextMenuProxy(contextMenuProxy)
     , m_contextMenuItems(0)
 {
-    const size_t size = items.size();
+    size_t size = WKArrayGetSize(items);
     for (size_t i = 0; i < size; ++i)
-        m_contextMenuItems = eina_list_append(m_contextMenuItems, Ewk_Context_Menu_Item::create(items[i]).leakPtr());
+        m_contextMenuItems = eina_list_append(m_contextMenuItems, Ewk_Context_Menu_Item::create(static_cast<WKContextMenuItemRef>(WKArrayGetItemAtIndex(items, i))).leakPtr());
 }
 
 EwkContextMenu::EwkContextMenu()
     : m_viewImpl(0)
-    , m_contextMenuProxy(0)
     , m_contextMenuItems(0)
 {
 }
 
 EwkContextMenu::EwkContextMenu(Eina_List* items)
     : m_viewImpl(0)
-    , m_contextMenuProxy(0)
     , m_contextMenuItems(0)
 {
     Eina_List* l;
@@ -86,9 +86,9 @@ void Ewk_Context_Menu::removeItem(EwkContextMenuItem* item)
     m_contextMenuItems = eina_list_remove(m_contextMenuItems, item);
 }
 
-void EwkContextMenu::contextMenuItemSelected(const WebKit::WebContextMenuItemData& item)
+void EwkContextMenu::contextMenuItemSelected(WKContextMenuItemRef item)
 {
-    m_contextMenuProxy->contextMenuItemSelected(item); 
+    WKPageSelectContextMenuItem(m_viewImpl->wkPage(), item);
 } 
 
 Ewk_Context_Menu* ewk_context_menu_new()
@@ -140,10 +140,173 @@ Eina_Bool ewk_context_menu_item_select(Ewk_Context_Menu* menu, Ewk_Context_Menu_
     EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
     EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
 
-    WebCore::ContextMenuItemType type = static_cast<WebCore::ContextMenuItemType>(item->type());
-    WebCore::ContextMenuAction action = static_cast<WebCore::ContextMenuAction>(item->action());
+    WKContextMenuItemRef wkItem;
+
+    switch (item->type()) {
+    case EWK_ACTION_TYPE:
+        wkItem = WKContextMenuItemCreateAsAction(getWKTagFromEwkAction(item->action()), adoptWK(WKStringCreateWithUTF8CString(item->title())).get(), item->enabled());
+        break;
+    case EWK_CHECKABLE_ACTION_TYPE:
+        wkItem = WKContextMenuItemCreateAsCheckableAction(getWKTagFromEwkAction(item->action()), adoptWK(WKStringCreateWithUTF8CString(item->title())).get(), item->enabled(), item->checked());
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return false;
+    }
 
-    menu->contextMenuItemSelected(WebContextMenuItemData(type, action, item->title(), item->enabled(), item->checked()));
+    menu->contextMenuItemSelected(wkItem);
 
     return true;
 }
+
+static WKContextMenuItemTag getWKTagFromEwkAction(Ewk_Context_Menu_Item_Action action)
+{
+    switch (action) {
+    case EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION:
+        return kWKContextMenuItemTagNoAction;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW:
+        return kWKContextMenuItemTagOpenLinkInNewWindow;
+    case EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK:
+        return kWKContextMenuItemTagDownloadLinkToDisk;
+    case EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD:
+        return kWKContextMenuItemTagCopyLinkToClipboard;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW:
+        return kWKContextMenuItemTagOpenImageInNewWindow;
+    case EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK:
+        return kWKContextMenuItemTagDownloadImageToDisk;
+    case EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD:
+        return kWKContextMenuItemTagCopyImageToClipboard;
+    case EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD:
+        return kWKContextMenuItemTagCopyImageUrlToClipboard;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW:
+        return kWKContextMenuItemTagOpenFrameInNewWindow;
+    case EWK_CONTEXT_MENU_ITEM_TAG_COPY:
+        return kWKContextMenuItemTagCopy;
+    case EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK:
+        return kWKContextMenuItemTagGoBack;
+    case EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD:
+        return kWKContextMenuItemTagGoForward;
+    case EWK_CONTEXT_MENU_ITEM_TAG_STOP:
+        return kWKContextMenuItemTagStop;
+    case EWK_CONTEXT_MENU_ITEM_TAG_RELOAD:
+        return kWKContextMenuItemTagReload;
+    case EWK_CONTEXT_MENU_ITEM_TAG_CUT:
+        return kWKContextMenuItemTagCut;
+    case EWK_CONTEXT_MENU_ITEM_TAG_PASTE:
+        return kWKContextMenuItemTagPaste;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL:
+        return kWKContextMenuItemTagSelectAll;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS:
+        return kWKContextMenuItemTagSpellingGuess;
+    case EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND:
+        return kWKContextMenuItemTagNoGuessesFound;
+    case EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING:
+        return kWKContextMenuItemTagIgnoreSpelling;
+    case EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING:
+        return kWKContextMenuItemTagLearnSpelling;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OTHER:
+        return kWKContextMenuItemTagOther;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT:
+        return kWKContextMenuItemTagSearchInSpotlight;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
+        return kWKContextMenuItemTagSearchWeb;
+    case EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY:
+        return kWKContextMenuItemTagLookUpInDictionary;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION:
+        return kWKContextMenuItemTagOpenWithDefaultApplication;
+    case EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE:
+        return kWKContextMenuItemTagPDFActualSize;
+    case EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN:
+        return kWKContextMenuItemTagPDFZoomIn;
+    case EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT:
+        return kWKContextMenuItemTagPDFZoomOut;
+    case EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE:
+        return kWKContextMenuItemTagPDFAutoSize;
+    case EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE:
+        return kWKContextMenuItemTagPDFSinglePage;
+    case EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES:
+        return kWKContextMenuItemTagPDFFacingPages;
+    case EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS:
+        return kWKContextMenuItemTagPDFContinuous;
+    case EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE:
+        return kWKContextMenuItemTagPDFNextPage;
+    case EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE:
+        return kWKContextMenuItemTagPDFPreviousPage;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK:
+        return kWKContextMenuItemTagOpenLink;
+    case EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR:
+        return kWKContextMenuItemTagIgnoreGrammar;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU:
+        return kWKContextMenuItemTagSpellingMenu;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL:
+        return kWKContextMenuItemTagShowSpellingPanel;
+    case EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING:
+        return kWKContextMenuItemTagCheckSpelling;
+    case EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING:
+        return kWKContextMenuItemTagCheckSpellingWhileTyping;
+    case EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING:
+        return kWKContextMenuItemTagCheckGrammarWithSpelling;
+    case EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU:
+        return kWKContextMenuItemTagFontMenu;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS:
+        return kWKContextMenuItemTagShowFonts;
+    case EWK_CONTEXT_MENU_ITEM_TAG_BOLD:
+        return kWKContextMenuItemTagBold;
+    case EWK_CONTEXT_MENU_ITEM_TAG_ITALIC:
+        return kWKContextMenuItemTagItalic;
+    case EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE:
+        return kWKContextMenuItemTagUnderline;
+    case EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE:
+        return kWKContextMenuItemTagOutline;
+    case EWK_CONTEXT_MENU_ITEM_TAG_STYLES:
+        return kWKContextMenuItemTagStyles;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS:
+        return kWKContextMenuItemTagShowColors;
+    case EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU:
+        return kWKContextMenuItemTagSpeechMenu;
+    case EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING:
+        return kWKContextMenuItemTagStartSpeaking;
+    case EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING:
+        return kWKContextMenuItemTagStopSpeaking;
+    case EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU:
+        return kWKContextMenuItemTagWritingDirectionMenu;
+    case EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION:
+        return kWKContextMenuItemTagDefaultDirection;
+    case EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT:
+        return kWKContextMenuItemTagLeftToRight;
+    case EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT:
+        return kWKContextMenuItemTagRightToLeft;
+    case EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING:
+        return kWKContextMenuItemTagPDFSinglePageScrolling;
+    case EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING:
+        return kWKContextMenuItemTagPDFFacingPagesScrolling;
+    case EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT:
+        return kWKContextMenuItemTagInspectElement;
+    case EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU:
+        return kWKContextMenuItemTagTextDirectionMenu;
+    case EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT:
+        return kWKContextMenuItemTagTextDirectionDefault;
+    case EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT:
+        return kWKContextMenuItemTagTextDirectionLeftToRight;
+    case EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT:
+        return kWKContextMenuItemTagTextDirectionRightToLeft;
+    case EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW:
+        return kWKContextMenuItemTagOpenMediaInNewWindow;
+    case EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD:
+        return kWKContextMenuItemTagCopyMediaLinkToClipboard;
+    case EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS:
+        return kWKContextMenuItemTagToggleMediaControls;
+    case EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP:
+        return kWKContextMenuItemTagToggleMediaLoop;
+    case EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN:
+        return kWKContextMenuItemTagEnterVideoFullscreen;
+    case EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE:
+        return kWKContextMenuItemTagMediaPlayPause;
+    case EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE:
+        return kWKContextMenuItemTagMediaMute;
+    case EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG:
+        return kWKContextMenuItemBaseApplicationTag;
+    default:
+        return static_cast<WKContextMenuItemTag>(action);
+    }
+}
index 1ff8652..edb9f46 100644 (file)
 
 #include "ewk_context_menu_item_private.h"
 #include "ewk_private.h"
+#include <WebKit2/WKContextMenuItemTypes.h>
 #include <wtf/text/CString.h>
 
-using namespace WebCore;
 using namespace WebKit;
 
-EwkContextMenuItem::EwkContextMenuItem(const WebContextMenuItemData& item)
-    : m_type(static_cast<Ewk_Context_Menu_Item_Type>(item.type()))
-    , m_action(static_cast<Ewk_Context_Menu_Item_Action>(item.action()))
-    , m_title(item.title().utf8().data())
-    , m_isChecked(item.checked())
-    , m_isEnabled(item.enabled())
+static Ewk_Context_Menu_Item_Action getEwkActionFromWKTag(WKContextMenuItemTag action);
+
+EwkContextMenuItem::EwkContextMenuItem(WKContextMenuItemRef item)
+    : m_type(static_cast<Ewk_Context_Menu_Item_Type>(WKContextMenuItemGetType(item)))
+    , m_action(getEwkActionFromWKTag((WKContextMenuItemGetTag(item))))
+    , m_title(WKEinaSharedString(AdoptWK, WKContextMenuItemCopyTitle(item)))
+    , m_isChecked(WKContextMenuItemGetChecked(item))
+    , m_isEnabled(WKContextMenuItemGetEnabled(item))
     , m_parentMenu(0)
     , m_subMenu(0)
 {
@@ -145,80 +147,154 @@ Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item* item, Eina_Bo
     return true;
 }
 
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION, WebCore::ContextMenuItemTagNoAction);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenLinkInNewWindow);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK, WebCore::ContextMenuItemTagDownloadLinkToDisk);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyLinkToClipboard);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenImageInNewWindow);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK, WebCore::ContextMenuItemTagDownloadImageToDisk);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyImageToClipboard);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyImageUrlToClipboard);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenFrameInNewWindow);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY, WebCore::ContextMenuItemTagCopy);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, WebCore::ContextMenuItemTagGoBack);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD, WebCore::ContextMenuItemTagGoForward);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STOP, WebCore::ContextMenuItemTagStop);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_RELOAD, WebCore::ContextMenuItemTagReload);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CUT, WebCore::ContextMenuItemTagCut);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PASTE, WebCore::ContextMenuItemTagPaste);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, WebCore::ContextMenuItemTagSelectAll);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS, WebCore::ContextMenuItemTagSpellingGuess);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND, WebCore::ContextMenuItemTagNoGuessesFound);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, WebCore::ContextMenuItemTagIgnoreSpelling);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, WebCore::ContextMenuItemTagLearnSpelling);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OTHER, WebCore::ContextMenuItemTagOther);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT, WebCore::ContextMenuItemTagSearchInSpotlight);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB, WebCore::ContextMenuItemTagSearchWeb);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY, WebCore::ContextMenuItemTagLookUpInDictionary);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION, WebCore::ContextMenuItemTagOpenWithDefaultApplication);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE, WebCore::ContextMenuItemPDFActualSize);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN, WebCore::ContextMenuItemPDFZoomIn);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT, WebCore::ContextMenuItemPDFZoomOut);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE, WebCore::ContextMenuItemPDFAutoSize);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE, WebCore::ContextMenuItemPDFSinglePage);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES, WebCore::ContextMenuItemPDFFacingPages);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS, WebCore::ContextMenuItemPDFContinuous);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE, WebCore::ContextMenuItemPDFNextPage);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE, WebCore::ContextMenuItemPDFPreviousPage);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK, WebCore::ContextMenuItemTagOpenLink);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR, WebCore::ContextMenuItemTagIgnoreGrammar);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, WebCore::ContextMenuItemTagSpellingMenu);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL, WebCore::ContextMenuItemTagShowSpellingPanel);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING, WebCore::ContextMenuItemTagCheckSpelling);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING, WebCore::ContextMenuItemTagCheckSpellingWhileTyping);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING, WebCore::ContextMenuItemTagCheckGrammarWithSpelling);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, WebCore::ContextMenuItemTagFontMenu);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS, WebCore::ContextMenuItemTagShowFonts);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_BOLD, WebCore::ContextMenuItemTagBold);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_ITALIC, WebCore::ContextMenuItemTagItalic);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE, WebCore::ContextMenuItemTagUnderline);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE, WebCore::ContextMenuItemTagOutline);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STYLES, WebCore::ContextMenuItemTagStyles);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS, WebCore::ContextMenuItemTagShowColors);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, WebCore::ContextMenuItemTagSpeechMenu);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING, WebCore::ContextMenuItemTagStartSpeaking);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING, WebCore::ContextMenuItemTagStopSpeaking);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, WebCore::ContextMenuItemTagWritingDirectionMenu);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION, WebCore::ContextMenuItemTagDefaultDirection);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT, WebCore::ContextMenuItemTagLeftToRight);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT, WebCore::ContextMenuItemTagRightToLeft);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING, WebCore::ContextMenuItemTagPDFSinglePageScrolling);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING, WebCore::ContextMenuItemTagPDFFacingPagesScrolling);
-#if ENABLE(INSPECTOR)
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT, WebCore::ContextMenuItemTagInspectElement);
-#endif
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, WebCore::ContextMenuItemTagTextDirectionMenu);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT, WebCore::ContextMenuItemTagTextDirectionDefault);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT, WebCore::ContextMenuItemTagTextDirectionLeftToRight);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT, WebCore::ContextMenuItemTagTextDirectionRightToLeft);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenMediaInNewWindow);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyMediaLinkToClipboard);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS, WebCore::ContextMenuItemTagToggleMediaControls);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP, WebCore::ContextMenuItemTagToggleMediaLoop);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN, WebCore::ContextMenuItemTagEnterVideoFullscreen);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE, WebCore::ContextMenuItemTagMediaPlayPause);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE, WebCore::ContextMenuItemTagMediaMute);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG, WebCore::ContextMenuItemBaseCustomTag);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION, WebCore::ContextMenuItemCustomTagNoAction);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG, WebCore::ContextMenuItemLastCustomTag);
-COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, WebCore::ContextMenuItemBaseApplicationTag);
+static Ewk_Context_Menu_Item_Action getEwkActionFromWKTag(WKContextMenuItemTag action)
+{
+    switch (action) {
+    case kWKContextMenuItemTagNoAction:
+        return EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION;
+    case kWKContextMenuItemTagOpenLinkInNewWindow:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW;
+    case kWKContextMenuItemTagDownloadLinkToDisk:
+        return EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK;
+    case kWKContextMenuItemTagCopyLinkToClipboard:
+        return EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD;
+    case kWKContextMenuItemTagOpenImageInNewWindow:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW;
+    case kWKContextMenuItemTagDownloadImageToDisk:
+        return EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK;
+    case kWKContextMenuItemTagCopyImageToClipboard:
+        return EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD;
+    case kWKContextMenuItemTagCopyImageUrlToClipboard:
+        return EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD;
+    case kWKContextMenuItemTagOpenFrameInNewWindow:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW;
+    case kWKContextMenuItemTagCopy:
+        return EWK_CONTEXT_MENU_ITEM_TAG_COPY;
+    case kWKContextMenuItemTagGoBack:
+        return EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK;
+    case kWKContextMenuItemTagGoForward:
+        return EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD;
+    case kWKContextMenuItemTagStop:
+        return EWK_CONTEXT_MENU_ITEM_TAG_STOP;
+    case kWKContextMenuItemTagReload:
+        return EWK_CONTEXT_MENU_ITEM_TAG_RELOAD;
+    case kWKContextMenuItemTagCut:
+        return EWK_CONTEXT_MENU_ITEM_TAG_CUT;
+    case kWKContextMenuItemTagPaste:
+        return EWK_CONTEXT_MENU_ITEM_TAG_PASTE;
+    case kWKContextMenuItemTagSelectAll:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL;
+    case kWKContextMenuItemTagSpellingGuess:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS;
+    case kWKContextMenuItemTagNoGuessesFound:
+        return EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND;
+    case kWKContextMenuItemTagIgnoreSpelling:
+        return EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING;
+    case kWKContextMenuItemTagLearnSpelling:
+        return EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING;
+    case kWKContextMenuItemTagOther:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OTHER;
+    case kWKContextMenuItemTagSearchInSpotlight:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT;
+    case kWKContextMenuItemTagSearchWeb:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB;
+    case kWKContextMenuItemTagLookUpInDictionary:
+        return EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY;
+    case kWKContextMenuItemTagOpenWithDefaultApplication:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION;
+    case kWKContextMenuItemTagPDFActualSize:
+        return EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE;
+    case kWKContextMenuItemTagPDFZoomIn:
+        return EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN;
+    case kWKContextMenuItemTagPDFZoomOut:
+        return EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT;
+    case kWKContextMenuItemTagPDFAutoSize:
+        return EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE;
+    case kWKContextMenuItemTagPDFSinglePage:
+        return EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE;
+    case kWKContextMenuItemTagPDFFacingPages:
+        return EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES;
+    case kWKContextMenuItemTagPDFContinuous:
+        return EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS;
+    case kWKContextMenuItemTagPDFNextPage:
+        return EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE;
+    case kWKContextMenuItemTagPDFPreviousPage:
+        return EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE;
+    case kWKContextMenuItemTagOpenLink:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK;
+    case kWKContextMenuItemTagIgnoreGrammar:
+        return EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR;
+    case kWKContextMenuItemTagSpellingMenu:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU;
+    case kWKContextMenuItemTagShowSpellingPanel:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL;
+    case kWKContextMenuItemTagCheckSpelling:
+        return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING;
+    case kWKContextMenuItemTagCheckSpellingWhileTyping:
+        return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING;
+    case kWKContextMenuItemTagCheckGrammarWithSpelling:
+        return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING;
+    case kWKContextMenuItemTagFontMenu:
+        return EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU;
+    case kWKContextMenuItemTagShowFonts:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS;
+    case kWKContextMenuItemTagBold:
+        return EWK_CONTEXT_MENU_ITEM_TAG_BOLD;
+    case kWKContextMenuItemTagItalic:
+        return EWK_CONTEXT_MENU_ITEM_TAG_ITALIC;
+    case kWKContextMenuItemTagUnderline:
+        return EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE;
+    case kWKContextMenuItemTagOutline:
+        return EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE;
+    case kWKContextMenuItemTagStyles:
+        return EWK_CONTEXT_MENU_ITEM_TAG_STYLES;
+    case kWKContextMenuItemTagShowColors:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS;
+    case kWKContextMenuItemTagSpeechMenu:
+        return EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU;
+    case kWKContextMenuItemTagStartSpeaking:
+        return EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING;
+    case kWKContextMenuItemTagStopSpeaking:
+        return EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING;
+    case kWKContextMenuItemTagWritingDirectionMenu:
+        return EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU;
+    case kWKContextMenuItemTagDefaultDirection:
+        return EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION;
+    case kWKContextMenuItemTagLeftToRight:
+        return EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT;
+    case kWKContextMenuItemTagRightToLeft:
+        return EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT;
+    case kWKContextMenuItemTagPDFSinglePageScrolling:
+        return EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING;
+    case kWKContextMenuItemTagPDFFacingPagesScrolling:
+        return EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING;
+    case kWKContextMenuItemTagInspectElement:
+        return EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT;
+    case kWKContextMenuItemTagTextDirectionMenu:
+        return EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU;
+    case kWKContextMenuItemTagTextDirectionDefault:
+        return EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT;
+    case kWKContextMenuItemTagTextDirectionLeftToRight:
+        return EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT;
+    case kWKContextMenuItemTagTextDirectionRightToLeft:
+        return EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT;
+    case kWKContextMenuItemTagOpenMediaInNewWindow:
+        return EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW;
+    case kWKContextMenuItemTagCopyMediaLinkToClipboard:
+        return EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD;
+    case kWKContextMenuItemTagToggleMediaControls:
+        return EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS;
+    case kWKContextMenuItemTagToggleMediaLoop:
+        return EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP;
+    case kWKContextMenuItemTagEnterVideoFullscreen:
+        return EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN;
+    case kWKContextMenuItemTagMediaPlayPause:
+        return EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE;
+    case kWKContextMenuItemTagMediaMute:
+        return EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE;
+    case kWKContextMenuItemBaseApplicationTag:
+        return EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG;
+    default:
+        return static_cast<Ewk_Context_Menu_Item_Action>(action);
+    }
+}
index 9612a21..11a9282 100644 (file)
@@ -41,7 +41,7 @@ extern "C" {
 /**
  * \enum    Ewk_Context_Menu_Item_Type
  * @brief   Defines the types of the items for the context menu.
- * @info    Keep this in sync with ContextMenuItem.h
+ * @info    Keep this in sync with WKContextMenuItemTypes.h
  */
 typedef enum {
     EWK_ACTION_TYPE,
@@ -53,7 +53,6 @@ typedef enum {
 /**
  * \enum    Ewk_Context_Menu_Action
  * @brief   Provides the actions of items for the context menu.
- * @info    Keep this in sync with ContextMenuItem.h
  */
 typedef enum {
     EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION,
@@ -127,9 +126,6 @@ typedef enum {
     EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
     EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
     EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
-    EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG = 5000,
-    EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION = 5998,
-    EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG = 5999,
     EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
 } Ewk_Context_Menu_Item_Action;
 
index 62f2790..9f7783b 100644 (file)
@@ -26,8 +26,8 @@
 #ifndef ewk_context_menu_item_private_h
 #define ewk_context_menu_item_private_h
 
+#include "WKContextMenuItem.h"
 #include "WKEinaSharedString.h"
-#include "WebContextMenuItemData.h"
 #include "ewk_context_menu.h"
 #include "ewk_context_menu_item.h"
 #include <wtf/PassOwnPtr.h>
@@ -38,7 +38,7 @@
  */
 class EwkContextMenuItem {
 public:
-    static PassOwnPtr<EwkContextMenuItem> create(const WebKit::WebContextMenuItemData& item)
+    static PassOwnPtr<EwkContextMenuItem> create(WKContextMenuItemRef item)
     {
         return adoptPtr(new EwkContextMenuItem(item));
     }
@@ -64,7 +64,7 @@ public:
     void setEnabled(bool enabled) { m_isEnabled = enabled; }
 
 private:
-    explicit EwkContextMenuItem(const WebKit::WebContextMenuItemData&);
+    explicit EwkContextMenuItem(WKContextMenuItemRef);
     EwkContextMenuItem(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, EwkContextMenu* subMenu);
 
     Ewk_Context_Menu_Item_Type m_type;
index b9e113d..a6cea2d 100644 (file)
 #ifndef ewk_context_menu_private_h
 #define ewk_context_menu_private_h
 
-#include "WebContextMenuItemData.h"
 #include "ewk_context_menu_item.h"
 #include <Eina.h>
 #include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebKit {
-class WebContextMenuItemData;
-class WebContextMenuProxyEfl;
-}
 
 class EwkView;
 
 class EwkContextMenu {
 public:
-    static PassOwnPtr<EwkContextMenu> create(EwkView* viewImpl, WebKit::WebContextMenuProxyEfl* contextMenuProxy, const Vector<WebKit::WebContextMenuItemData>& items)
+    static PassOwnPtr<EwkContextMenu> create(EwkView* viewImpl, WKArrayRef items)
     {
-        return adoptPtr(new EwkContextMenu(viewImpl, contextMenuProxy, items));
+        return adoptPtr(new EwkContextMenu(viewImpl, items));
     }
 
     static PassOwnPtr<EwkContextMenu> create()
@@ -63,15 +56,14 @@ public:
     void removeItem(EwkContextMenuItem*);
 
     const Eina_List* items() const { return m_contextMenuItems; }
-    void contextMenuItemSelected(const WebKit::WebContextMenuItemData& item);
+    void contextMenuItemSelected(WKContextMenuItemRef item);
 
 private:
     EwkContextMenu();
     EwkContextMenu(Eina_List* items);
-    EwkContextMenu(EwkView* viewImpl, WebKit::WebContextMenuProxyEfl*, const Vector<WebKit::WebContextMenuItemData>& items);
+    EwkContextMenu(EwkView* viewImpl, WKArrayRef items);
 
     EwkView* m_viewImpl;
-    WebKit::WebContextMenuProxyEfl* m_contextMenuProxy;
     Eina_List* m_contextMenuItems;
 };
 
index cc53acc..ac4fdcb 100644 (file)
 #include "ContextMenuClientEfl.h"
 
 #include "EwkView.h"
-#include "NotImplemented.h"
 #include "WKArray.h"
 #include "WKPage.h"
-#include "WebContextMenuItem.h"   
-#include <Evas.h>
 
 using namespace WebKit;
 
@@ -40,6 +37,16 @@ static inline ContextMenuClientEfl* toContextClientEfl(const void* clientInfo)
     return static_cast<ContextMenuClientEfl*>(const_cast<void*>(clientInfo));
 }
 
+static void showContextMenu(WKPageRef, WKPoint menuLocation, WKArrayRef menuItems, const void* clientInfo)
+{
+    toContextClientEfl(clientInfo)->view()->showContextMenu(menuLocation, menuItems);
+}
+
+static void hideContextMenu(WKPageRef, const void* clientInfo)
+{
+    toContextClientEfl(clientInfo)->view()->hideContextMenu();
+}
+
 ContextMenuClientEfl::ContextMenuClientEfl(EwkView* view)
     : m_view(view)
 {
@@ -54,13 +61,9 @@ ContextMenuClientEfl::ContextMenuClientEfl(EwkView* view)
     contextMenuClient.customContextMenuItemSelected = 0;
     contextMenuClient.contextMenuDismissed = 0;
     contextMenuClient.getContextMenuFromProposedMenu = 0;
-    contextMenuClient.showContextMenu = 0;
-    contextMenuClient.hideContextMenu = 0;
+    contextMenuClient.showContextMenu = showContextMenu;
+    contextMenuClient.hideContextMenu = hideContextMenu;
 
     WKPageSetPageContextMenuClient(pageRef, &contextMenuClient);
 }
 
-void ContextMenuClientEfl::getContextMenuFromProposedMenu(WKPageRef, WKArrayRef, WKArrayRef*, WKHitTestResultRef, WKTypeRef, const void*)
-{
-    notImplemented();
-}
index b212e9e..f036b3f 100644 (file)
 #ifndef ContextMenuClientEfl_h
 #define ContextMenuClientEfl_h
 
-#include "WKRetainPtr.h"
-#include "ewk_context.h"
-#include <WebKit2/WKBase.h>
-#include <wtf/HashMap.h>
 #include <wtf/PassOwnPtr.h>
-#include <wtf/text/WTFString.h>
 
 class EwkView;
 
@@ -44,7 +39,7 @@ public:
         return adoptPtr(new ContextMenuClientEfl(viewImpl));
     }
 
-    static void getContextMenuFromProposedMenu(WKPageRef, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKHitTestResultRef, WKTypeRef userData, const void* clientInfo);
+    EwkView* view() { return m_view; }
 
 private:
     explicit ContextMenuClientEfl(EwkView*);
index 68e75b4..830d919 100644 (file)
@@ -31,7 +31,7 @@
 #include "EwkView.h"
 #include "WebContextMenuItemData.h"
 #include "WebPageProxy.h"
-#include <wtf/text/CString.h>
+#include <WebCore/NotImplemented.h>
 
 using namespace WebCore;
 
@@ -47,19 +47,14 @@ WebContextMenuProxyEfl::~WebContextMenuProxyEfl()
 {
 }
 
-void WebContextMenuProxyEfl::showContextMenu(const WebCore::IntPoint& position, const Vector<WebContextMenuItemData>& items)
+void WebContextMenuProxyEfl::showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&)
 {
-    m_view->showContextMenu(this, position, items);
+    notImplemented();
 }
 
 void WebContextMenuProxyEfl::hideContextMenu()
 {
-    m_view->hideContextMenu();
-}
-
-void WebContextMenuProxyEfl::contextMenuItemSelected(const WebContextMenuItemData& item)
-{
-    m_page->contextMenuItemSelected(item);
+    notImplemented();
 }
 
 } // namespace WebKit
index ea42af1..b74a54f 100644 (file)
@@ -51,8 +51,6 @@ public:
     void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&);
     void hideContextMenu();
 
-    void contextMenuItemSelected(const WebContextMenuItemData&);
-
 private:
     WebContextMenuProxyEfl(EwkView*, WebPageProxy*);