Show ime keypad by editorState event as opensource
authorSangYong Park <sy302.park@samsung.com>
Wed, 3 Apr 2013 11:03:50 +0000 (20:03 +0900)
committerSangYong Park <sy302.park@samsung.com>
Wed, 3 Apr 2013 11:48:32 +0000 (20:48 +0900)
[Title] Show ime keypad by editorState event as opensource
[Issue#] N/A
[Problem] opensource is not implement setInputMethodState
[Cause] setInputMethodState is not opensource policy
[Solution] Show ime keypad by editorState event

Change-Id: I1b1a2490d10aa34288c14321de683b54899a04e0

14 files changed:
Source/WebKit2/Shared/EditorState.cpp [changed mode: 0644->0755]
Source/WebKit2/Shared/EditorState.h [changed mode: 0644->0755]
Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.h
Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp

old mode 100644 (file)
new mode 100755 (executable)
index b07e4d1..2d1eaec
@@ -43,6 +43,8 @@ void EditorState::encode(CoreIPC::ArgumentEncoder* encoder) const
 
 #if ENABLE(TIZEN_ISF_PORT)
     encoder->encode(inputMethodHints);
+    encoder->encode(surroundingText);
+    encoder->encode(cursorPosition);
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
@@ -88,6 +90,12 @@ bool EditorState::decode(CoreIPC::ArgumentDecoder* decoder, EditorState& result)
 #if ENABLE(TIZEN_ISF_PORT)
     if (!decoder->decode(result.inputMethodHints))
         return false;
+
+    if (!decoder->decode(result.surroundingText))
+        return false;
+
+    if (!decoder->decode(result.cursorPosition))
+        return false;
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
old mode 100644 (file)
new mode 100755 (executable)
index ab59782..f85300a
@@ -43,7 +43,7 @@ struct EditorState {
         , isInPasswordField(false)
         , hasComposition(false)
 #if ENABLE(TIZEN_ISF_PORT)
-        , inputMethodHints(0)
+        , cursorPosition(0)
 #endif
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
         , updateEditorRectOnly(false)
@@ -65,7 +65,9 @@ struct EditorState {
     bool isInPasswordField;
     bool hasComposition;
 #if ENABLE(TIZEN_ISF_PORT)
-    int inputMethodHints;
+    WTF::String inputMethodHints;
+    WTF::String surroundingText;
+    unsigned cursorPosition;
 #endif
 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
     WebCore::IntRect editorRect;
index 1f146c7..04a095c 100755 (executable)
@@ -738,198 +738,6 @@ void PageClientImpl::textChangeInTextField(const String& name, const String& val
 }
 #endif
 
-#if ENABLE(TIZEN_ISF_PORT)
-void PageClientImpl::setInputMethodState(bool active, const String& type, const String& value)
-{
-    if (!active) {
-        InputMethodContextEfl* inputMethodContext = m_viewImpl->inputMethodContext();
-        if (inputMethodContext)
-            inputMethodContext->hideIMFContext();
-        LOG(ISF, "- Keypad status : hide\n");
-        return;
-    }
-
-    Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
-    bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
-
-#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
-    if (m_clipboardHelper->isClipboardWindowOpened()) {
-        LOG(ISF, "[FAIL] Clipboard\n");
-        return;
-    }
-#endif
-
-    LOG(ISF, "- Type (%s), Value (%s)\n", type.utf8().data(), value.utf8().data());
-
-#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
-    if (type == "date") {
-        ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATE, value);
-        return;
-    } else if (type == "datetime") {
-        ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATETIME, value);
-        return;
-    } else if (type == "datetime-local") {
-        ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATETIMELOCAL, value);
-        return;
-    } else if (type == "month") {
-        ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_MONTH, value);
-        return;
-    } else if (type == "time") {
-        ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TIME, value);
-        return;
-    } else if (type == "week") {
-        ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_WEEK, value);
-        return;
-    }
-
-#if ENABLE(TIZEN_DATALIST_ELEMENT)
-    Vector<String> optionList = m_viewImpl->page()->getFocusedInputElementDataList();
-    if (optionList.size() > 0) {
-        if (type == "tel")
-            ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TELEPHONE, optionList);
-        else if (type == "number")
-            ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_NUMBER, optionList);
-        else if (type == "email")
-            ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_EMAIL, optionList);
-        else if (type == "url")
-            ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_URL, optionList);
-        else
-            ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TEXT, optionList);
-
-        return;
-    }
-#endif // ENABLE(TIZEN_DATALIST_ELEMENT)
-#endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
-
-    bool hasFocus = evas_object_focus_get(m_viewImpl->view());
-
-    if (!defaultKeypadEnabled) {
-        if (hasFocus) {
-            Eina_Rectangle dummyRectForCustomKeypadCallback;
-            memset(&dummyRectForCustomKeypadCallback, 0, sizeof(Eina_Rectangle));
-            evas_object_smart_callback_call(m_viewImpl->view(), "inputmethod,changed", &dummyRectForCustomKeypadCallback);
-        }
-        return;
-    }
-
-    InputMethodContextEfl* inputMethodContext = m_viewImpl->inputMethodContext();
-    if (!inputMethodContext)
-        return;
-
-    inputMethodContext->setType(type);
-
-    if (!hasFocus)
-        return;
-
-    inputMethodContext->showIMFContext();
-
-    // input field zoom for external keyboard
-    ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
-
-    LOG(ISF, "- Keypad status : show\n");
-}
-#else
-void PageClientImpl::setInputMethodState(bool) { }
-#endif // #if ENABLE(TIZEN_ISF_PORT)
-
-#if ENABLE(TIZEN_ISF_PORT)
-void PageClientImpl::updateCursorOffset(int offset)
-{
-    InputMethodContextEfl* inputMethodContext = m_viewImpl->inputMethodContext();
-    if (!inputMethodContext)
-        return;
-
-    inputMethodContext->setIMFContextCursorPosition(offset);
-}
-
-void PageClientImpl::imContextCommitted(Ecore_IMF_Context* context, char* string)
-{
-    if (!m_viewImpl->page()->focusedFrame())
-        return;
-
-    m_viewImpl->page()->confirmComposition(String::fromUTF8(string));
-}
-
-void PageClientImpl::imContextPreeditChanged(Ecore_IMF_Context* context)
-{
-    if (!m_viewImpl->page()->focusedFrame())
-        return;
-
-    char* preeditStr = 0;
-    Eina_List* preeditAttrs = 0;
-    int cursorPosition = 0;
-
-    ecore_imf_context_preedit_string_with_attributes_get(context, &preeditStr, &preeditAttrs, &cursorPosition);
-    if (!preeditStr) {
-        if (preeditAttrs) {
-            void* item = 0;
-            EINA_LIST_FREE(preeditAttrs, item)
-                free(item);
-        }
-        return;
-    }
-
-    IntRect caretRect;
-    m_viewImpl->page()->getCaretPosition(caretRect);
-    caretRect.scale(scaleFactor());
-
-    int viewX, viewY;
-    evas_object_geometry_get(m_viewImpl->view(), &viewX, &viewY, 0, 0);
-
-    int x = caretRect.x() - scrollPosition().x() + viewX;
-    int y = caretRect.y() - scrollPosition().y() + viewY;
-    int w = caretRect.width();
-    int h = caretRect.height();
-    ecore_imf_context_cursor_location_set(context, x, y, w, h);
-
-    String preeditString = String::fromUTF8(preeditStr);
-    if (preeditStr)
-        free(preeditStr);
-
-    Vector<CompositionUnderline> underlines;
-
-#if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
-    if (preeditAttrs) {
-        Eina_List* listIterator = 0;
-        void* item = 0;
-        EINA_LIST_FOREACH(preeditAttrs, listIterator, item) {
-            Ecore_IMF_Preedit_Attr* preeditAttr = static_cast<Ecore_IMF_Preedit_Attr*>(item);
-
-            switch (preeditAttr->preedit_type) {
-            case ECORE_IMF_PREEDIT_TYPE_SUB1:
-                underlines.append(CompositionUnderline(preeditAttr->start_index, preeditAttr->end_index, Color(0, 0, 0), false));
-                break;
-            case ECORE_IMF_PREEDIT_TYPE_SUB2:
-            case ECORE_IMF_PREEDIT_TYPE_SUB3:
-                underlines.append(CompositionUnderline(preeditAttr->start_index, preeditAttr->end_index, Color(0, 0, 0), Color(255, 255, 255), false));
-                break;
-            case ECORE_IMF_PREEDIT_TYPE_SUB4:
-                underlines.append(CompositionUnderline(preeditAttr->start_index, preeditAttr->end_index, Color(0, 0, 0), Color(46, 168, 255), false));
-                break;
-            case ECORE_IMF_PREEDIT_TYPE_SUB5:
-                underlines.append(CompositionUnderline(preeditAttr->start_index, preeditAttr->end_index, Color(0, 0, 0), Color(153, 98, 195), false));
-                break;
-            case ECORE_IMF_PREEDIT_TYPE_SUB6:
-                underlines.append(CompositionUnderline(preeditAttr->start_index, preeditAttr->end_index, Color(0, 0, 0), Color(118, 222, 55), false));
-                break;
-            case ECORE_IMF_PREEDIT_TYPE_SUB7:
-                underlines.append(CompositionUnderline(preeditAttr->start_index, preeditAttr->end_index, Color(0, 0, 0), Color(153, 153, 153), false));
-                break;
-            }
-        }
-        EINA_LIST_FREE(preeditAttrs, item)
-            free(item);
-
-    } else
-        underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
-#else
-    underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
-#endif
-
-    m_viewImpl->page()->setComposition(preeditString, underlines, cursorPosition);
-}
-#endif // #if ENABLE(TIZEN_ISF_PORT)
-
 void PageClientImpl::updateFormNavigation(int length, int offset)
 {
     notImplemented();
index b280a5c..213f78a 100755 (executable)
@@ -121,17 +121,6 @@ public:
     void textChangeInTextField(const String& name, const String& value);
 #endif
 
-#if ENABLE(TIZEN_ISF_PORT)
-    void setInputMethodState(bool, const String&, const String&);
-#else
-    void setInputMethodState(bool active);
-#endif
-#if ENABLE(TIZEN_ISF_PORT)
-    void updateCursorOffset(int);
-    void imContextPreeditChanged(Ecore_IMF_Context* context);
-    void imContextCommitted(Ecore_IMF_Context* context, char*);
-#endif
-
     void setViewFocused(bool focused) { m_viewFocused = focused; }
     void setViewWindowActive(bool active) { m_viewWindowActive = active; }
     void updateFormNavigation(int length, int offset);
index 5e10afc..8ea0f1d 100755 (executable)
@@ -947,7 +947,6 @@ void recordingSurfaceSetEnableSet(bool enable);
     WebCore::IntRect getSelectionRect(bool);
     void deleteSurroundingText(int, int);
 
-    void updateCursorOffset(int);
     void didCancelComposition();
 #endif
 
@@ -1291,11 +1290,6 @@ private:
 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
     void textChangeInTextField(const String&, const String&);
 #endif
-#if ENABLE(TIZEN_ISF_PORT)
-    void setInputMethodState(bool, const String&, const String&);
-#else
-    void setInputMethodState(bool active);
-#endif
 #endif
     void learnWord(const String& word);
     void ignoreWord(const String& word);
index dee14ff..3f18e78 100755 (executable)
@@ -339,8 +339,6 @@ messages -> WebPageProxy {
     TextChangeInTextField(WTF::String name, WTF::String value)
 #endif
 #if ENABLE(TIZEN_ISF_PORT)
-    SetInputMethodState(bool active, WTF::String type, WTF::String value)
-    UpdateCursorOffset(int offset)
     DidCancelComposition()
 #endif
 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
index cbb8209..d7f993d 100755 (executable)
@@ -140,16 +140,121 @@ void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Con
     if (!eventInfo || !inputMethodContext->m_focused)
         return;
 
-    inputMethodContext->m_viewImpl->pageClient->imContextCommitted(inputMethodContext->m_context.get(), static_cast<char*>(eventInfo));
+    inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
+}
+
+#if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
+unsigned getUTF8CharacterIndex(const char* string, unsigned byteIndex)
+{
+    unsigned index = 0;
+    const char* end = string + byteIndex;
+
+    while (*string && string < end) {
+        unsigned offset;
+
+        if ((*string & 0x80) == 0x00)
+            offset = 1;
+        else if ((*string & 0xe0) == 0xc0)
+            offset = 2;
+        else if ((*string & 0xf0) == 0xe0)
+            offset = 3;
+        else if ((*string & 0xf8) == 0xf0)
+            offset = 4;
+        else if ((*string & 0xfc) == 0xf8)
+            offset = 5;
+        else if ((*string & 0xfe) == 0xfc)
+            offset = 6;
+        else
+            offset = 1;
+
+        ++index;
+        while (*string && offset--)
+            ++string;
+    }
+
+    return index;
 }
+#endif
 
-void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context*, void*)
+void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*)
 {
     InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
+
     if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
         return;
 
-    inputMethodContext->m_viewImpl->pageClient->imContextPreeditChanged(inputMethodContext->m_context.get());
+    WebPageProxy* page = inputMethodContext->m_viewImpl->page();
+    if (!page->focusedFrame())
+        return;
+
+    PageClientImpl* pageClient = inputMethodContext->m_viewImpl->pageClient.get();
+    IntRect caretRect;
+    page->getCaretPosition(caretRect);
+    caretRect.scale(pageClient->scaleFactor());
+
+    int viewX, viewY;
+    evas_object_geometry_get(inputMethodContext->m_viewImpl->view(), &viewX, &viewY, 0, 0);
+
+    int x = caretRect.x() - pageClient->scrollPosition().x() + viewX;
+    int y = caretRect.y() - pageClient->scrollPosition().y() + viewY;
+    int w = caretRect.width();
+    int h = caretRect.height();
+    ecore_imf_context_cursor_location_set(context, x, y, w, h);
+
+    char* buffer = 0;
+    Eina_List* preeditAttrs = 0;
+    int cursorPosition = 0;
+
+    ecore_imf_context_preedit_string_with_attributes_get(context, &buffer, &preeditAttrs, &cursorPosition);
+
+    String preeditString = String::fromUTF8(buffer);
+    Vector<CompositionUnderline> underlines;
+
+    if (preeditAttrs) {
+        void* item = 0;
+#if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
+        Eina_List* listIterator = 0;
+        EINA_LIST_FOREACH(preeditAttrs, listIterator, item) {
+            Ecore_IMF_Preedit_Attr* preeditAttr = static_cast<Ecore_IMF_Preedit_Attr*>(item);
+
+            unsigned startIndex = getUTF8CharacterIndex(buffer, preeditAttr->start_index);
+            unsigned endIndex = getUTF8CharacterIndex(buffer, preeditAttr->end_index);
+            switch (preeditAttr->preedit_type) {
+            case ECORE_IMF_PREEDIT_TYPE_SUB1:
+                underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), false));
+                break;
+            case ECORE_IMF_PREEDIT_TYPE_SUB2:
+            case ECORE_IMF_PREEDIT_TYPE_SUB3:
+                underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(255, 255, 255), false));
+                break;
+            case ECORE_IMF_PREEDIT_TYPE_SUB4:
+                underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(46, 168, 255), false));
+                break;
+            case ECORE_IMF_PREEDIT_TYPE_SUB5:
+                underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(153, 98, 195), false));
+                break;
+            case ECORE_IMF_PREEDIT_TYPE_SUB6:
+                underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(118, 222, 55), false));
+                break;
+            case ECORE_IMF_PREEDIT_TYPE_SUB7:
+                underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(153, 153, 153), false));
+                break;
+            default:
+                break;
+            }
+        }
+#endif
+        EINA_LIST_FREE(preeditAttrs, item)
+            free(item);
+    }
+
+    if (underlines.isEmpty())
+        underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
+
+    page->setComposition(preeditString, underlines, cursorPosition);
+
+    if (buffer)
+        free(buffer);
 }
 #else
 void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo)
@@ -213,17 +318,98 @@ void InputMethodContextEfl::handleKeyDownEvent(const Evas_Event_Key_Down* downEv
 
 void InputMethodContextEfl::updateTextInputState()
 {
+#if !ENABLE(TIZEN_ISF_PORT)
     if (!m_context)
         return;
+#endif
 
     const EditorState& editor = m_viewImpl->page()->editorState();
 
     if (editor.isContentEditable) {
+#if ENABLE(TIZEN_ISF_PORT)
+        if (m_context)
+            ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
+#endif
+
         if (m_focused)
             return;
 
+#if ENABLE(TIZEN_ISF_PORT)
+        Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
+        bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
+
+#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
+        if (m_viewImpl->pageClient->isClipboardWindowOpened()) {
+            LOG(ISF, "[FAIL] Clipboard\n");
+            return;
+        }
+#endif
+
+#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
+        if (editor.inputMethodHints == "date") {
+            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATE, editor.surroundingText);
+            return;
+        } else if (editor.inputMethodHints == "datetime") {
+            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATETIME, editor.surroundingText);
+            return;
+        } else if (editor.inputMethodHints == "datetime-local") {
+            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_DATETIMELOCAL, editor.surroundingText);
+            return;
+        } else if (editor.inputMethodHints == "month") {
+            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_MONTH, editor.surroundingText);
+            return;
+        } else if (editor.inputMethodHints == "time") {
+            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TIME, editor.surroundingText);
+            return;
+        } else if (editor.inputMethodHints == "week") {
+            ewkViewInputPickerRequest(m_viewImpl->view(), EWK_INPUT_TYPE_WEEK, editor.surroundingText);
+            return;
+        }
+
+#if ENABLE(TIZEN_DATALIST_ELEMENT)
+        Vector<String> optionList = m_viewImpl->page()->getFocusedInputElementDataList();
+        if (optionList.size() > 0) {
+            if (editor.inputMethodHints == "tel")
+                ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TELEPHONE, optionList);
+            else if (editor.inputMethodHints == "number")
+                ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_NUMBER, optionList);
+            else if (editor.inputMethodHints == "email")
+                ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_EMAIL, optionList);
+            else if (editor.inputMethodHints == "url")
+                ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_URL, optionList);
+            else
+                ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TEXT, optionList);
+
+            return;
+        }
+#endif
+#endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
+
+        bool hasFocus = evas_object_focus_get(m_viewImpl->view());
+
+        if (!defaultKeypadEnabled) {
+            if (hasFocus) {
+                Eina_Rectangle dummyRectForCustomKeypadCallback;
+                memset(&dummyRectForCustomKeypadCallback, 0, sizeof(Eina_Rectangle));
+                evas_object_smart_callback_call(m_viewImpl->view(), "inputmethod,changed", &dummyRectForCustomKeypadCallback);
+            }
+            return;
+        }
+
+        setType(editor.inputMethodHints);
+
+        if (!hasFocus)
+            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());
+#endif
         m_focused = true;
     } else {
         if (!m_focused)
@@ -235,6 +421,10 @@ void InputMethodContextEfl::updateTextInputState()
         m_focused = false;
         ecore_imf_context_reset(m_context.get());
         ecore_imf_context_focus_out(m_context.get());
+#if ENABLE(TIZEN_ISF_PORT)
+        ecore_imf_context_input_panel_hide(m_context.get());
+        revertIMFContext();
+#endif
     }
 }
 
@@ -274,9 +464,8 @@ void InputMethodContextEfl::setType(const String& type)
         m_context = m_contextList.take(layout);
     } else if (!m_context || ecore_imf_context_input_panel_layout_get(m_context.get()) != layout) {
         OwnPtr<Ecore_IMF_Context> context = createIMFContext(evas_object_evas_get(m_viewImpl->view()));
-        if (!m_context)
-            return;
-        revertIMFContext();
+        if (m_context)
+            revertIMFContext();
         m_context = context.release();
         initializeIMFContext(m_context.get(), layout);
     }
@@ -292,33 +481,6 @@ void InputMethodContextEfl::setType(const String& type)
         ecore_imf_context_autocapital_type_set(m_context.get(), ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
 }
 
-void InputMethodContextEfl::showIMFContext()
-{
-    if (!m_context)
-        return;
-
-    ecore_imf_context_focus_in(m_context.get());
-    ecore_imf_context_input_panel_show(m_context.get());
-    ecore_imf_context_cursor_position_set(m_context.get(), m_viewImpl->page()->getCursorOffset());
-}
-
-void InputMethodContextEfl::setIMFContextCursorPosition(int position)
-{
-    if (!m_context)
-        return;
-
-    ecore_imf_context_cursor_position_set(m_context.get(), position);
-}
-
-void InputMethodContextEfl::setIMData(const String& data)
-{
-    if (!m_context)
-        return;
-
-    CString utf8Data = data.utf8();
-    ecore_imf_context_input_panel_imdata_set(m_context.get(), utf8Data.data(), utf8Data.length());
-}
-
 bool InputMethodContextEfl::isShow()
 {
     return (m_context && m_focused && ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE);
index 9963603..f36e852 100755 (executable)
@@ -50,9 +50,6 @@ public:
 
 #if ENABLE(TIZEN_ISF_PORT)
     void setType(const String&);
-    void showIMFContext();
-    void setIMFContextCursorPosition(int);
-    void setIMData(const String&);
     bool isShow();
     Ecore_IMF_Autocapital_Type autoCapitalType();
     void onFocusIn();
index 4cda70d..3941c5b 100755 (executable)
@@ -238,19 +238,6 @@ void WebPageProxy::textChangeInTextField(const String& name, const String& value
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
-void WebPageProxy::setInputMethodState(bool active, const String& type, const String& value)
-{
-    static_cast<PageClientImpl*>(m_pageClient)->setInputMethodState(active, type, value);
-}
-#else
-void WebPageProxy::setInputMethodState(bool active)
-{
-    //FIXME : it should be contributable
-    static_cast<PageClientImpl*>(m_pageClient)->setInputMethodState(active);
-}
-#endif
-
-#if ENABLE(TIZEN_ISF_PORT)
 int WebPageProxy::getCursorOffset()
 {
     if (!isValid())
@@ -284,11 +271,6 @@ void WebPageProxy::deleteSurroundingText(int offset, int count)
     process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
 }
 
-void WebPageProxy::updateCursorOffset(int offset)
-{
-    static_cast<PageClientImpl*>(m_pageClient)->updateCursorOffset(offset);
-}
-
 void WebPageProxy::didCancelComposition()
 {
     m_didCancelCompositionFromWebProcess = true;
@@ -355,9 +337,9 @@ void WebPageProxy::processPluginCustomRequest(const String& request, const Strin
         if (String("show") == msg)
             active = true;
 #if ENABLE(TIZEN_ISF_PORT)
-        setInputMethodState(active, "plugin", String());
-#else
-        setInputMethodState(active);
+        m_editorState = EditorState();
+        m_editorState.isContentEditable = active;
+        m_pageClient->updateTextInputState();
 #endif
     }
 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
index 48fc39f..0f3c11f 100755 (executable)
@@ -470,25 +470,7 @@ void WebEditorClient::willSetInputMethodState()
 
 void WebEditorClient::setInputMethodState(bool active)
 {
-#if ENABLE(TIZEN_ISF_PORT)
-    String type;
-    String value;
-    if (active) {
-        Frame* frame = m_page->corePage()->focusController()->focusedFrame();
-        if (!frame || !frame->document())
-            return;
-
-        HTMLTextFormControlElement* formControl = toTextFormControl(frame->document()->focusedNode());
-        if (formControl) {
-            type = formControl->type();
-            value = formControl->value();
-        }
-    }
-
-    m_page->send(Messages::WebPageProxy::SetInputMethodState(active, type, value));
-#else
-    m_page->send(Messages::WebPageProxy::SetInputMethodState(active));
-#endif
+    notImplemented();
 }
 
 void WebEditorClient::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>)
index 9132021..32f50ce 100755 (executable)
@@ -52,21 +52,7 @@ namespace WebKit {
 void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
 {
     if (m_page->handleEditingKeyboardEvent(event))
-#if ENABLE(TIZEN_ISF_PORT)
-    {
-        if ((event->keyCode() == VK_BACK) || (event->keyCode() == VK_RETURN)) {
-            if (event->keyCode() == VK_BACK) {
-                Frame* frame = m_page->corePage()->focusController()->focusedOrMainFrame();
-                if (frame)
-                    frame->editor()->cancelComposition();
-            }
-            m_page->updateCursorOffset();
-        }
-        event->setDefaultHandled();
-    }
-#else
         event->setDefaultHandled();
-#endif
 }
 
 void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
index de4fc69..3921a5e 100755 (executable)
@@ -563,8 +563,23 @@ EditorState WebPage::editorState() const
     result.hasComposition = frame->editor()->hasComposition();
     result.shouldIgnoreCompositionSelectionChange = frame->editor()->ignoreCompositionSelectionChange();
 
-#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+#if ENABLE(TIZEN_ISF_PORT)
     Element* selectionRoot = frame->selection()->rootEditableElement();
+    if (result.isContentEditable) {
+        HTMLTextFormControlElement* formControl = toTextFormControl(selectionRoot);
+        if (formControl) {
+            result.inputMethodHints = formControl->type();
+            result.surroundingText = formControl->value();
+        }
+
+        Position base = frame->selection()->base();
+        Node* baseNode = base.containerNode();
+        if (baseNode)
+            result.cursorPosition = baseNode->isTextNode() ? base.offsetInContainerNode() : 0;
+    }
+#endif
+
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
     if (selectionRoot)
         result.editorRect = frame->view()->contentsToWindow(selectionRoot->getPixelSnappedRect());
 #endif
index 1798843..cb8611a 100755 (executable)
@@ -234,7 +234,6 @@ public:
     void getCaretPosition(WebCore::IntRect&);
 #endif
 #if ENABLE(TIZEN_ISF_PORT)
-    void updateCursorOffset();
     void didCancelComposition(WebCore::Node*);
 
     void getCursorOffset(int&);
index 2e64d7f..0766b71 100755 (executable)
@@ -278,10 +278,6 @@ void WebPage::confirmComposition(const String& compositionString)
         return;
 
     targetFrame->editor()->confirmComposition(compositionString);
-
-#if ENABLE(TIZEN_ISF_PORT)
-    updateCursorOffset();
-#endif
 }
 
 void WebPage::setComposition(const String& compositionString, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition)
@@ -323,7 +319,6 @@ void WebPage::setComposition(const String& compositionString, const Vector<WebCo
 
 #if ENABLE(TIZEN_ISF_PORT)
     m_isSettingComposition = false;
-    updateCursorOffset();
 #endif
 }
 
@@ -640,13 +635,6 @@ void WebPage::getCaretPosition(IntRect& rect)
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
-void WebPage::updateCursorOffset()
-{
-    int offset;
-    getCursorOffset(offset);
-    send(Messages::WebPageProxy::UpdateCursorOffset(offset));
-}
-
 void WebPage::didCancelComposition(Node* valueChangedNode)
 {
     if (m_isSettingComposition)
@@ -742,8 +730,6 @@ void WebPage::setFocusedInputElementValue(const String& inputValue)
 
     inputElement->toNode()->dispatchFocusEvent(0);
     inputElement->setValue(inputValue, DispatchChangeEvent);
-
-    updateCursorOffset();
 }
 
 void  WebPage::getFocusedInputElementValue(String& inputValue)