Fix the issue that input picker is shown twice
authorTaeyun An <ty.an@samsung.com>
Thu, 4 Apr 2013 21:26:44 +0000 (06:26 +0900)
committerTaeyun An <ty.an@samsung.com>
Thu, 4 Apr 2013 21:36:18 +0000 (06:36 +0900)
[Title] Fix the issue that input picker is shown twice
[Issue#]: N/A
[Problem] input picker popup is shown twice
[Cause] when setting the value from input picker popup, the selection is changed
[Solution] check the focus for view object when showing input picker

Change-Id: Id7d4c20901203befa66fbb010f205cdffc660a6d

Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp

index aded27a..4e12da3 100755 (executable)
@@ -344,28 +344,31 @@ void InputMethodContextEfl::updateTextInputState()
 
 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
         if (editor.inputMethodHints == "date") {
-            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATE, editor.surroundingText);
+            showInputPicker(EWK_INPUT_TYPE_DATE, editor);
             return;
         } else if (editor.inputMethodHints == "datetime") {
-            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATETIME, editor.surroundingText);
+            showInputPicker(EWK_INPUT_TYPE_DATETIME, editor);
             return;
         } else if (editor.inputMethodHints == "datetime-local") {
-            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATETIMELOCAL, editor.surroundingText);
+            showInputPicker(EWK_INPUT_TYPE_DATETIMELOCAL, editor);
             return;
         } else if (editor.inputMethodHints == "month") {
-            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_MONTH, editor.surroundingText);
+            showInputPicker(EWK_INPUT_TYPE_MONTH, editor);
             return;
         } else if (editor.inputMethodHints == "time") {
-            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TIME, editor.surroundingText);
+            showInputPicker(EWK_INPUT_TYPE_TIME, editor);
             return;
         } else if (editor.inputMethodHints == "week") {
-            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_WEEK, editor.surroundingText);
+            showInputPicker(EWK_INPUT_TYPE_WEEK, editor);
             return;
         }
 
 #if ENABLE(TIZEN_DATALIST_ELEMENT)
         Vector<String> optionList = m_viewImpl->page()->getFocusedInputElementDataList();
         if (optionList.size() > 0) {
+            if (editor.selectionIsRange || !evas_object_focus_get(m_viewImpl->view()))
+                return;
+
             if (editor.inputMethodHints == "tel")
                 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TELEPHONE, optionList);
             else if (editor.inputMethodHints == "number")
@@ -551,6 +554,17 @@ void InputMethodContextEfl::destroyIMFContextList()
 {
     m_contextList.clear();
 }
+
+#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
+void InputMethodContextEfl::showInputPicker(Ewk_Input_Type type, const EditorState& editorState)
+{
+    if (editorState.selectionIsRange || !evas_object_focus_get(m_viewImpl->view()))
+        return;
+
+    ewkViewInputPickerRequest(m_viewImpl->view(), type, editorState.surroundingText);
+}
+#endif
+
 #endif
 
 }