{
const EditorState& editor = m_viewImpl->page()->editorState();
- if (m_focused)
- ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
-
- if (editor.shouldIgnoreCompositionSelectionChange)
- return;
-
- if (editor.isContentEditable && m_useInputMethod) {
- if (m_state != ECORE_IMF_INPUT_PANEL_STATE_HIDE)
- return;
-
- Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
- bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
-
-#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
- if (editor.inputMethodHints == "date") {
- showInputPicker(EWK_INPUT_TYPE_DATE, editor);
- return;
- } else if (editor.inputMethodHints == "datetime") {
- showInputPicker(EWK_INPUT_TYPE_DATETIME, editor);
- return;
- } else if (editor.inputMethodHints == "datetime-local") {
- showInputPicker(EWK_INPUT_TYPE_DATETIMELOCAL, editor);
- return;
- } else if (editor.inputMethodHints == "month") {
- showInputPicker(EWK_INPUT_TYPE_MONTH, editor);
- return;
- } else if (editor.inputMethodHints == "time") {
- showInputPicker(EWK_INPUT_TYPE_TIME, editor);
- return;
- } else if (editor.inputMethodHints == "week") {
- 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")
- 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)
-
-#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
- if (m_viewImpl->pageClient->isClipboardWindowOpened()) {
- LOG(ISF, "[FAIL] Clipboard\n");
- return;
- }
-#endif
-
- 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) {
- m_focused = true;
- return;
- }
-
- ecore_imf_context_reset(m_context.get());
- ecore_imf_context_focus_in(m_context.get());
- ecore_imf_context_input_panel_show(m_context.get());
+ if (!editor.shouldIgnoreCompositionSelectionChange) {
+ if (editor.isContentEditable && m_useInputMethod)
+ showIMFContext(editor);
+ else
+ hideIMFContext();
+ }
- // input field zoom for external keyboard
- ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
- m_focused = true;
- } else
- hideIMFContext();
+ if (m_context)
+ ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
}
#else
void InputMethodContextEfl::updateTextInputState()
updateTextInputState();
}
-void InputMethodContextEfl::setType(const String& type)
+Ecore_IMF_Input_Panel_Layout InputMethodContextEfl::layoutType(const String& type)
{
- Ecore_IMF_Input_Panel_Layout layout;
if (type == "number")
- layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER;
+ return ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER;
else if (type == "email")
- layout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
+ return ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
else if (type == "url")
- layout = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
+ return ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
else if (type == "tel")
- layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
+ return ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
else if (type == "password")
- layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD;
+ return ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD;
else
- layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
+ return ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
+}
+void InputMethodContextEfl::setIMFContext(Ecore_IMF_Input_Panel_Layout layout, const String& type)
+{
if (m_contextList.contains(layout)) {
revertIMFContext();
m_context = m_contextList.take(layout);
ecore_imf_context_reset(m_context.get());
}
+void InputMethodContextEfl::showIMFContext(const EditorState& editor)
+{
+ Ecore_IMF_Input_Panel_Layout layout = layoutType(editor.inputMethodHints);
+
+ if (m_context && m_state != ECORE_IMF_INPUT_PANEL_STATE_HIDE && layout == ecore_imf_context_input_panel_layout_get(m_context.get()))
+ return;
+
+ Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
+ bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
+
+#if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
+ if (editor.inputMethodHints == "date") {
+ showInputPicker(EWK_INPUT_TYPE_DATE, editor);
+ return;
+ } else if (editor.inputMethodHints == "datetime") {
+ showInputPicker(EWK_INPUT_TYPE_DATETIME, editor);
+ return;
+ } else if (editor.inputMethodHints == "datetime-local") {
+ showInputPicker(EWK_INPUT_TYPE_DATETIMELOCAL, editor);
+ return;
+ } else if (editor.inputMethodHints == "month") {
+ showInputPicker(EWK_INPUT_TYPE_MONTH, editor);
+ return;
+ } else if (editor.inputMethodHints == "time") {
+ showInputPicker(EWK_INPUT_TYPE_TIME, editor);
+ return;
+ } else if (editor.inputMethodHints == "week") {
+ 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")
+ 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)
+
+#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
+ if (m_viewImpl->pageClient->isClipboardWindowOpened()) {
+ LOG(ISF, "[FAIL] Clipboard\n");
+ return;
+ }
+#endif
+
+ 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;
+ }
+
+ setIMFContext(layout, editor.inputMethodHints);
+
+ if (!hasFocus) {
+ m_focused = true;
+ return;
+ }
+
+ ecore_imf_context_reset(m_context.get());
+ ecore_imf_context_focus_in(m_context.get());
+ 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);
+
+ m_focused = true;
+}
+
void InputMethodContextEfl::hideIMFContext()
{
if (!m_context || !m_focused)