Show vertical mode context menu at the link or image when cursor is in editable contents.
authorTaeyun An <ty.an@samsung.com>
Thu, 30 May 2013 01:52:11 +0000 (10:52 +0900)
committerTaeyun An <ty.an@samsung.com>
Wed, 10 Jul 2013 11:36:44 +0000 (20:36 +0900)
[Title] Show horizontal mode context menu at the link or image when cursor is in editable contents.
[Issue#] N/A
[Problem] Horizontal mode context menu is shown at the link or image when try to show context menu in editable content.
[Cause] Now just checking EditorState
[Solution] Change checking condition code

Change-Id: I7a9d12a95d0b834acf5f8e17e6212ffa992e5853

Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.cpp

index 5cf3d61..790e513 100755 (executable)
@@ -136,12 +136,19 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
     int clipboardItemSize = ClipboardHelper::numberOfItems();
     TIZEN_LOGI("clipboardItemSize : %d", clipboardItemSize);
 #endif
+    bool isContextMenuForTextSelection = false;
     for (size_t i = 0; i < size; i++) {
 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
         if ((m_items.at(i).action() == ContextMenuItemTagPaste || m_items.at(i).action() == ContextMenuItemTagClipboard) && !clipboardItemSize)
             continue;
 #endif
 
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+        if (m_items.at(i).action() == ContextMenuItemTagCopy || m_items.at(i).action() == ContextMenuItemTagSelectAll
+            || m_items.at(i).action() == ContextMenuItemTagSelectWord || m_items.at(i).action() == ContextMenuItemTagPaste)
+            isContextMenuForTextSelection = true;
+#endif
+
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_ICON_TYPE_SUPPORT)
         if (!m_items.at(i).title().isEmpty() || !m_items.at(i).iconFile().isEmpty()) {
             Evas_Object* icon = 0;
@@ -167,6 +174,16 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
                                      contextMenuItemSelectedCallback, &(m_items.at(i)));
 #endif
     }
+
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+    if (isContextMenuForTextSelection) {
+        if (!m_pageClientImpl->isTextSelectionMode())
+            m_pageClientImpl->setIsTextSelectionMode(true);
+        elm_object_style_set(m_popup,"copypaste");
+        elm_ctxpopup_horizontal_set(m_popup, EINA_TRUE);
+        elm_ctxpopup_direction_priority_set(m_popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP);
+    }
+#endif
 }
 
 static void contextMenuPopupDismissedCallback(void* data, Evas_Object* obj, void* eventInfo)
@@ -214,16 +231,6 @@ void WebContextMenuProxyTizen::showContextMenu(const WebCore::IntPoint& position
         popupPosition.setX(popupPosition.x() + webViewX);
         popupPosition.setY(popupPosition.y() + webViewY);
 
-#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
-        if (m_pageClientImpl->isTextSelectionMode()) {
-            elm_object_style_set(m_popup,"copypaste");
-            elm_ctxpopup_horizontal_set(m_popup, EINA_TRUE);
-            elm_ctxpopup_direction_priority_set(m_popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP);
-
-            m_pageClientImpl->changeContextMenuPosition(popupPosition);
-        }
-#endif
-
         evas_object_move(m_popup, popupPosition.x(), popupPosition.y());
         evas_object_show(m_popup);