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 value)
78 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
81 ecore_imf_context_input_panel_geometry_get(inputMethodContext->m_context.get(), &rect.x, &rect.y, &rect.w, &rect.h);
82 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "inputmethod,changed", &rect);
84 inputMethodContext->setIMERect(IntRect(rect.x, rect.y, rect.w, rect.h));
87 void InputMethodContextEfl::onIMFCandidatePanelStateChanged(void* data, Ecore_IMF_Context*, int state)
89 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
91 if (state == ECORE_IMF_CANDIDATE_PANEL_SHOW)
92 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,candidate,opened", 0);
94 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,candidate,closed", 0);
97 void InputMethodContextEfl::onIMFCandidatePanelGeometryChanged(void* data, Ecore_IMF_Context*, int)
99 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
102 ecore_imf_context_candidate_panel_geometry_get(inputMethodContext->m_context.get(), &rect.x, &rect.y, &rect.w, &rect.h);
103 evas_object_smart_callback_call(inputMethodContext->m_viewImpl->view(), "editorclient,candidate,changed", &rect);
106 Eina_Bool InputMethodContextEfl::onIMFRetrieveSurrounding(void* data, Ecore_IMF_Context*, char** text, int* offset)
108 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
109 if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused || (!text && !offset))
112 String surroundingText;
114 inputMethodContext->m_viewImpl->page()->getSurroundingTextAndCursorOffset(surroundingText, cursorOffset);
117 CString utf8Text(surroundingText.utf8());
118 size_t length = utf8Text.length();
120 *text = static_cast<char*>(malloc((length + 1) * sizeof(char)));
125 strncpy(*text, utf8Text.data(), length);
130 *offset = cursorOffset;
135 void InputMethodContextEfl::onIMFDeleteSurrounding(void* data, Ecore_IMF_Context*, void* eventInfo)
137 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
138 if (!eventInfo || !inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
141 Ecore_IMF_Event_Delete_Surrounding* event = static_cast<Ecore_IMF_Event_Delete_Surrounding*>(eventInfo);
142 inputMethodContext->m_viewImpl->page()->deleteSurroundingText(event->offset, event->n_chars);
145 void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo)
147 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
148 if (!eventInfo || !inputMethodContext->m_focused)
151 inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
154 #if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
155 unsigned getUTF8CharacterIndex(const char* string, unsigned byteIndex)
158 const char* end = string + byteIndex;
160 while (*string && string < end) {
163 if ((*string & 0x80) == 0x00)
165 else if ((*string & 0xe0) == 0xc0)
167 else if ((*string & 0xf0) == 0xe0)
169 else if ((*string & 0xf8) == 0xf0)
171 else if ((*string & 0xfc) == 0xf8)
173 else if ((*string & 0xfe) == 0xfc)
179 while (*string && offset--)
187 void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*)
189 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
191 if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
194 WebPageProxy* page = inputMethodContext->m_viewImpl->page();
195 if (!page->focusedFrame())
198 PageClientImpl* pageClient = inputMethodContext->m_viewImpl->pageClient.get();
200 page->getCaretPosition(caretRect);
201 caretRect.scale(pageClient->scaleFactor());
204 evas_object_geometry_get(inputMethodContext->m_viewImpl->view(), &viewX, &viewY, 0, 0);
206 int x = caretRect.x() - pageClient->scrollPosition().x() + viewX;
207 int y = caretRect.y() - pageClient->scrollPosition().y() + viewY;
208 int w = caretRect.width();
209 int h = caretRect.height();
210 ecore_imf_context_cursor_location_set(context, x, y, w, h);
213 Eina_List* preeditAttrs = 0;
214 int cursorPosition = 0;
216 ecore_imf_context_preedit_string_with_attributes_get(context, &buffer, &preeditAttrs, &cursorPosition);
218 String preeditString = String::fromUTF8(buffer);
219 Vector<CompositionUnderline> underlines;
223 #if ENABLE(TIZEN_WEBKIT2_SUPPORT_JAPANESE_IME)
224 Eina_List* listIterator = 0;
225 EINA_LIST_FOREACH(preeditAttrs, listIterator, item) {
226 Ecore_IMF_Preedit_Attr* preeditAttr = static_cast<Ecore_IMF_Preedit_Attr*>(item);
228 unsigned startIndex = getUTF8CharacterIndex(buffer, preeditAttr->start_index);
229 unsigned endIndex = getUTF8CharacterIndex(buffer, preeditAttr->end_index);
230 switch (preeditAttr->preedit_type) {
231 case ECORE_IMF_PREEDIT_TYPE_SUB1:
232 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), false));
234 case ECORE_IMF_PREEDIT_TYPE_SUB2:
235 case ECORE_IMF_PREEDIT_TYPE_SUB3:
236 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(255, 255, 255), false));
238 case ECORE_IMF_PREEDIT_TYPE_SUB4:
239 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(46, 168, 255), false));
241 case ECORE_IMF_PREEDIT_TYPE_SUB5:
242 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(153, 98, 195), false));
244 case ECORE_IMF_PREEDIT_TYPE_SUB6:
245 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(118, 222, 55), false));
247 case ECORE_IMF_PREEDIT_TYPE_SUB7:
248 underlines.append(CompositionUnderline(startIndex, endIndex, Color(0, 0, 0), Color(153, 153, 153), false));
255 EINA_LIST_FREE(preeditAttrs, item)
259 if (underlines.isEmpty())
260 underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
262 page->setComposition(preeditString, underlines, cursorPosition);
268 void InputMethodContextEfl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo)
270 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
271 if (!eventInfo || !inputMethodContext->m_focused)
274 inputMethodContext->m_viewImpl->page()->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
277 void InputMethodContextEfl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*)
279 InputMethodContextEfl* inputMethodContext = static_cast<InputMethodContextEfl*>(data);
281 if (!inputMethodContext->m_viewImpl->page()->focusedFrame() || !inputMethodContext->m_focused)
285 ecore_imf_context_preedit_string_get(context, &buffer, 0);
289 String preeditString = String::fromUTF8(buffer);
291 Vector<CompositionUnderline> underlines;
292 underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
293 inputMethodContext->m_viewImpl->page()->setComposition(preeditString, underlines, 0);
297 PassOwnPtr<Ecore_IMF_Context> InputMethodContextEfl::createIMFContext(Evas* canvas)
299 const char* defaultContextID = ecore_imf_context_default_id_get();
300 if (!defaultContextID)
303 OwnPtr<Ecore_IMF_Context> imfContext = adoptPtr(ecore_imf_context_add(defaultContextID));
307 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(canvas);
308 ecore_imf_context_client_window_set(imfContext.get(), reinterpret_cast<void*>(ecore_evas_window_get(ecoreEvas)));
309 ecore_imf_context_client_canvas_set(imfContext.get(), canvas);
311 return imfContext.release();
314 void InputMethodContextEfl::handleMouseUpEvent(const Evas_Event_Mouse_Up*)
316 ecore_imf_context_reset(m_context.get());
319 void InputMethodContextEfl::handleKeyDownEvent(const Evas_Event_Key_Down* downEvent, bool* isFiltered)
321 Ecore_IMF_Event inputMethodEvent;
322 ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &inputMethodEvent.key_down);
324 *isFiltered = ecore_imf_context_filter_event(m_context.get(), ECORE_IMF_EVENT_KEY_DOWN, &inputMethodEvent);
327 #if ENABLE(TIZEN_ISF_PORT)
328 void InputMethodContextEfl::updateTextInputState()
330 const EditorState& editor = m_viewImpl->page()->editorState();
331 if (editor.shouldIgnoreCompositionSelectionChange)
334 if (editor.isContentEditable && m_useInputMethod)
335 showIMFContext(editor);
340 ecore_imf_context_cursor_position_set(m_context.get(), editor.cursorPosition);
343 void InputMethodContextEfl::updateTextInputState()
348 const EditorState& editor = m_viewImpl->page()->editorState();
350 if (editor.isContentEditable) {
354 ecore_imf_context_reset(m_context.get());
355 ecore_imf_context_focus_in(m_context.get());
361 if (editor.hasComposition)
362 m_viewImpl->page()->cancelComposition();
365 ecore_imf_context_reset(m_context.get());
366 ecore_imf_context_focus_out(m_context.get());
371 #if ENABLE(TIZEN_ISF_PORT)
372 void InputMethodContextEfl::initializeIMFContext(Ecore_IMF_Context* context, Ecore_IMF_Input_Panel_Layout layout, int layoutVariation)
374 ecore_imf_context_input_panel_enabled_set(context, false);
375 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, onIMFInputPanelStateChanged, this);
376 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, onIMFInputPanelGeometryChanged, this);
377 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, onIMFCandidatePanelStateChanged, this);
378 ecore_imf_context_input_panel_event_callback_add(context, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, onIMFCandidatePanelGeometryChanged, this);
379 ecore_imf_context_retrieve_surrounding_callback_set(context, onIMFRetrieveSurrounding, this);
380 ecore_imf_context_event_callback_add(context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, onIMFDeleteSurrounding, this);
381 ecore_imf_context_event_callback_add(context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, onIMFPreeditSequenceChanged, this);
382 ecore_imf_context_event_callback_add(context, ECORE_IMF_CALLBACK_COMMIT, onIMFInputSequenceComplete, this);
384 ecore_imf_context_input_panel_layout_set(context, layout);
385 if (layoutVariation >= 0)
386 ecore_imf_context_input_panel_layout_variation_set(context, layoutVariation);
389 void InputMethodContextEfl::setUseInputMethod(bool use)
391 m_useInputMethod = use;
392 updateTextInputState();
395 PassOwnPtr<Ecore_IMF_Context> InputMethodContextEfl::takeContext(uintptr_t contextID)
397 size_t i = m_contextList.size();
400 if (m_contextList[i].first == contextID) {
401 PassOwnPtr<Ecore_IMF_Context> context = m_contextList[i].second.release();
402 m_contextList.remove(i);
407 return PassOwnPtr<Ecore_IMF_Context>();
410 void InputMethodContextEfl::setIMFContext(const EditorState& editor)
412 const String& type = editor.inputMethodHints;
413 Ecore_IMF_Input_Panel_Layout layout;
414 int layoutVariation = -1;
416 if (type == "number") {
417 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
418 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_NORMAL;
419 } else if (type == "signedNumber") {
420 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
421 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED;
422 } else if (type == "decimalNumber") {
423 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
424 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_DECIMAL;
425 } else if (type == "signedDecimalNumber") {
426 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
427 layoutVariation = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL;
428 } else if (type == "email")
429 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
430 else if (type == "url")
431 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
432 else if (type == "tel")
433 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
434 else if (type == "password")
435 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD;
437 layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
439 OwnPtr<Ecore_IMF_Context> context;
440 if (m_contextID == editor.inputMethodContextID)
441 context = m_context.release();
443 context = takeContext(editor.inputMethodContextID);
446 context = createIMFContext(evas_object_evas_get(m_viewImpl->view()));
447 initializeIMFContext(context.get(), layout, layoutVariation);
451 m_context = context.release();
452 m_contextID = editor.inputMethodContextID;
454 if (type == "password" || type == "plugin")
455 ecore_imf_context_prediction_allow_set(m_context.get(), false);
457 ecore_imf_context_prediction_allow_set(m_context.get(), true);
459 if (type.isEmpty() || type == "textarea")
460 ecore_imf_context_autocapital_type_set(m_context.get(), ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE);
462 ecore_imf_context_autocapital_type_set(m_context.get(), ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
465 bool InputMethodContextEfl::isShow()
467 return (m_context && m_focused && ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE);
470 Ecore_IMF_Autocapital_Type InputMethodContextEfl::autoCapitalType()
472 return (m_context ? ecore_imf_context_autocapital_type_get(m_context.get()) : ECORE_IMF_AUTOCAPITAL_TYPE_NONE);
475 void InputMethodContextEfl::onFocusIn()
477 if (m_inputPickerType >= 0) {
478 showInputPicker(m_viewImpl->page()->editorState());
482 if (!m_context || !m_focused)
485 ecore_imf_context_focus_in(m_context.get());
486 ecore_imf_context_input_panel_show(m_context.get());
489 void InputMethodContextEfl::onFocusOut()
491 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
492 if (m_state != ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
493 if (m_viewImpl->pageClient->isClipboardWindowOpened())
494 m_viewImpl->pageClient->closeClipboardWindow();
498 if (!m_context || !m_focused)
501 ecore_imf_context_input_panel_hide(m_context.get());
502 ecore_imf_context_focus_out(m_context.get());
505 void InputMethodContextEfl::revertIMFContext()
510 if (m_contextList.size() >= maxContextSize)
511 m_contextList.remove(0);
513 PassOwnPtr<Ecore_IMF_Context> imfContext = m_context.release();
514 m_contextList.append(std::make_pair(m_contextID, imfContext));
518 void InputMethodContextEfl::resetIMFContext()
523 ecore_imf_context_reset(m_context.get());
526 void InputMethodContextEfl::showIMFContext(const EditorState& editor)
528 if (isShow() && m_contextID == editor.inputMethodContextID)
531 Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
532 bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
534 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
535 if (editor.inputMethodHints == "date")
536 m_inputPickerType = EWK_INPUT_TYPE_DATE;
537 else if (editor.inputMethodHints == "datetime")
538 m_inputPickerType = EWK_INPUT_TYPE_DATETIME;
539 else if (editor.inputMethodHints == "datetime-local")
540 m_inputPickerType = EWK_INPUT_TYPE_DATETIMELOCAL;
541 else if (editor.inputMethodHints == "month")
542 m_inputPickerType = EWK_INPUT_TYPE_MONTH;
543 else if (editor.inputMethodHints == "time")
544 m_inputPickerType = EWK_INPUT_TYPE_TIME;
545 else if (editor.inputMethodHints == "week")
546 m_inputPickerType = EWK_INPUT_TYPE_WEEK;
548 m_inputPickerType = -1;
550 if (m_inputPickerType >= 0) {
551 showInputPicker(editor);
555 #if ENABLE(TIZEN_DATALIST_ELEMENT)
556 Vector<String> optionList = m_viewImpl->page()->getFocusedInputElementDataList();
557 if (optionList.size() > 0) {
558 if (editor.selectionIsRange || !evas_object_focus_get(m_viewImpl->view()))
561 if (editor.inputMethodHints == "tel")
562 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TELEPHONE, optionList);
563 else if (editor.inputMethodHints == "number")
564 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_NUMBER, optionList);
565 else if (editor.inputMethodHints == "email")
566 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_EMAIL, optionList);
567 else if (editor.inputMethodHints == "url")
568 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_URL, optionList);
570 ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TEXT, optionList);
575 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
577 bool hasFocus = evas_object_focus_get(m_viewImpl->view());
579 if (!defaultKeypadEnabled) {
581 Eina_Rectangle dummyRectForCustomKeypadCallback;
582 memset(&dummyRectForCustomKeypadCallback, 0, sizeof(Eina_Rectangle));
583 evas_object_smart_callback_call(m_viewImpl->view(), "inputmethod,changed", &dummyRectForCustomKeypadCallback);
588 setIMFContext(editor);
595 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
596 if (m_viewImpl->pageClient->isClipboardWindowOpened())
597 m_viewImpl->pageClient->closeClipboardWindow();
600 ecore_imf_context_reset(m_context.get());
601 ecore_imf_context_focus_in(m_context.get());
602 ecore_imf_context_input_panel_show(m_context.get());
604 // input field zoom for external keyboard
605 ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
610 void InputMethodContextEfl::hideIMFContext()
612 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
613 if (m_state != ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
614 if (m_viewImpl->pageClient->isClipboardWindowOpened())
615 m_viewImpl->pageClient->closeClipboardWindow();
619 m_inputPickerType = -1;
621 if (!m_context || !m_focused)
624 if (m_viewImpl->page()->editorState().hasComposition)
625 m_viewImpl->page()->cancelComposition();
629 if (ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE
630 && evas_object_focus_get(m_viewImpl->view())) {
631 ecore_imf_context_reset(m_context.get());
632 ecore_imf_context_input_panel_hide(m_context.get());
633 ecore_imf_context_focus_out(m_context.get());
639 void InputMethodContextEfl::destroyIMFContextList()
641 m_contextList.clear();
644 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
645 void InputMethodContextEfl::showInputPicker(const EditorState& editorState)
647 if (editorState.selectionIsRange || !evas_object_focus_get(m_viewImpl->view()))
650 ewkViewInputPickerRequest(m_viewImpl->view(), static_cast<Ewk_Input_Type>(m_inputPickerType), editorState.surroundingText);
651 m_inputPickerType = -1;
655 bool InputMethodContextEfl::isIMEPostion(int x, int y)
657 if (m_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
658 return m_imeRect.contains(x, y);
663 void InputMethodContextEfl::removeIMFContext(uintptr_t contextID)
665 if (m_contextID == contextID)
668 takeContext(contextID);