Add settings api for using keypad without user action
authorSangYong Park <sy302.park@samsung.com>
Tue, 2 Jul 2013 02:12:09 +0000 (11:12 +0900)
committerSangYong Park <sy302.park@samsung.com>
Mon, 8 Jul 2013 10:19:35 +0000 (19:19 +0900)
[Title] Add settings api for using keypad without user action
[Issue#] N/A
[Problem] Keypad behavior is different for each app.
[Cause] Settings api was not available.
[Solution] Add settings api for using keypad without user action

Change-Id: Iecbaa5ab8efd881c01e1d8f8f8f6f4f3404f24b4

Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
Source/WebKit2/UIProcess/API/efl/ewk_settings.h [changed mode: 0644->0755]
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp

index 4bdd4e5..65942a4 100755 (executable)
@@ -206,6 +206,7 @@ namespace WebKit {
     macro(LoadRemoteImages, loadRemoteImages, Bool, bool, true) \
     macro(LinkEffectEnabled, linkEffectEnabled, Bool, bool, true) \
     macro(EnableDefaultKeypad, defaultKeypadEnabled, Bool, bool, true) \
+    macro(UsesKeypadWithoutUserAction, usesKeypadWithoutUserAction, Bool, bool, true) \
     macro(InteractiveFormValidationEnabled, interactiveFormValidationEnabled, Bool, bool, true) \
     macro(GeolocationEnabled, geolocationEnabled, Bool, bool, true) \
     macro(TextZoomEnabled, textZoomEnabled, Bool, bool, false) \
@@ -222,6 +223,7 @@ namespace WebKit {
     macro(LoadRemoteImages, loadRemoteImages, Bool, bool, true) \
     macro(LinkEffectEnabled, linkEffectEnabled, Bool, bool, true) \
     macro(EnableDefaultKeypad, defaultKeypadEnabled, Bool, bool, true) \
+    macro(UsesKeypadWithoutUserAction, usesKeypadWithoutUserAction, Bool, bool, true) \
     macro(InteractiveFormValidationEnabled, interactiveFormValidationEnabled, Bool, bool, true) \
     macro(GeolocationEnabled, geolocationEnabled, Bool, bool, true) \
     macro(TextZoomEnabled, textZoomEnabled, Bool, bool, false) \
index 69cc659..8bb8d95 100755 (executable)
@@ -366,6 +366,22 @@ Eina_Bool ewk_settings_default_keypad_enabled_get(const Ewk_Settings* settings)
 
     return settings->preferences()->defaultKeypadEnabled();
 }
+
+Eina_Bool ewk_settings_uses_keypad_without_user_action_set(Ewk_Settings* settings, Eina_Bool use)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+    settings->preferences()->setUsesKeypadWithoutUserAction(use);
+
+    return true;
+}
+
+Eina_Bool ewk_settings_uses_keypad_without_user_action_get(const Ewk_Settings* settings)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(settings, true);
+
+    return settings->preferences()->usesKeypadWithoutUserAction();
+}
 #endif
 
 Eina_Bool ewk_settings_frame_flattening_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
old mode 100644 (file)
new mode 100755 (executable)
index ea3f02d..9d9958f
@@ -374,6 +374,26 @@ EAPI Eina_Bool ewk_settings_default_keypad_enabled_set(Ewk_Settings *settings, E
  * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
  */
 EAPI Eina_Bool ewk_settings_default_keypad_enabled_get(const Ewk_Settings *settings);
+
+/**
+ * Requests to set using keypad without user action (default value : true)
+ *
+ * @param settings settings object using keypad without user action
+ * @param enable @c EINA_TRUE to use without user action @c EINA_FALSE to disable
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_settings_uses_keypad_without_user_action_set(Ewk_Settings *settings, Eina_Bool use);
+
+/**
+ * Returns using keypad without user action
+ *
+ * @param settings settings object using keypad without user action
+ * @param settings settings object to query using keypad without user action
+ *
+ * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
+ */
+EAPI Eina_Bool ewk_settings_uses_keypad_without_user_action_get(const Ewk_Settings *settings);
 // #endif
 
 /**
index 5bced31..a143641 100755 (executable)
@@ -567,11 +567,13 @@ void InputMethodContextEfl::resetIMFContext()
 
 void InputMethodContextEfl::showIMFContext(const EditorState& editor)
 {
-    if (!editor.isTapEventHandling || (isShow() && m_contextID == editor.inputMethodContextID))
-        return;
-
     Ewk_Settings* settings = ewk_view_settings_get(m_viewImpl->view());
-    bool defaultKeypadEnabled = ewk_settings_default_keypad_enabled_get(settings);
+    if (!editor.isTapEventHandling) {
+        if (!ewk_settings_uses_keypad_without_user_action_get(settings) || (m_focused && m_contextID == editor.inputMethodContextID))
+            return;
+    }
+
+    m_focused = true;
 
 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
     if (editor.inputMethodHints == "date")
@@ -591,6 +593,9 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor)
 
     if (m_inputPickerType >= 0) {
         showInputPicker(editor);
+        revertIMFContext();
+        m_contextID = editor.inputMethodContextID;
+
         return;
     }
 
@@ -611,6 +616,9 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor)
         else
             ewkViewDataListShowRequest(m_viewImpl->view(), EWK_INPUT_TYPE_TEXT, optionList);
 
+        revertIMFContext();
+        m_contextID = editor.inputMethodContextID;
+
         return;
     }
 #endif
@@ -618,7 +626,7 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor)
 
     bool hasFocus = evas_object_focus_get(m_viewImpl->view());
 
-    if (!defaultKeypadEnabled) {
+    if (!ewk_settings_default_keypad_enabled_get(settings)) {
         if (hasFocus) {
             Eina_Rectangle dummyRectForCustomKeypadCallback;
             memset(&dummyRectForCustomKeypadCallback, 0, sizeof(Eina_Rectangle));
@@ -631,10 +639,8 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor)
     if (!m_context)
         return;
 
-    if (!hasFocus) {
-        m_focused = true;
+    if (!hasFocus)
         return;
-    }
 
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
     if (m_viewImpl->pageClient->isClipboardWindowOpened())
@@ -648,8 +654,6 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor)
     // input field zoom for external keyboard
     ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
 
-    m_focused = true;
-
     setKeyboardMode(true);
 }
 
@@ -667,11 +671,6 @@ void InputMethodContextEfl::hideIMFContext()
     if (!m_context || !m_focused)
         return;
 
-    if (m_viewImpl->page()->editorState().hasComposition)
-        m_viewImpl->page()->cancelComposition();
-
-    m_focused = false;
-
     if (ecore_imf_context_input_panel_state_get(m_context.get()) != ECORE_IMF_INPUT_PANEL_STATE_HIDE
         && evas_object_focus_get(m_viewImpl->view())) {
         resetIMFContext();
@@ -681,6 +680,7 @@ void InputMethodContextEfl::hideIMFContext()
 
     setKeyboardMode(false);
 
+    m_focused = false;
     revertIMFContext();
 }