Fix input picker issue
authorSangYong Park <sy302.park@samsung.com>
Tue, 9 Jul 2013 07:10:09 +0000 (16:10 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Wed, 10 Jul 2013 05:27:39 +0000 (05:27 +0000)
[Title] Fix input picker issue
[Issue#] N/A
[Problem] Data/time input picker did not showing
[Cause] ewk view has not focus
[Solution] Set focus to ewk view after handling tap event

Change-Id: I217b5954878cecff81fff1ba262d8398d1b3c8e6

Source/WebKit2/Shared/EditorState.cpp
Source/WebKit2/Shared/EditorState.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index d9ab33d..b79afda 100755 (executable)
@@ -42,7 +42,6 @@ void EditorState::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(hasComposition);
 
 #if ENABLE(TIZEN_ISF_PORT)
-    encoder->encode(isTapEventHandling);
     encoder->encode(inputMethodContextID);
     encoder->encode(inputMethodHints);
     encoder->encode(surroundingText);
@@ -98,9 +97,6 @@ bool EditorState::decode(CoreIPC::ArgumentDecoder* decoder, EditorState& result)
         return false;
 
 #if ENABLE(TIZEN_ISF_PORT)
-    if (!decoder->decode(result.isTapEventHandling))
-        return false;
-
     if (!decoder->decode(result.inputMethodContextID))
         return false;
 
index 2ea188d..3248fa2 100755 (executable)
@@ -43,7 +43,6 @@ struct EditorState {
         , isInPasswordField(false)
         , hasComposition(false)
 #if ENABLE(TIZEN_ISF_PORT)
-        , isTapEventHandling(false)
         , inputMethodContextID(0)
         , cursorPosition(0)
 #endif
@@ -70,7 +69,6 @@ struct EditorState {
     bool isInPasswordField;
     bool hasComposition;
 #if ENABLE(TIZEN_ISF_PORT)
-    bool isTapEventHandling;
     uintptr_t inputMethodContextID;
     WTF::String inputMethodHints;
     WTF::String surroundingText;
index cf2c174..cbc652a 100755 (executable)
@@ -3817,21 +3817,11 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
         m_gestureEventQueue.removeFirst();
         m_pageClient->doneWithGestureEvent(event, handled);
 #endif
+
 #if ENABLE(TIZEN_ISF_PORT)
-        if (m_isVisible && type == WebEvent::GestureSingleTap && m_editorState.isContentEditable) {
-#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
-            if (m_editorState.inputMethodHints == "date"
-                || m_editorState.inputMethodHints == "datetime"
-                || m_editorState.inputMethodHints == "datetime-local"
-                || m_editorState.inputMethodHints == "month"
-                || m_editorState.inputMethodHints == "time"
-                || m_editorState.inputMethodHints == "week") {
-                InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
-                if (inputMethodContext->inputPickerType() == -1)
-                    break;
-            }
-#endif
-            evas_object_focus_set(viewWidget(), true);
+        if (m_isVisible && type == WebEvent::GestureSingleTap) {
+            InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
+            inputMethodContext->updateTextInputStateByUserAction(true);
         }
 #endif
         break;
index a143641..2997efa 100755 (executable)
@@ -373,6 +373,18 @@ void InputMethodContextEfl::updateTextInputState()
     if (m_context)
         ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
 }
+
+void InputMethodContextEfl::updateTextInputStateByUserAction(bool setFocus)
+{
+    const EditorState& editor = m_viewImpl->page()->editorState();
+
+    if (editor.isContentEditable) {
+        showIMFContext(editor, true);
+        if (setFocus)
+            evas_object_focus_set(m_viewImpl->view(), true);
+    } else
+        hideIMFContext();
+}
 #else
 void InputMethodContextEfl::updateTextInputState()
 {
@@ -565,10 +577,10 @@ void InputMethodContextEfl::resetIMFContext()
     m_doNotHandleFakeKeyEvent = false;
 }
 
-void InputMethodContextEfl::showIMFContext(const EditorState& editor)
+void InputMethodContextEfl::showIMFContext(const EditorState& editor, bool isUserAction)
 {
     Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
-    if (!editor.isTapEventHandling) {
+    if (!isUserAction) {
         if (!ewk_settings_uses_keypad_without_user_action_get(settings) || (m_focused && m_contextID == editor.inputMethodContextID))
             return;
     }
index 7dd31c8..114707c 100755 (executable)
@@ -58,6 +58,7 @@ public:
     void onFocusIn();
     void onFocusOut();
     void resetIMFContext();
+    void updateTextInputStateByUserAction(bool);
     void hideIMFContext();
     bool isIMEPostion(int, int);
     void removeIMFContext(uintptr_t);
@@ -84,7 +85,7 @@ private:
     PassOwnPtr<Ecore_IMF_Context> takeContext(uintptr_t);
     void setIMFContext(const EditorState&);
     void revertIMFContext();
-    void showIMFContext(const EditorState&);
+    void showIMFContext(const EditorState&, bool = false);
     void destroyIMFContextList();
     void setState(int state) { m_state = state; }
     void setIMERect(const WebCore::IntRect& rect) { m_imeRect = rect; }
index 9a7343e..f4ef35d 100755 (executable)
@@ -580,8 +580,6 @@ EditorState WebPage::editorState() const
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
-    result.isTapEventHandling = (currentEvent() && currentEvent()->type() == WebEvent::GestureSingleTap);
-
     if (!result.shouldIgnoreCompositionSelectionChange && result.isContentEditable) {
         result.inputMethodContextID = reinterpret_cast<uintptr_t>(rootEditableElement);