Changeset 63933 in webkit
- Timestamp:
- Jul 22, 2010 6:11:17 PM (14 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r63775 r63933 1 2010-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 1 29 2010-07-20 Lucas De Marchi <lucas.demarchi@profusion.mobi> 2 30 -
trunk/WebKit/efl/EWebLauncher/main.c
r63775 r63933 374 374 } 375 375 376 static void 377 on_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 376 391 /** 377 392 * "viewport,changed" signal will be always emitted regardless of the viewport existence. … … 662 677 evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app); 663 678 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); 664 680 665 681 /* ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */ -
trunk/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
r63602 r63933 48 48 void EditorClientEfl::setInputMethodState(bool active) 49 49 { 50 notImplemented();50 ewk_view_input_method_state_set(m_view, active); 51 51 } 52 52 -
trunk/WebKit/efl/ewk/ewk_private.h
r63060 r63933 50 50 51 51 void ewk_view_ready(Evas_Object *o); 52 void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active); 52 53 void ewk_view_title_set(Evas_Object *o, const char *title); 53 54 void ewk_view_uri_changed(Evas_Object *o); -
trunk/WebKit/efl/ewk/ewk_view.cpp
r63775 r63933 35 35 #include "FrameView.h" 36 36 #include "GraphicsContext.h" 37 #include "HTMLElement.h" 38 #include "HTMLInputElement.h" 39 #include "HTMLNames.h" 37 40 #include "InspectorClientEfl.h" 38 41 #include "PlatformMouseEvent.h" … … 80 83 size_t allocated; 81 84 } scrolls; 85 unsigned int imh; /**< input method hints */ 82 86 struct { 83 87 const char* user_agent; … … 2151 2155 2152 2156 /** 2157 * Get input method hints 2158 * 2159 * @param o View. 2160 * 2161 * @return input method hints 2162 */ 2163 unsigned 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 /** 2153 2171 * Cancel (clear) previous pre-render requests. 2154 2172 * … … 3023 3041 DBG("o=%p", o); 3024 3042 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 */ 3053 void 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); 3025 3083 } 3026 3084 -
trunk/WebKit/efl/ewk/ewk_view.h
r62666 r63933 87 87 * - "icon,received", void: main frame received an icon. 88 88 * - "viewport,changed", void: Report that viewport has changed. 89 * - "inputmethods,changed" with a boolean indicating whether it's enabled or not. 89 90 */ 90 91 … … 186 187 */ 187 188 #define EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(name) EWK_VIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name)) 189 190 enum _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 }; 197 typedef enum _Ewk_Imh Ewk_Imh; 188 198 189 199 /** … … 358 368 EAPI void ewk_view_pre_render_cancel(Evas_Object *o); 359 369 370 EAPI unsigned int ewk_view_imh_get(Evas_Object *o); 371 360 372 /* settings */ 361 373 EAPI const char *ewk_view_setting_user_agent_get(const Evas_Object *o);
Note: See TracChangeset
for help on using the changeset viewer.