Changed the handle type from "bottom" to "top" when the handle go to the bottom of...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / tizen / WebContextMenuProxyTizen.cpp
old mode 100644 (file)
new mode 100755 (executable)
index b163757..2a47512
@@ -78,6 +78,14 @@ void WebContextMenuProxyTizen::contextMenuItemSelectedCallback(void* data, Evas_
     WebContextMenuItemData itemData = *(static_cast<WebContextMenuItemData*>(data));
     WebContextMenuProxyTizen* menuProxy = static_cast<WebContextMenuProxyTizen*>(evas_object_data_get(obj, "WebContextMenuProxyTizen"));
 
+#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
+    menuProxy->m_pageClientImpl->hideFocusRing();
+#endif
+
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+    menuProxy->m_pageClientImpl->initTextSelectionHandlesMouseDownedStatus();
+#endif
+
     menuProxy->m_page->contextMenuItemSelected(itemData);
     menuProxy->hideContextMenu();
 
@@ -103,9 +111,13 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
     elm_object_tree_focus_allow_set(m_popup, false);
 
     size_t size = m_items.size();
+#if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
+    int clipboardItemSize = ClipboardHelper::numberOfItems();
+    TIZEN_LOGI("clipboardItemSize : %d", clipboardItemSize);
+#endif
     for (size_t i = 0; i < size; i++) {
 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
-        if (m_items.at(i).action() == ContextMenuItemTagPaste && !ClipboardHelper::numberOfItems())
+        if ((m_items.at(i).action() == ContextMenuItemTagPaste || m_items.at(i).action() == ContextMenuItemTagClipboard) && !clipboardItemSize)
             continue;
 #endif
 
@@ -114,8 +126,11 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
             Evas_Object* icon = 0;
             if (!m_items.at(i).iconFile().isEmpty()) {
                 icon = elm_icon_add(m_popup);
-                if (!elm_icon_file_set(icon, m_items.at(i).iconFile().utf8().data(), NULL))
+                TIZEN_LOGI("icon file path : %s", m_items.at(i).iconFile().utf8().data());
+                if (!elm_image_file_set(icon, m_items.at(i).iconFile().utf8().data(), NULL)) {
+                    TIZEN_LOGE("elm_image_file_set is failed");
                     icon = 0;
+                }
             }
 
             if (!m_items.at(i).title().isEmpty())
@@ -135,6 +150,9 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
 
 static void contextMenuPopupDismissedCallback(void* data, Evas_Object* obj, void* eventInfo)
 {
+#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
+    static_cast<PageClientImpl*>(data)->hideFocusRing();
+#endif
     static_cast<PageClientImpl*>(data)->setIsContextMenuVisible(false);
 }
 #else
@@ -167,20 +185,29 @@ void WebContextMenuProxyTizen::showContextMenu(const WebCore::IntPoint& position
             popupPosition.move(-scrollPosition.x(), -scrollPosition.y());
         }
 #endif
+        popupPosition.setX(popupPosition.x() + webViewX);
+        popupPosition.setY(popupPosition.y() + webViewY);
 
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
-        if ( m_pageClientImpl->isTextSelectionMode()) {
+        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() + webViewX, popupPosition.y() + webViewY);
+        evas_object_move(m_popup, popupPosition.x(), popupPosition.y());
         evas_object_show(m_popup);
 
         evas_object_smart_callback_add(m_popup, "dismissed", contextMenuPopupDismissedCallback, m_pageClientImpl);
 
         m_pageClientImpl->setIsContextMenuVisible(true);
+#if ENABLE(TOUCH_EVENTS) && ENABLE(TIZEN_GESTURE)
+        // Cancel touch event when ContextMenu is shown.
+        EwkViewImpl::fromEvasObject(m_webView)->feedTouchEventsByType(EWK_TOUCH_CANCEL);
+#endif
     }
 #else
     createEflMenu();