-#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 ENABLE(TIZEN_SUPPORT_EMOJI)
- if (type.isEmpty() && !value.isEmpty())
- inputMethodContext->setIMData(value);
-#endif
-
- 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)
-