Prevent to show context menu after unlocked
authorTaeyun An <ty.an@samsung.com>
Thu, 13 Jun 2013 12:55:38 +0000 (21:55 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 12 Jul 2013 07:27:25 +0000 (07:27 +0000)
[Title] Prevent to show context menu after unlocked
[Issue#] N_SE-41092
[Problem] Sometimes context menu is appeared after unlocked
[Cause] There is existed timing issue when try to device lock.
It makes appear context menu after webview has focused out.
[Solution] Prevent to show context menu after unlocked.

Change-Id: I52bcd122ad1c739478b27a7d2f45a63a95b18af6

Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.cpp
Source/WebKit2/UIProcess/tizen/WebContextMenuProxyTizen.h

index 790e513..98d1000 100755 (executable)
@@ -136,7 +136,11 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
     int clipboardItemSize = ClipboardHelper::numberOfItems();
     TIZEN_LOGI("clipboardItemSize : %d", clipboardItemSize);
 #endif
-    bool isContextMenuForTextSelection = false;
+
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+    m_isContextMenuForTextSelection = false;
+#endif
+
     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)
@@ -146,7 +150,7 @@ void WebContextMenuProxyTizen::createEflMenu(const Vector<WebContextMenuItemData
 #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;
+            m_isContextMenuForTextSelection = true;
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_ICON_TYPE_SUPPORT)
@@ -174,16 +178,6 @@ 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)
@@ -217,6 +211,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);
@@ -231,6 +230,16 @@ 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_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
+
         evas_object_move(m_popup, popupPosition.x(), popupPosition.y());
         evas_object_show(m_popup);
 
index 98586e0..cd7bdd5 100644 (file)
@@ -71,6 +71,10 @@ private:
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE)
     WebCore::IntPoint m_positionForSelection;
 #endif
+
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+    bool m_isContextMenuForTextSelection;
+#endif
 };