Fix ime issues
authorSangYong Park <sy302.park@samsung.com>
Wed, 3 Apr 2013 12:51:40 +0000 (21:51 +0900)
committerGerrit Code Review <gerrit2@kim11>
Thu, 4 Apr 2013 07:48:00 +0000 (16:48 +0900)
[Title] Fix ime issues
[Issue#] N/A
[Problem] Keypad did not showing when edit field has focus.
[Cause] It is side-effect by showing by editorState as opensource
[Solution] Change invalid code

Change-Id: I8e968d05a014f8c8acb2ad288604995f7395c2d2

Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 5fb8017..2f93bec 100755 (executable)
@@ -530,11 +530,11 @@ static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, con
         if (impl->pageClient->isDragMode())
             impl->pageClient->setDragMode(false);
 #endif
-            impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
             if (impl->pageClient->isTextSelectionMode())
                 impl->pageClient->setIsTextSelectionMode(false);
 #endif
+            impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
 #if ENABLE(TIZEN_ISF_PORT)
             evas_object_focus_set(smartData->self, true);
 #endif
index d7f993d..82e0ecc 100755 (executable)
@@ -55,9 +55,11 @@ void InputMethodContextEfl::onIMFInputPanelStateChanged(void* data, Ecore_IMF_Co
     if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
         return;
 
-    if (state == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
+    if (state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
         evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,ime,closed", 0);
-    else if (state == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
+        if (inputMethodContext->m_context)
+            evas_object_focus_set(inputMethodContext->m_viewImpl->view(), false);
+    } else if (state == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
         evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,ime,opened", 0);
 }
 
@@ -398,17 +400,19 @@ void InputMethodContextEfl::updateTextInputState()
 
         setType(editor.inputMethodHints);
 
-        if (!hasFocus)
+        if (!hasFocus) {
+            m_focused = true;
             return;
-
-        // input field zoom for external keyboard
-        ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
+        }
 #endif
 
         ecore_imf_context_reset(m_context.get());
         ecore_imf_context_focus_in(m_context.get());
 #if ENABLE(TIZEN_ISF_PORT)
         ecore_imf_context_input_panel_show(m_context.get());
+
+        // input field zoom for external keyboard
+        ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
 #endif
         m_focused = true;
     } else {
@@ -515,7 +519,8 @@ void InputMethodContextEfl::revertIMFContext()
         return;
 
     PassOwnPtr<Ecore_IMF_Context> imfContext = m_context.release();
-    m_contextList.add(ecore_imf_context_input_panel_layout_get(imfContext.get()), imfContext);
+    int layout = ecore_imf_context_input_panel_layout_get(imfContext.get());
+    m_contextList.add(layout, imfContext);
 }
 
 void InputMethodContextEfl::resetIMFContext()
@@ -524,9 +529,6 @@ void InputMethodContextEfl::resetIMFContext()
         return;
 
     ecore_imf_context_reset(m_context.get());
-
-    if (ecore_imf_context_input_panel_state_get(m_context.get()) == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
-        revertIMFContext();
 }
 
 void InputMethodContextEfl::hideIMFContext()
index 3921a5e..05f5572 100755 (executable)
@@ -564,9 +564,13 @@ EditorState WebPage::editorState() const
     result.shouldIgnoreCompositionSelectionChange = frame->editor()->ignoreCompositionSelectionChange();
 
 #if ENABLE(TIZEN_ISF_PORT)
-    Element* selectionRoot = frame->selection()->rootEditableElement();
+    Element* selectionRoot = frame->selection()->rootEditableElementOrDocumentElement();
+    if (!selectionRoot)
+        return result;
+
+    Node* hostNode = selectionRoot->shadowAncestorNode();
     if (result.isContentEditable) {
-        HTMLTextFormControlElement* formControl = toTextFormControl(selectionRoot);
+        HTMLTextFormControlElement* formControl = toTextFormControl(hostNode);
         if (formControl) {
             result.inputMethodHints = formControl->type();
             result.surroundingText = formControl->value();
@@ -580,8 +584,7 @@ EditorState WebPage::editorState() const
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
-    if (selectionRoot)
-        result.editorRect = frame->view()->contentsToWindow(selectionRoot->getPixelSnappedRect());
+    result.editorRect = frame->view()->contentsToWindow(selectionRoot->getPixelSnappedRect());
 #endif
 
 #if PLATFORM(QT)