Show keypad only when tap event is handled.
authorSangYong Park <sy302.park@samsung.com>
Mon, 24 Jun 2013 08:38:32 +0000 (17:38 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 24 Jun 2013 10:03:06 +0000 (10:03 +0000)
[Title] Show keypad only when tap event is handled.
[Issue#] N_SE-41795 WEB-3055
[Problem] Overhead occurs when key event is handled.
[Cause] Request keypad too often.
[Solution] Show keypad only when tap event is handled.

Change-Id: Ib7435abd17aceee73888733d8cf308f6fc5d2f32

Source/WebKit2/Shared/EditorState.cpp
Source/WebKit2/Shared/EditorState.h
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.h
Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 504e92e..5011976 100755 (executable)
@@ -42,6 +42,7 @@ void EditorState::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(hasComposition);
 
 #if ENABLE(TIZEN_ISF_PORT)
+    encoder->encode(isTapEventHandling);
     encoder->encode(inputMethodContextID);
     encoder->encode(inputMethodHints);
     encoder->encode(surroundingText);
@@ -93,6 +94,9 @@ bool EditorState::decode(CoreIPC::ArgumentDecoder* decoder, EditorState& result)
         return false;
 
 #if ENABLE(TIZEN_ISF_PORT)
+    if (!decoder->decode(result.isTapEventHandling))
+        return false;
+
     if (!decoder->decode(result.inputMethodContextID))
         return false;
 
index 389e897..b9c80ee 100755 (executable)
@@ -43,6 +43,7 @@ struct EditorState {
         , isInPasswordField(false)
         , hasComposition(false)
 #if ENABLE(TIZEN_ISF_PORT)
+        , isTapEventHandling(false)
         , inputMethodContextID(0)
         , cursorPosition(0)
 #endif
@@ -66,6 +67,7 @@ struct EditorState {
     bool isInPasswordField;
     bool hasComposition;
 #if ENABLE(TIZEN_ISF_PORT)
+    bool isTapEventHandling;
     uintptr_t inputMethodContextID;
     WTF::String inputMethodHints;
     WTF::String surroundingText;
index 371bedb..f3f8b2c 100755 (executable)
@@ -954,7 +954,6 @@ public:
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
-    void setInputMethodState(bool active);
     int getCursorOffset();
     void getSurroundingTextAndCursorOffset(String&, int&);
     WebCore::IntRect getSelectionRect(bool);
index 8a9066f..d9196ed 100755 (executable)
@@ -342,9 +342,6 @@ messages -> WebPageProxy {
     UpdateSpellingUIWithMisspelledWord(WTF::String misspelledWord)
     UpdateSpellingUIWithGrammarString(WTF::String badGrammarPhrase, WebCore::GrammarDetail grammarDetail)
     GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses)
-#if ENABLE(TIZEN_ISF_PORT)
-    SetInputMethodState(bool active);
-#endif
 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
     TextChangeInTextField(WTF::String name, WTF::String value)
 #endif
index e5a0b88..871ae66 100755 (executable)
@@ -40,7 +40,6 @@ InputMethodContextEfl::InputMethodContextEfl(EwkViewImpl* viewImpl, PassOwnPtr<E
     , m_focused(false)
 #if ENABLE(TIZEN_ISF_PORT)
     , m_contextID(0)
-    , m_useInputMethod(false)
     , m_state(ECORE_IMF_INPUT_PANEL_STATE_HIDE)
     , m_inputPickerType(-1)
 #endif
@@ -340,7 +339,7 @@ void InputMethodContextEfl::updateTextInputState()
     if (editor.shouldIgnoreCompositionSelectionChange || editor.updateEditorRectOnly)
         return;
 
-    if (editor.isContentEditable && m_useInputMethod)
+    if (editor.isContentEditable)
         showIMFContext(editor);
     else
         hideIMFContext();
@@ -396,12 +395,6 @@ void InputMethodContextEfl::initializeIMFContext(Ecore_IMF_Context* context, Eco
     ecore_imf_context_input_panel_return_key_type_set(context, returnKeyType);
 }
 
-void InputMethodContextEfl::setUseInputMethod(bool use)
-{
-    m_useInputMethod = use;
-    updateTextInputState();
-}
-
 PassOwnPtr<Ecore_IMF_Context> InputMethodContextEfl::takeContext(uintptr_t contextID)
 {
     size_t i = m_contextList.size();
@@ -542,7 +535,7 @@ void InputMethodContextEfl::resetIMFContext()
 
 void InputMethodContextEfl::showIMFContext(const EditorState& editor)
 {
-    if (isShow() && m_contextID == editor.inputMethodContextID)
+    if (!editor.isTapEventHandling || (isShow() && m_contextID == editor.inputMethodContextID))
         return;
 
     Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
index c9e9692..61b408d 100755 (executable)
@@ -103,7 +103,6 @@ private:
 
     Vector<std::pair<uintptr_t, OwnPtr<Ecore_IMF_Context> > > m_contextList;
     uintptr_t m_contextID;
-    bool m_useInputMethod;
     int m_state;
     WebCore::IntRect m_imeRect;
     int m_inputPickerType;
index 645ef16..8a9f092 100755 (executable)
@@ -238,15 +238,6 @@ void WebPageProxy::textChangeInTextField(const String& name, const String& value
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
-void WebPageProxy::setInputMethodState(bool active)
-{
-    InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
-    if (!inputMethodContext)
-        return;
-
-    inputMethodContext->setUseInputMethod(active);
-}
-
 int WebPageProxy::getCursorOffset()
 {
     if (!isValid())
index 3c1d933..0f3c11f 100755 (executable)
@@ -470,10 +470,6 @@ void WebEditorClient::willSetInputMethodState()
 
 void WebEditorClient::setInputMethodState(bool active)
 {
-#if ENABLE(TIZEN_ISF_PORT)
-    m_page->send(Messages::WebPageProxy::SetInputMethodState(active));
-    return;
-#endif
     notImplemented();
 }
 
index 38d645b..73c7146 100755 (executable)
@@ -571,6 +571,8 @@ EditorState WebPage::editorState() const
 #endif
 
 #if ENABLE(TIZEN_ISF_PORT)
+    result.isTapEventHandling = (currentEvent() && currentEvent()->type() == WebEvent::GestureSingleTap);
+
     if (!result.shouldIgnoreCompositionSelectionChange && result.isContentEditable) {
         result.inputMethodContextID = reinterpret_cast<uintptr_t>(rootEditableElement);