Remove Paste, Cut, Clipboard options if context menu be shown on input element.
authorTaeyun An <ty.an@samsung.com>
Wed, 12 Jun 2013 11:07:41 +0000 (20:07 +0900)
committerTaeyun An <ty.an@samsung.com>
Wed, 12 Jun 2013 11:23:41 +0000 (20:23 +0900)
[Title] Remove Paste, Cut, Clipboard options if context menu be shown on input element.
[Issue#] N_SE-40982
[Problem] Paste, Cut, Clipboard options are displayed if context menu be shown on input element.
[Cause] There is no remove routine.
[Solution] Remove Paste, Cut, Clipboard options if context menu be shown on input element.

Change-Id: I970a5c5bda694378f7103000bede43cb567e9433

Source/WebCore/page/ContextMenuController.cpp

index 36eab64..bd3fc4f 100755 (executable)
 #include "Pasteboard.h"
 #endif
 
+#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
+#include "HTMLInputElement.h"
+#endif
+
 using namespace WTF;
 using namespace Unicode;
 
@@ -1095,17 +1099,29 @@ void ContextMenuController::populate()
         }
 
 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
+        bool isInputPickerType = false;
+#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
+        HTMLInputElement* inputElement = node->toInputElement();
+        if (inputElement &&
+            (inputElement->isDateField() || inputElement->isDateTimeField() || inputElement->isDateTimeLocalField()
+            || inputElement->isMonthField() || inputElement->isTimeField() || inputElement->isWeekField()))
+            isInputPickerType = true;
+#endif
         if (m_hitTestResult.isSelected() && !inPasswordField) {
-            appendItem(CutItem, m_contextMenu.get());
+            if (!isInputPickerType)
+                appendItem(CutItem, m_contextMenu.get());
             appendItem(CopyItem, m_contextMenu.get());
         }
+        if (!isInputPickerType) {
+            appendItem(PasteItem, m_contextMenu.get());
+#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
+            appendItem(ClipboardItem, m_contextMenu.get());
+#endif
+        }
 #else
         appendItem(CutItem, m_contextMenu.get());
         appendItem(CopyItem, m_contextMenu.get());
-#endif
         appendItem(PasteItem, m_contextMenu.get());
-#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
-        appendItem(ClipboardItem, m_contextMenu.get());
 #endif
 #if PLATFORM(GTK)
         appendItem(DeleteItem, m_contextMenu.get());