X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=Source%2FWebKit2%2FUIProcess%2Ftizen%2FWebContextMenuProxyTizen.cpp;h=11cac6f928ad158349175e8cb262a8398a1719d3;hb=765b17e3f0223f0b41c362e3a29abccba9887a1c;hp=3c90babb5082fc415c0d1217a10f1246a81696f3;hpb=9d9728528674116fb2c038eaacd0b9cfd7e03ec2;p=framework%2Fweb%2Fwebkit-efl.git diff --git a/Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.cpp b/Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.cpp index 3c90bab..11cac6f 100755 --- a/Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.cpp +++ b/Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.cpp @@ -45,6 +45,12 @@ #include +#if ENABLE(TIZEN_HW_MORE_BACK_KEY) +#include +#include +extern void* EflAssistHandle; +#endif + using namespace WebCore; namespace WebKit { @@ -58,6 +64,9 @@ WebContextMenuProxyTizen::WebContextMenuProxyTizen(Evas_Object* webView, WebPage , m_webView(webView) , m_items() #endif +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + , m_contextShowTimer(0) +#endif #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE) , m_positionForSelection() #endif @@ -93,6 +102,13 @@ void WebContextMenuProxyTizen::contextMenuItemSelectedCallback(void* data, Evas_ menuProxy->m_popup = 0; } +#if ENABLE(TIZEN_HW_MORE_BACK_KEY) +static void contextMenuHwBackKeyCallback(void* data, Evas_Object* obj, void* eventInfo) +{ + elm_ctxpopup_dismiss(obj); +} +#endif + void WebContextMenuProxyTizen::createEflMenu(const Vector& items) { if (m_popup) @@ -106,6 +122,14 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector(data); + if (menuProxy) { #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - static_cast(data)->hideFocusRing(); + menuProxy->m_pageClientImpl->hideFocusRing(); #endif - static_cast(data)->setIsContextMenuVisible(false); + menuProxy->m_pageClientImpl->setIsContextMenuVisible(false); + +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + if (menuProxy->m_contextShowTimer) { + ecore_timer_del(menuProxy->m_contextShowTimer); + menuProxy->m_contextShowTimer = 0; + } +#endif + } } +#endif + #else void WebContextMenuProxyTizen::createEflMenu() { @@ -162,6 +210,36 @@ void WebContextMenuProxyTizen::createEflMenu() } #endif +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) +Eina_Bool WebContextMenuProxyTizen::contextMenuTimerCallback(void* data) +{ + WebContextMenuProxyTizen *contextMenuProxy = static_cast(data); + if (contextMenuProxy) { + if (contextMenuProxy->m_popup) + evas_object_hide(contextMenuProxy->m_popup); + + contextMenuProxy->m_pageClientImpl->setIsContextMenuVisible(false); + EditorState editorState = contextMenuProxy->m_page->editorState(); + if (!editorState.selectionIsRange && editorState.isContentEditable) + contextMenuProxy->m_pageClientImpl->setIsTextSelectionMode(false); +#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) + contextMenuProxy->m_pageClientImpl->hideFocusRing(); +#endif + } + return ECORE_CALLBACK_CANCEL; +} + +void WebContextMenuProxyTizen::startContextMenuTimer() +{ + double contextMenuDispTime = 3.0; + if (m_contextShowTimer) { + ecore_timer_del(m_contextShowTimer); + m_contextShowTimer = 0; + } + m_contextShowTimer = ecore_timer_add(contextMenuDispTime, contextMenuTimerCallback, this); +} +#endif // TIZEN_WEBKIT2_TEXT_SELECTION + void WebContextMenuProxyTizen::showContextMenu(const WebCore::IntPoint& position, const Vector& items) { #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE) @@ -179,6 +257,11 @@ void WebContextMenuProxyTizen::showContextMenu(const WebCore::IntPoint& position createEflMenu(items); +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + if (m_isContextMenuForTextSelection && !evas_object_focus_get(m_webView)) + return; +#endif + if (m_popup) { int webViewX, webViewY; evas_object_geometry_get(m_webView, &webViewX, &webViewY, 0, 0); @@ -194,10 +277,13 @@ void WebContextMenuProxyTizen::showContextMenu(const WebCore::IntPoint& position popupPosition.setY(popupPosition.y() + webViewY); #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - if (m_pageClientImpl->isTextSelectionMode()) { + if (m_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); + elm_ctxpopup_direction_priority_set(m_popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT, ELM_CTXPOPUP_DIRECTION_DOWN); m_pageClientImpl->changeContextMenuPosition(popupPosition); } @@ -206,13 +292,20 @@ void WebContextMenuProxyTizen::showContextMenu(const WebCore::IntPoint& position 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); + evas_object_smart_callback_add(m_popup, "dismissed", contextMenuPopupDismissedCallback, this); + 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 + +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + // Start the timer at the end + if (m_isContextMenuForTextSelection) + startContextMenuTimer(); +#endif } #else createEflMenu(); @@ -226,6 +319,12 @@ void WebContextMenuProxyTizen::hideContextMenu() if (m_popup) evas_object_hide(m_popup); m_pageClientImpl->setIsContextMenuVisible(false); +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) + if (m_contextShowTimer) { + ecore_timer_del(m_contextShowTimer); + m_contextShowTimer = 0; + } +#endif #else notImplemented(); #endif