2 Copyright (C) 2011 Samsung Electronics
3 Copyright (C) 2012 Intel Corporation. All rights reserved.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 #include "InputMethodContextEfl.h"
24 #include "EwkViewImpl.h"
25 #include "WebPageProxy.h"
26 #include <Ecore_Evas.h>
27 #include <Ecore_IMF_Evas.h>
29 using namespace WebCore;
33 #if ENABLE(TIZEN_ISF_PORT)
34 const unsigned InputMethodContextEfl::maxContextSize = 10;
37 InputMethodContextEfl::InputMethodContextEfl(EwkViewImpl* viewImpl, PassOwnPtr<Ecore_IMF_Context> context)
38 : m_viewImpl(viewImpl)
41 #if ENABLE(TIZEN_ISF_PORT)
43 , m_useInputMethod(false)
44 , m_state(ECORE_IMF_INPUT_PANEL_STATE_HIDE)
45 , m_inputPickerType(-1)
48 #if !ENABLE(TIZEN_ISF_PORT)
50 ecore_imf_context_event_callback_add(m_context.get(), ECORE_IMF_CALLBACK_PREEDIT_CHANGED, onIMFPreeditSequenceChanged, this);
51 ecore_imf_context_event_callback_add(m_context.get(), ECORE_IMF_CALLBACK_COMMIT, onIMFInputSequenceComplete, this);
55 InputMethodContextEfl::~InputMethodContextEfl()
59 #if ENABLE(TIZEN_ISF_PORT)
60 void InputMethodContextEfl::onIMFInputPanelStateChanged(void* data, Ecore_IMF_Context*, int state)
62 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
64 inputMethodContext->setState(state);
66 if (state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
67 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
68 if (inputMethodContext->m_viewImpl->pageClient->isClipboardWindowOpened())
69 inputMethodContext->m_viewImpl->pageClient->closeClipboardWindow();
71 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,ime,closed", 0);
72 } else if (state == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
73 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,ime,opened", 0);
76 void InputMethodContextEfl::onIMFInputPanelGeometryChanged(void* data, Ecore_IMF_Context*, int)
78 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
79 if (!inputMethodContext->m_context)
83 ecore_imf_context_input_panel_geometry_get(inputMethodContext->m_context.get(), &rect.x, &rect.y, &rect.w, &rect.h);
84 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "inputmethod,changed", &rect);
86 inputMethodContext->setIMERect(IntRect(rect.x, rect.y, rect.w, rect.h));
89 void InputMethodContextEfl::onIMFCandidatePanelStateChanged(void* data, Ecore_IMF_Context*, int state)
91 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
93 if (state == ECORE_IMF_CANDIDATE_PANEL_SHOW)
94 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,candidate,opened", 0);
96 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,candidate,closed", 0);
99 void InputMethodContextEfl::onIMFCandidatePanelGeometryChanged(void* data, Ecore_IMF_Context*, int)
101 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
102 if (!inputMethodContext->m_context)
106 ecore_imf_context_candidate_panel_geometry_get(inputMethodContext->m_context.get(), &rect.x, &rect.y, &rect.w, &rect.h);
107 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,candidate,changed", &rect);
110 Eina_Bool InputMethodContextEfl::onIMFRetrieveSurrounding(void* data, Ecore_IMF_Context*, char** text, int* offset)
112 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
113 if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused || (!text && !offset))
116 String surroundingText;
118 inputMethodContext->m_viewImpl->page()->getSurroundingTextAndCursorOffset(surroundingText, cursorOffset);
121 CString utf8Text(surroundingText.utf8());
122 size_t length = utf8Text.length();
124 *text = static_cast<char*>(malloc((length + 1) * sizeof(char)));
129 strncpy(*text, utf8Text.data(), length);
134 *offset = cursorOffset;
139 void InputMethodContextEfl::onIMFDeleteSurrounding(void* data, Ecore_IMF_Context*, void* eventInfo)
141 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
142 if (!eventInfo || !inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
145 Ecore_IMF_Event_Delete_Surrounding* event = static_cast<Ecore_IMF_Event_Delete_Surrounding*>(eventInfo);
146 inputMethodContext->m_viewImpl->page()->deleteSurroundingText(event->offset, event->n_chars);
149 void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo)
151 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
152 if (!eventInfo || !inputMethodContext->m_focused)
155 inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
158 #if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
159 unsigned getUTF8CharacterIndex(const char* string, unsigned byteIndex)
162 const char* end = string + byteIndex;
164 while (*string && string < end) {
167 if ((*string & 0x80) == 0x00)
169 else if ((*string & 0xe0) == 0xc0)
171 else if ((*string & 0xf0) == 0xe0)
173 else if ((*string & 0xf8) == 0xf0)
175 else if ((*string & 0xfc) == 0xf8)
177 else if ((*string & 0xfe) == 0xfc)
183 while (*string && offset--)
191 void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*)
193 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
195 if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
198 WebPageProxy* page = inputMethodContext->m_viewImpl->page();
199 if (!page->focusedFrame())
202 PageClientImpl* pageClient = inputMethodContext->m_viewImpl->pageClient.get();
204 page->getCaretPosition(caretRect);
205 caretRect.scale(pageClient->scaleFactor());
208 evas_object_geometry_get(inputMethodContext->m_viewImpl->view(), &viewX, &viewY, 0, 0);
210 int x = caretRect.x() - pageClient->scrollPosition().x() + viewX;
211 int y = caretRect.y() - pageClient->scrollPosition().y() + viewY;
212 int w = caretRect.width();
213 int h = caretRect.height();
214 ecore_imf_context_cursor_location_set(context, x, y, w, h);
217 Eina_List* preeditAttrs = 0;
218 int cursorPosition = 0;
220 ecore_imf_context_preedit_string_with_attributes_get(context, &buffer, &preeditAttrs, &cursorPosition);
222 String preeditString = String::fromUTF8(buffer);
223 Vector<CompositionUnderline> underlines;
227 #if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
228 Eina_List* listIterator = 0;
229 EINA_LIST_FOREACH(preeditAttrs, listIterator, item) {
230 Ecore_IMF_Preedit_Attr* preeditAttr = static_cast<Ecore_IMF_Preedit_Attr*>(item);
232 unsigned startIndex = getUTF8CharacterIndex(buffer, preeditAttr->start_index);
233 unsigned endIndex = getUTF8CharacterIndex(buffer, preeditAttr->end_index);
234 switch (preeditAttr->preedit_type) {
235 case ECORE_IMF_PREEDIT_TYPE_SUB1:
236 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), false));
238 case ECORE_IMF_PREEDIT_TYPE_SUB2:
239 case ECORE_IMF_PREEDIT_TYPE_SUB3:
240 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(255, 255, 255), false));
242 case ECORE_IMF_PREEDIT_TYPE_SUB4:
243 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(46, 168, 255), false));
245 case ECORE_IMF_PREEDIT_TYPE_SUB5:
246 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(153, 98, 195), false));
248 case ECORE_IMF_PREEDIT_TYPE_SUB6:
249 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(118, 222, 55), false));
251 case ECORE_IMF_PREEDIT_TYPE_SUB7:
252 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(153, 153, 153), false));
259 EINA_LIST_FREE(preeditAttrs, item)
263 if (underlines.isEmpty())
264 underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
266 page->setComposition(preeditString, underlines, cursorPosition);
272 void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo)
274 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
275 if (!eventInfo || !inputMethodContext->m_focused)
278 inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
281 void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*)
283 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
285 if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
289 ecore_imf_context_preedit_string_get(context, &buffer, 0);
293 String preeditString = String::fromUTF8(buffer);
295 Vector<CompositionUnderline> underlines;
296 underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
297 inputMethodContext->m_viewImpl->page()->setComposition(preeditString, underlines, 0);
301 PassOwnPtr<Ecore_IMF_Context> InputMethodContextEfl::createIMFContext(Evas* canvas)
303 const char* defaultContextID = ecore_imf_context_default_id_get();
304 if (!defaultContextID)
307 OwnPtr<Ecore_IMF_Context> imfContext = adoptPtr(ecore_imf_context_add(defaultContextID));
311 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(canvas);
312 ecore_imf_context_client_window_set(imfContext.get(), reinterpret_cast<void*>(ecore_evas_window_get(ecoreEvas)));
313 ecore_imf_context_client_canvas_set(imfContext.get(), canvas);
315 return imfContext.release();
318 void InputMethodContextEfl::handleMouseUpEvent(const Evas_Event_Mouse_Up*)
320 ecore_imf_context_reset(m_context.get());
323 void InputMethodContextEfl::handleKeyDownEvent(const Evas_Event_Key_Down* downEvent, bool* isFiltered)
325 #if ENABLE(TIZEN_ISF_PORT)
330 Ecore_IMF_Event inputMethodEvent;
331 ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &inputMethodEvent.key_down);
333 *isFiltered = ecore_imf_context_filter_event(m_context.get(), ECORE_IMF_EVENT_KEY_DOWN, &inputMethodEvent);
336 #if ENABLE(TIZEN_ISF_PORT)
337 void InputMethodContextEfl::updateTextInputState()
339 const EditorState& editor = m_viewImpl->page()->editorState();
340 if (editor.shouldIgnoreCompositionSelectionChange || editor.updateEditorRectOnly)
343 if (editor.isContentEditable && m_useInputMethod)
344 showIMFContext(editor);
349 ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
352 void InputMethodContextEfl::updateTextInputState()
357 const EditorState& editor = m_viewImpl->page()->editorState();
359 if (editor.isContentEditable) {
363 ecore_imf_context_reset(m_context.get());
364 ecore_imf_context_focus_in(m_context.get());
370 if (editor.hasComposition)
371 m_viewImpl->page()->cancelComposition();
374 ecore_imf_context_reset(m_context.get());
375 ecore_imf_context_focus_out(m_context.get());
380 #if ENABLE(TIZEN_ISF_PORT)
381 void InputMethodContextEfl::initializeIMFContext(Ecore_IMF_Context* context, Ecore_IMF_Input_Panel_Layout layout, int layoutVariation, Ecore_IMF_Input_Panel_Return_Key_Type returnKeyType)
383 ecore_imf_context_input_panel_enabled_set(context, false);
384 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, onIMFInputPanelStateChanged, this);
385 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, onIMFInputPanelGeometryChanged, this);
386 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, onIMFCandidatePanelStateChanged, this);
387 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, onIMFCandidatePanelGeometryChanged, this);
388 ecore_imf_context_retrieve_surrounding_callback_set(context, onIMFRetrieveSurrounding, this);
389 ecore_imf_context_event_callback_add(context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, onIMFDeleteSurrounding, this);
390 ecore_imf_context_event_callback_add(context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, onIMFPreeditSequenceChanged, this);
391 ecore_imf_context_event_callback_add(context, ECORE_IMF_CALLBACK_COMMIT, onIMFInputSequenceComplete, this);
393 ecore_imf_context_input_panel_layout_set(context, layout);
394 if (layoutVariation >= 0)
395 ecore_imf_context_input_panel_layout_variation_set(context, layoutVariation);
396 ecore_imf_context_input_panel_return_key_type_set(context, returnKeyType);
399 void InputMethodContextEfl::setUseInputMethod(bool use)
401 m_useInputMethod = use;
402 updateTextInputState();
405 PassOwnPtr<Ecore_IMF_Context> InputMethodContextEfl::takeContext(uintptr_t contextID)
407 size_t i = m_contextList.size();
410 if (m_contextList[i].first == contextID) {
411 PassOwnPtr<Ecore_IMF_Context> context = m_contextList[i].second.release();
412 m_contextList.remove(i);
417 return PassOwnPtr<Ecore_IMF_Context>();
420 void InputMethodContextEfl::setIMFContext(const EditorState& editor)
422 const String& type = editor.inputMethodHints;
423 Ecore_IMF_Input_Panel_Layout layout;
424 int layoutVariation = -1;
425 Ecore_IMF_Input_Panel_Return_Key_Type returnKeyType = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
427 if (type == "number") {
428 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
429 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_NORMAL;
430 } else if (type == "signedNumber") {
431 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
432 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED;
433 } else if (type == "decimalNumber") {
434 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
435 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_DECIMAL;
436 } else if (type == "signedDecimalNumber") {
437 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
438 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL;
439 } else if (type == "email")
440 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
441 else if (type == "url")
442 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
443 else if (type == "tel")
444 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
445 else if (type == "password")
446 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD;
448 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
449 if (type == "search")
450 returnKeyType = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH;
453 OwnPtr<Ecore_IMF_Context> context;
454 if (m_contextID == editor.inputMethodContextID)
455 context = m_context.release();
457 context = takeContext(editor.inputMethodContextID);
462 context = createIMFContext(evas_object_evas_get(m_viewImpl->view()));
465 initializeIMFContext(context.get(), layout, layoutVariation, returnKeyType);
468 m_context = context.release();
469 m_contextID = editor.inputMethodContextID;
471 if (type == "password" || type == "plugin")
472 ecore_imf_context_prediction_allow_set(m_context.get(), false);
474 ecore_imf_context_prediction_allow_set(m_context.get(), true);
476 if (type.isEmpty() || type == "textarea")
477 ecore_imf_context_autocapital_type_set(m_context.get(), ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE);
479 ecore_imf_context_autocapital_type_set(m_context.get(), ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
482 bool InputMethodContextEfl::isShow()
484 return (m_context && m_focused && ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE);
487 Ecore_IMF_Autocapital_Type InputMethodContextEfl::autoCapitalType()
489 return (m_context ? ecore_imf_context_autocapital_type_get(m_context.get()) : ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
492 void InputMethodContextEfl::onFocusIn()
494 if (m_inputPickerType >= 0) {
495 showInputPicker(m_viewImpl->page()->editorState());
499 if (!m_context || !m_focused)
502 ecore_imf_context_focus_in(m_context.get());
503 ecore_imf_context_input_panel_show(m_context.get());
506 void InputMethodContextEfl::onFocusOut()
508 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
509 if (m_state != ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
510 if (m_viewImpl->pageClient->isClipboardWindowOpened())
511 m_viewImpl->pageClient->closeClipboardWindow();
515 if (!m_context || !m_focused)
518 ecore_imf_context_input_panel_hide(m_context.get());
519 ecore_imf_context_focus_out(m_context.get());
522 void InputMethodContextEfl::revertIMFContext()
527 if (m_contextList.size() >= maxContextSize)
528 m_contextList.remove(0);
530 PassOwnPtr<Ecore_IMF_Context> imfContext = m_context.release();
531 m_contextList.append(std::make_pair(m_contextID, imfContext));
535 void InputMethodContextEfl::resetIMFContext()
540 ecore_imf_context_reset(m_context.get());
543 void InputMethodContextEfl::showIMFContext(const EditorState& editor)
545 if (isShow() && m_contextID == editor.inputMethodContextID)
548 Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
549 bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
551 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
552 if (editor.inputMethodHints == "date")
553 m_inputPickerType = EWK_INPUT_TYPE_DATE;
554 else if (editor.inputMethodHints == "datetime")
555 m_inputPickerType = EWK_INPUT_TYPE_DATETIME;
556 else if (editor.inputMethodHints == "datetime-local")
557 m_inputPickerType = EWK_INPUT_TYPE_DATETIMELOCAL;
558 else if (editor.inputMethodHints == "month")
559 m_inputPickerType = EWK_INPUT_TYPE_MONTH;
560 else if (editor.inputMethodHints == "time")
561 m_inputPickerType = EWK_INPUT_TYPE_TIME;
562 else if (editor.inputMethodHints == "week")
563 m_inputPickerType = EWK_INPUT_TYPE_WEEK;
565 m_inputPickerType = -1;
567 if (m_inputPickerType >= 0) {
568 showInputPicker(editor);
572 #if ENABLE(TIZEN_DATALIST_ELEMENT)
573 Vector<String> optionList = m_viewImpl->page()->getFocusedInputElementDataList();
574 if (optionList.size() > 0) {
575 if (editor.selectionIsRange || !evas_object_focus_get(m_viewImpl->view()))
578 if (editor.inputMethodHints == "tel")
579 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TELEPHONE, optionList);
580 else if (editor.inputMethodHints == "number")
581 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_NUMBER, optionList);
582 else if (editor.inputMethodHints == "email")
583 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_EMAIL, optionList);
584 else if (editor.inputMethodHints == "url")
585 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_URL, optionList);
587 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TEXT, optionList);
592 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
594 bool hasFocus = evas_object_focus_get(m_viewImpl->view());
596 if (!defaultKeypadEnabled) {
598 Eina_Rectangle dummyRectForCustomKeypadCallback;
599 memset(&dummyRectForCustomKeypadCallback, 0, sizeof(Eina_Rectangle));
600 evas_object_smart_callback_call(m_viewImpl->view(), "inputmethod,changed", &dummyRectForCustomKeypadCallback);
605 setIMFContext(editor);
614 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
615 if (m_viewImpl->pageClient->isClipboardWindowOpened())
616 m_viewImpl->pageClient->closeClipboardWindow();
619 ecore_imf_context_reset(m_context.get());
620 ecore_imf_context_focus_in(m_context.get());
621 ecore_imf_context_input_panel_show(m_context.get());
623 // input field zoom for external keyboard
624 ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
629 void InputMethodContextEfl::hideIMFContext()
631 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
632 if (m_state != ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
633 if (m_viewImpl->pageClient->isClipboardWindowOpened())
634 m_viewImpl->pageClient->closeClipboardWindow();
638 m_inputPickerType = -1;
640 if (!m_context || !m_focused)
643 if (m_viewImpl->page()->editorState().hasComposition)
644 m_viewImpl->page()->cancelComposition();
648 if (ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE
649 && evas_object_focus_get(m_viewImpl->view())) {
650 ecore_imf_context_reset(m_context.get());
651 ecore_imf_context_input_panel_hide(m_context.get());
652 ecore_imf_context_focus_out(m_context.get());
658 void InputMethodContextEfl::destroyIMFContextList()
660 m_contextList.clear();
663 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
664 void InputMethodContextEfl::showInputPicker(const EditorState& editorState)
666 if (editorState.selectionIsRange || !evas_object_focus_get(m_viewImpl->view()))
669 ewkViewInputPickerRequest(m_viewImpl->view(), static_cast<Ewk_Input_Type>(m_inputPickerType), editorState.surroundingText);
670 m_inputPickerType = -1;
674 bool InputMethodContextEfl::isIMEPostion(int x, int y)
676 if (m_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
677 return m_imeRect.contains(x, y);
682 void InputMethodContextEfl::removeIMFContext(uintptr_t contextID)
684 if (m_contextID == contextID)
687 takeContext(contextID);