[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:25:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4dad1df272b325879f66af0a99a4a45f74f6392e
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 23 01:11:17 2010 +0000

    2010-07-22  Lucas De Marchi  <lucas.demarchi at profusion.mobi>
    
            Reviewed by Antonio Gomes.
    
            [EFL] Implement input method notification
            https://bugs.webkit.org/show_bug.cgi?id=42640
    
            Notify browser when keyboard should be shown/hidden. Input method
            hints are updated before sending the signal. Client should be able to
            determine the input type by calling ewk_view_imh_get().
    
            * efl/EWebLauncher/main.c:
            (on_inputmethod_changed): example implementation that just prints to
            stdout if keyboard should be shown or hidden and the imh flags.
            (browserCreate): listen to signal about input method changing its
            state.
            * efl/WebCoreSupport/EditorClientEfl.cpp:
            (WebCore::EditorClientEfl::setInputMethodState): call new function
            responsible for implementing this notification.
            * efl/ewk/ewk_private.h: ewk_view_input_method_state_set() is called
            only from inside WebKit.
            * efl/ewk/ewk_view.cpp: implement setters and getters
            (ewk_view_imh_get):
            (ewk_view_input_method_state_set):
            * efl/ewk/ewk_view.h: introduce Ewk_Imh enum which contains the
            possible input types.
            (_Ewk_View_Smart_Class::):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d4d2431..a34347d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2010-07-22  Lucas De Marchi  <lucas.demarchi at profusion.mobi>
+
+        Reviewed by Antonio Gomes.
+
+        [EFL] Implement input method notification
+        https://bugs.webkit.org/show_bug.cgi?id=42640
+
+        Notify browser when keyboard should be shown/hidden. Input method
+        hints are updated before sending the signal. Client should be able to
+        determine the input type by calling ewk_view_imh_get().
+
+        * efl/EWebLauncher/main.c:
+        (on_inputmethod_changed): example implementation that just prints to
+        stdout if keyboard should be shown or hidden and the imh flags.
+        (browserCreate): listen to signal about input method changing its
+        state.
+        * efl/WebCoreSupport/EditorClientEfl.cpp:
+        (WebCore::EditorClientEfl::setInputMethodState): call new function
+        responsible for implementing this notification.
+        * efl/ewk/ewk_private.h: ewk_view_input_method_state_set() is called
+        only from inside WebKit.
+        * efl/ewk/ewk_view.cpp: implement setters and getters
+        (ewk_view_imh_get):
+        (ewk_view_input_method_state_set):
+        * efl/ewk/ewk_view.h: introduce Ewk_Imh enum which contains the
+        possible input types.
+        (_Ewk_View_Smart_Class::):
+
 2010-07-20  Lucas De Marchi  <lucas.demarchi at profusion.mobi>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/efl/EWebLauncher/main.c b/WebKit/efl/EWebLauncher/main.c
index 6980a58..fd9a5f4 100644
--- a/WebKit/efl/EWebLauncher/main.c
+++ b/WebKit/efl/EWebLauncher/main.c
@@ -373,6 +373,21 @@ on_tooltip_text_set(void* user_data, Evas_Object* webview, void* event_info)
         info("%s\n", text);
 }
 
+static void
+on_inputmethod_changed(void* user_data, Evas_Object* webview, void* event_info)
+{
+    Eina_Bool active = (Eina_Bool)(long)event_info;
+    unsigned int imh;
+    info("Keyboard changed: %d\n", active);
+
+    if (!active)
+        return;
+
+    imh = ewk_view_imh_get(webview);
+    info("    Keyboard flags: %#.2x\n", imh);
+
+}
+
 /**
  * "viewport,changed" signal will be always emitted regardless of the viewport existence.
  *
@@ -661,6 +676,7 @@ browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Re
     evas_object_smart_callback_add(app->browser, "menubar,visible,set", on_menubar_visible_set, app);
     evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app);
     evas_object_smart_callback_add(app->browser, "tooltip,text,set", on_tooltip_text_set, app);
+    evas_object_smart_callback_add(app->browser, "inputmethod,changed", on_inputmethod_changed, app);
 
 /*     ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */
 
diff --git a/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp b/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
index cf672eb..a63b712 100644
--- a/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
+++ b/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
@@ -47,7 +47,7 @@ void EditorClientEfl::willSetInputMethodState()
 
 void EditorClientEfl::setInputMethodState(bool active)
 {
-    notImplemented();
+    ewk_view_input_method_state_set(m_view, active);
 }
 
 bool EditorClientEfl::shouldDeleteRange(Range*)
diff --git a/WebKit/efl/ewk/ewk_private.h b/WebKit/efl/ewk/ewk_private.h
index c549ad7..de3b75c 100644
--- a/WebKit/efl/ewk/ewk_private.h
+++ b/WebKit/efl/ewk/ewk_private.h
@@ -49,6 +49,7 @@ struct ContextMenuItem;
 }
 
 void ewk_view_ready(Evas_Object *o);
+void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active);
 void ewk_view_title_set(Evas_Object *o, const char *title);
 void ewk_view_uri_changed(Evas_Object *o);
 void ewk_view_load_started(Evas_Object *o);
diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp
index 1707a7d..333d136 100644
--- a/WebKit/efl/ewk/ewk_view.cpp
+++ b/WebKit/efl/ewk/ewk_view.cpp
@@ -34,6 +34,9 @@
 #include "FrameLoaderClientEfl.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
+#include "HTMLElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLNames.h"
 #include "InspectorClientEfl.h"
 #include "PlatformMouseEvent.h"
 #include "PopupMenuClient.h"
@@ -79,6 +82,7 @@ struct _Ewk_View_Private_Data {
         size_t count;
         size_t allocated;
     } scrolls;
+    unsigned int imh; /**< input method hints */
     struct {
         const char* user_agent;
         const char* user_stylesheet;
@@ -2150,6 +2154,20 @@ Eina_Bool ewk_view_pre_render_region(Evas_Object* o, Evas_Coord x, Evas_Coord y,
 }
 
 /**
+ * Get input method hints
+ *
+ * @param o View.
+ *
+ * @return input method hints
+ */
+unsigned int ewk_view_imh_get(Evas_Object *o)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
+    return priv->imh;
+}
+
+/**
  * Cancel (clear) previous pre-render requests.
  *
  * @param o view to clear pre-render requests.
@@ -3026,6 +3044,46 @@ void ewk_view_ready(Evas_Object* o)
 
 /**
  * @internal
+ * Reports the state of input method changed. This is triggered, for example
+ * when a input field received/lost focus
+ *
+ * Emits signal: "inputmethod,changed" with a boolean indicating whether it's
+ * enabled or not.
+ */
+void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd);
+    EWK_VIEW_PRIV_GET(sd, priv);
+    WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame();
+
+    if (focusedFrame
+        && focusedFrame->document()
+        && focusedFrame->document()->focusedNode()
+        && focusedFrame->document()->focusedNode()->hasTagName(WebCore::HTMLNames::inputTag)) {
+        WebCore::HTMLInputElement* inputElement;
+
+        inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedNode());
+        if (inputElement) {
+            priv->imh = 0;
+            // for password fields, active == false
+            if (!active) {
+                active = inputElement->isPasswordField();
+                priv->imh = inputElement->isPasswordField() * EWK_IMH_PASSWORD;
+            } else {
+                // Set input method hints for "number", "tel", "email", and "url" input elements.
+                priv->imh |= inputElement->isTelephoneField() * EWK_IMH_TELEPHONE;
+                priv->imh |= inputElement->isNumberField() * EWK_IMH_NUMBER;
+                priv->imh |= inputElement->isEmailField() * EWK_IMH_EMAIL;
+                priv->imh |= inputElement->isUrlField() * EWK_IMH_URL;
+            }
+        }
+    }
+
+    evas_object_smart_callback_call(o, "inputmethod,changed", (void*)active);
+}
+
+/**
+ * @internal
  * The view title was changed by the frame loader.
  *
  * Emits signal: "title,changed" with pointer to new title string.
diff --git a/WebKit/efl/ewk/ewk_view.h b/WebKit/efl/ewk/ewk_view.h
index 209beff..520dea2 100644
--- a/WebKit/efl/ewk/ewk_view.h
+++ b/WebKit/efl/ewk/ewk_view.h
@@ -86,6 +86,7 @@ extern "C" {
  *    and as arguments gives its details.
  *  - "icon,received", void: main frame received an icon.
  *  - "viewport,changed", void: Report that viewport has changed.
+ *  - "inputmethods,changed" with a boolean indicating whether it's enabled or not.
  */
 
 typedef struct _Ewk_View_Smart_Data Ewk_View_Smart_Data;
@@ -186,6 +187,15 @@ struct _Ewk_View_Smart_Class {
  */
 #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
 
+enum _Ewk_Imh {
+    EWK_IMH_TELEPHONE = (1 << 0),
+    EWK_IMH_NUMBER = (1 << 1),
+    EWK_IMH_EMAIL = (1 << 2),
+    EWK_IMH_URL = (1 << 3),
+    EWK_IMH_PASSWORD = (1 << 4)
+};
+typedef enum _Ewk_Imh Ewk_Imh;
+
 /**
  * @internal
  *
@@ -357,6 +367,8 @@ EAPI Eina_Bool    ewk_view_zoom_text_only_set(Evas_Object *o, Eina_Bool setting)
 EAPI Eina_Bool    ewk_view_pre_render_region(Evas_Object *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom);
 EAPI void         ewk_view_pre_render_cancel(Evas_Object *o);
 
+EAPI unsigned int ewk_view_imh_get(Evas_Object *o);
+
 /* settings */
 EAPI const char  *ewk_view_setting_user_agent_get(const Evas_Object *o);
 EAPI Eina_Bool    ewk_view_setting_user_agent_set(Evas_Object *o, const char *user_agent);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list