#if ENABLE(TIZEN_ISF_PORT)
encoder->encode(inputMethodHints);
+ encoder->encode(surroundingText);
+ encoder->encode(cursorPosition);
#endif
#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
#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)
, isInPasswordField(false)
, hasComposition(false)
#if ENABLE(TIZEN_ISF_PORT)
- , inputMethodHints(0)
+ , cursorPosition(0)
#endif
#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
, updateEditorRectOnly(false)
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;
}
#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();
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);
WebCore::IntRect getSelectionRect(bool);
void deleteSurroundingText(int, int);
- void updateCursorOffset(int);
void didCancelComposition();
#endif
#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);
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)
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)
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)
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
}
}
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);
}
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);
#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();
#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())
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;
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)
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>)
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)
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
void getCaretPosition(WebCore::IntRect&);
#endif
#if ENABLE(TIZEN_ISF_PORT)
- void updateCursorOffset();
void didCancelComposition(WebCore::Node*);
void getCursorOffset(int&);
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)
#if ENABLE(TIZEN_ISF_PORT)
m_isSettingComposition = false;
- updateCursorOffset();
#endif
}
#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)
inputElement->toNode()->dispatchFocusEvent(0);
inputElement->setValue(inputValue, DispatchChangeEvent);
-
- updateCursorOffset();
}
void WebPage::getFocusedInputElementValue(String& inputValue)