Changeset 63933 in webkit


Ignore:
Timestamp:
Jul 22, 2010 6:11:17 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-22 Lucas De Marchi <lucas.demarchi@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::):
Location:
trunk/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r63775 r63933  
     12010-07-22  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        [EFL] Implement input method notification
     6        https://bugs.webkit.org/show_bug.cgi?id=42640
     7
     8        Notify browser when keyboard should be shown/hidden. Input method
     9        hints are updated before sending the signal. Client should be able to
     10        determine the input type by calling ewk_view_imh_get().
     11
     12        * efl/EWebLauncher/main.c:
     13        (on_inputmethod_changed): example implementation that just prints to
     14        stdout if keyboard should be shown or hidden and the imh flags.
     15        (browserCreate): listen to signal about input method changing its
     16        state.
     17        * efl/WebCoreSupport/EditorClientEfl.cpp:
     18        (WebCore::EditorClientEfl::setInputMethodState): call new function
     19        responsible for implementing this notification.
     20        * efl/ewk/ewk_private.h: ewk_view_input_method_state_set() is called
     21        only from inside WebKit.
     22        * efl/ewk/ewk_view.cpp: implement setters and getters
     23        (ewk_view_imh_get):
     24        (ewk_view_input_method_state_set):
     25        * efl/ewk/ewk_view.h: introduce Ewk_Imh enum which contains the
     26        possible input types.
     27        (_Ewk_View_Smart_Class::):
     28
    1292010-07-20  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
    230
  • trunk/WebKit/efl/EWebLauncher/main.c

    r63775 r63933  
    374374}
    375375
     376static void
     377on_inputmethod_changed(void* user_data, Evas_Object* webview, void* event_info)
     378{
     379    Eina_Bool active = (Eina_Bool)(long)event_info;
     380    unsigned int imh;
     381    info("Keyboard changed: %d\n", active);
     382
     383    if (!active)
     384        return;
     385
     386    imh = ewk_view_imh_get(webview);
     387    info("    Keyboard flags: %#.2x\n", imh);
     388
     389}
     390
    376391/**
    377392 * "viewport,changed" signal will be always emitted regardless of the viewport existence.
     
    662677    evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app);
    663678    evas_object_smart_callback_add(app->browser, "tooltip,text,set", on_tooltip_text_set, app);
     679    evas_object_smart_callback_add(app->browser, "inputmethod,changed", on_inputmethod_changed, app);
    664680
    665681/*     ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */
  • trunk/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp

    r63602 r63933  
    4848void EditorClientEfl::setInputMethodState(bool active)
    4949{
    50     notImplemented();
     50    ewk_view_input_method_state_set(m_view, active);
    5151}
    5252
  • trunk/WebKit/efl/ewk/ewk_private.h

    r63060 r63933  
    5050
    5151void ewk_view_ready(Evas_Object *o);
     52void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active);
    5253void ewk_view_title_set(Evas_Object *o, const char *title);
    5354void ewk_view_uri_changed(Evas_Object *o);
  • trunk/WebKit/efl/ewk/ewk_view.cpp

    r63775 r63933  
    3535#include "FrameView.h"
    3636#include "GraphicsContext.h"
     37#include "HTMLElement.h"
     38#include "HTMLInputElement.h"
     39#include "HTMLNames.h"
    3740#include "InspectorClientEfl.h"
    3841#include "PlatformMouseEvent.h"
     
    8083        size_t allocated;
    8184    } scrolls;
     85    unsigned int imh; /**< input method hints */
    8286    struct {
    8387        const char* user_agent;
     
    21512155
    21522156/**
     2157 * Get input method hints
     2158 *
     2159 * @param o View.
     2160 *
     2161 * @return input method hints
     2162 */
     2163unsigned int ewk_view_imh_get(Evas_Object *o)
     2164{
     2165    EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
     2166    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
     2167    return priv->imh;
     2168}
     2169
     2170/**
    21532171 * Cancel (clear) previous pre-render requests.
    21542172 *
     
    30233041    DBG("o=%p", o);
    30243042    evas_object_smart_callback_call(o, "ready", 0);
     3043}
     3044
     3045/**
     3046 * @internal
     3047 * Reports the state of input method changed. This is triggered, for example
     3048 * when a input field received/lost focus
     3049 *
     3050 * Emits signal: "inputmethod,changed" with a boolean indicating whether it's
     3051 * enabled or not.
     3052 */
     3053void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active)
     3054{
     3055    EWK_VIEW_SD_GET_OR_RETURN(o, sd);
     3056    EWK_VIEW_PRIV_GET(sd, priv);
     3057    WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame();
     3058
     3059    if (focusedFrame
     3060        && focusedFrame->document()
     3061        && focusedFrame->document()->focusedNode()
     3062        && focusedFrame->document()->focusedNode()->hasTagName(WebCore::HTMLNames::inputTag)) {
     3063        WebCore::HTMLInputElement* inputElement;
     3064
     3065        inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedNode());
     3066        if (inputElement) {
     3067            priv->imh = 0;
     3068            // for password fields, active == false
     3069            if (!active) {
     3070                active = inputElement->isPasswordField();
     3071                priv->imh = inputElement->isPasswordField() * EWK_IMH_PASSWORD;
     3072            } else {
     3073                // Set input method hints for "number", "tel", "email", and "url" input elements.
     3074                priv->imh |= inputElement->isTelephoneField() * EWK_IMH_TELEPHONE;
     3075                priv->imh |= inputElement->isNumberField() * EWK_IMH_NUMBER;
     3076                priv->imh |= inputElement->isEmailField() * EWK_IMH_EMAIL;
     3077                priv->imh |= inputElement->isUrlField() * EWK_IMH_URL;
     3078            }
     3079        }
     3080    }
     3081
     3082    evas_object_smart_callback_call(o, "inputmethod,changed", (void*)active);
    30253083}
    30263084
  • trunk/WebKit/efl/ewk/ewk_view.h

    r62666 r63933  
    8787 *  - "icon,received", void: main frame received an icon.
    8888 *  - "viewport,changed", void: Report that viewport has changed.
     89 *  - "inputmethods,changed" with a boolean indicating whether it's enabled or not.
    8990 */
    9091
     
    186187 */
    187188#define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
     189
     190enum _Ewk_Imh {
     191    EWK_IMH_TELEPHONE = (1 << 0),
     192    EWK_IMH_NUMBER = (1 << 1),
     193    EWK_IMH_EMAIL = (1 << 2),
     194    EWK_IMH_URL = (1 << 3),
     195    EWK_IMH_PASSWORD = (1 << 4)
     196};
     197typedef enum _Ewk_Imh Ewk_Imh;
    188198
    189199/**
     
    358368EAPI void         ewk_view_pre_render_cancel(Evas_Object *o);
    359369
     370EAPI unsigned int ewk_view_imh_get(Evas_Object *o);
     371
    360372/* settings */
    361373EAPI const char  *ewk_view_setting_user_agent_get(const Evas_Object *o);
Note: See TracChangeset for help on using the changeset viewer.