diff options
Diffstat (limited to 'WebKit/efl/ewk')
| -rw-r--r-- | WebKit/efl/ewk/ewk_cookies.cpp | 22 | ||||
| -rw-r--r-- | WebKit/efl/ewk/ewk_main.cpp | 8 | ||||
| -rw-r--r-- | WebKit/efl/ewk/ewk_private.h | 2 | ||||
| -rw-r--r-- | WebKit/efl/ewk/ewk_settings.cpp | 24 | ||||
| -rw-r--r-- | WebKit/efl/ewk/ewk_settings.h | 1 | ||||
| -rw-r--r-- | WebKit/efl/ewk/ewk_view.cpp | 97 | ||||
| -rw-r--r-- | WebKit/efl/ewk/ewk_view.h | 15 |
7 files changed, 155 insertions, 14 deletions
diff --git a/WebKit/efl/ewk/ewk_cookies.cpp b/WebKit/efl/ewk/ewk_cookies.cpp index 3b4949e..421f8dc 100644 --- a/WebKit/efl/ewk/ewk_cookies.cpp +++ b/WebKit/efl/ewk/ewk_cookies.cpp @@ -21,14 +21,18 @@ #include "config.h" #include "ewk_cookies.h" +#ifdef WTF_USE_SOUP #include "CookieJarSoup.h" +#endif #include "EWebKit.h" #include "ResourceHandle.h" #include <Eina.h> #include <eina_safety_checks.h> +#ifdef WTF_USE_SOUP #include <glib.h> #include <libsoup/soup.h> +#endif #include <wtf/text/CString.h> @@ -43,6 +47,7 @@ */ EAPI Eina_Bool ewk_cookies_file_set(const char *filename) { +#ifdef WTF_USE_SOUP SoupCookieJar* cookieJar = 0; if (filename) cookieJar = soup_cookie_jar_text_new(filename, FALSE); @@ -65,6 +70,9 @@ EAPI Eina_Bool ewk_cookies_file_set(const char *filename) soup_session_add_feature(session, SOUP_SESSION_FEATURE(cookieJar)); return EINA_TRUE; +#else + return EINA_FALSE; +#endif } /** @@ -72,6 +80,7 @@ EAPI Eina_Bool ewk_cookies_file_set(const char *filename) */ EAPI void ewk_cookies_clear() { +#ifdef WTF_USE_SOUP GSList* l; GSList* p; SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); @@ -81,6 +90,7 @@ EAPI void ewk_cookies_clear() soup_cookie_jar_delete_cookie(cookieJar, (SoupCookie*)p->data); soup_cookies_free(l); +#endif } /** @@ -90,9 +100,10 @@ EAPI void ewk_cookies_clear() */ EAPI Eina_List* ewk_cookies_get_all(void) { + Eina_List* el = 0; +#ifdef WTF_USE_SOUP GSList* l; GSList* p; - Eina_List* el = 0; SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); l = soup_cookie_jar_all_cookies(cookieJar); @@ -110,6 +121,7 @@ EAPI Eina_List* ewk_cookies_get_all(void) } soup_cookies_free(l); +#endif return el; } @@ -123,6 +135,7 @@ EAPI Eina_List* ewk_cookies_get_all(void) */ EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) { +#ifdef WTF_USE_SOUP EINA_SAFETY_ON_NULL_RETURN(cookie); GSList* l; GSList* p; @@ -141,6 +154,7 @@ EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) soup_cookie_free(c1); soup_cookies_free(l); +#endif } /* @@ -150,12 +164,14 @@ EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie) */ EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie) { +#ifdef WTF_USE_SOUP EINA_SAFETY_ON_NULL_RETURN(cookie); free(cookie->name); free(cookie->value); free(cookie->domain); free(cookie->path); free(cookie); +#endif } /* @@ -170,6 +186,7 @@ EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie) */ EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) { +#ifdef WTF_USE_SOUP #ifdef HAVE_LIBSOUP_2_29_90 SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); SoupCookieJarAcceptPolicy policy; @@ -189,6 +206,7 @@ EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) soup_cookie_jar_set_accept_policy(cookieJar, policy); #endif +#endif } /* @@ -199,6 +217,7 @@ EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p) EAPI Ewk_Cookie_Policy ewk_cookies_policy_get() { Ewk_Cookie_Policy ewk_policy = EWK_COOKIE_JAR_ACCEPT_ALWAYS; +#ifdef WTF_USE_SOUP #ifdef HAVE_LIBSOUP_2_29_90 SoupCookieJar* cookieJar = WebCore::defaultCookieJar(); SoupCookieJarAcceptPolicy policy; @@ -216,6 +235,7 @@ EAPI Ewk_Cookie_Policy ewk_cookies_policy_get() break; } #endif +#endif return ewk_policy; } diff --git a/WebKit/efl/ewk/ewk_main.cpp b/WebKit/efl/ewk/ewk_main.cpp index 92346e7..5742766 100644 --- a/WebKit/efl/ewk/ewk_main.cpp +++ b/WebKit/efl/ewk/ewk_main.cpp @@ -37,7 +37,7 @@ #include <Evas.h> #include <stdlib.h> -#ifdef ENABLE_GLIB_SUPPORT +#if ENABLE(GLIB_SUPPORT) #include <glib-object.h> #include <glib.h> @@ -47,9 +47,11 @@ #endif +#ifdef WTF_USE_SOUP // REMOVE-ME: see todo below #include "ResourceHandle.h" #include <libsoup/soup.h> +#endif static int _ewk_init_count = 0; int _ewk_log_dom = -1; @@ -88,7 +90,7 @@ int ewk_init(void) goto error_edje; } -#ifdef ENABLE_GLIB_SUPPORT +#if ENABLE(GLIB_SUPPORT) g_type_init(); if (!g_thread_supported()) @@ -119,10 +121,12 @@ int ewk_init(void) ewk_settings_web_database_path_set(getenv("HOME")); // TODO: this should move to WebCore, already reported to webkit-gtk folks: +#ifdef WTF_USE_SOUP if (1) { SoupSession* session = WebCore::ResourceHandle::defaultSession(); soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_SNIFFER); } +#endif return ++_ewk_init_count; diff --git a/WebKit/efl/ewk/ewk_private.h b/WebKit/efl/ewk/ewk_private.h index c549ad7..2096e76 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); @@ -62,6 +63,7 @@ void ewk_view_load_progress_changed(Evas_Object *o); void ewk_view_load_show(Evas_Object* o); void ewk_view_restore_state(Evas_Object *o, Evas_Object *frame); Evas_Object *ewk_view_window_create(Evas_Object *o, Eina_Bool javascript, const WebCore::WindowFeatures* coreFeatures); +void ewk_view_window_close(Evas_Object *o); void ewk_view_mouse_link_hover_in(Evas_Object *o, void *data); void ewk_view_mouse_link_hover_out(Evas_Object *o); diff --git a/WebKit/efl/ewk/ewk_settings.cpp b/WebKit/efl/ewk/ewk_settings.cpp index b50cd75..e775ac9 100644 --- a/WebKit/efl/ewk/ewk_settings.cpp +++ b/WebKit/efl/ewk/ewk_settings.cpp @@ -39,6 +39,11 @@ #include <sys/types.h> #include <unistd.h> +#if USE(SOUP) +#include "ResourceHandle.h" +#include <libsoup/soup.h> +#endif + static uint64_t _ewk_default_web_database_quota = 1 * 1024 * 1024; /** @@ -223,3 +228,22 @@ Evas_Object* ewk_settings_icon_database_icon_object_add(const char* url, Evas* c surface = icon->nativeImageForCurrentFrame(); return ewk_util_image_from_cairo_surface_add(canvas, surface); } + +/** + * Sets the given proxy URI to network backend. + * + * @param proxy URI. + */ +void ewk_settings_proxy_uri_set(const char* proxy) +{ +#if USE(SOUP) + SoupURI* uri = soup_uri_new(proxy); + EINA_SAFETY_ON_NULL_RETURN(uri); + + SoupSession* session = WebCore::ResourceHandle::defaultSession(); + g_object_set(session, SOUP_SESSION_PROXY_URI, uri, NULL); + soup_uri_free(uri); +#elif USE(CURL) + EINA_SAFETY_ON_TRUE_RETURN(1); +#endif +} diff --git a/WebKit/efl/ewk/ewk_settings.h b/WebKit/efl/ewk/ewk_settings.h index 87d015c..f2d77f7 100644 --- a/WebKit/efl/ewk/ewk_settings.h +++ b/WebKit/efl/ewk/ewk_settings.h @@ -48,6 +48,7 @@ EAPI Eina_Bool ewk_settings_icon_database_clear(void); EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url); EAPI Evas_Object *ewk_settings_icon_database_icon_object_add(const char *url, Evas *canvas); +EAPI void ewk_settings_proxy_uri_set(const char* proxy); #ifdef __cplusplus } diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp index 1707a7d..ed6fb4d 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; @@ -525,16 +529,14 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd) CRITICAL("could not allocate Ewk_View_Private_Data"); return 0; } - priv->page = new WebCore::Page( - static_cast<WebCore::ChromeClient*>(new WebCore::ChromeClientEfl(sd->self)), - static_cast<WebCore::ContextMenuClient*>(new WebCore::ContextMenuClientEfl(sd->self)), - static_cast<WebCore::EditorClient*>(new WebCore::EditorClientEfl(sd->self)), - static_cast<WebCore::DragClient*>(new WebCore::DragClientEfl), - static_cast<WebCore::InspectorClient*>(new WebCore::InspectorClientEfl), - 0, - 0, - 0, - 0); + + WebCore::Page::PageClients pageClients; + pageClients.chromeClient = static_cast<WebCore::ChromeClient*>(new WebCore::ChromeClientEfl(sd->self)); + pageClients.contextMenuClient = static_cast<WebCore::ContextMenuClient*>(new WebCore::ContextMenuClientEfl(sd->self)); + pageClients.editorClient = static_cast<WebCore::EditorClient*>(new WebCore::EditorClientEfl(sd->self)); + pageClients.dragClient = static_cast<WebCore::DragClient*>(new WebCore::DragClientEfl); + pageClients.inspectorClient = static_cast<WebCore::InspectorClient*>(new WebCore::InspectorClientEfl); + priv->page = new WebCore::Page(pageClients); if (!priv->page) { CRITICAL("Could not create WebKit Page"); goto error_page; @@ -2150,6 +2152,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 +3042,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. @@ -3234,6 +3290,27 @@ Evas_Object* ewk_view_window_create(Evas_Object* o, Eina_Bool javascript, const /** * @internal + * Reports a window should be closed. It's client responsibility to decide if + * the window should in fact be closed. So, if only windows created by javascript + * are allowed to be closed by this call, browser needs to save the javascript + * flag when the window is created. Since a window can close itself (for example + * with a 'self.close()' in Javascript) browser must postpone the deletion to an + * idler. + * + * @param o View to be closed. + */ +void ewk_view_window_close(Evas_Object* o) +{ + EWK_VIEW_SD_GET_OR_RETURN(o, sd); + + ewk_view_stop(o); + if (!sd->api->window_close) + return; + sd->api->window_close(sd); +} + +/** + * @internal * Reports mouse has moved over a link. * * Emits signal: "link,hover,in" diff --git a/WebKit/efl/ewk/ewk_view.h b/WebKit/efl/ewk/ewk_view.h index 209beff..19a3588 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; @@ -99,6 +100,7 @@ struct _Ewk_View_Smart_Class { unsigned long version; Evas_Object *(*window_create)(Ewk_View_Smart_Data *sd, Eina_Bool javascript, const Ewk_Window_Features *window_features); /**< creates a new window, requested by webkit */ + void (*window_close)(Ewk_View_Smart_Data *sd); /**< creates a new window, requested by webkit */ // hooks to allow different backing stores Evas_Object *(*backing_store_add)(Ewk_View_Smart_Data *sd); /**< must be defined */ Eina_Bool (*scrolls_process)(Ewk_View_Smart_Data *sd); /**< must be defined */ @@ -145,7 +147,7 @@ struct _Ewk_View_Smart_Class { * @see EWK_VIEW_SMART_CLASS_INIT_VERSION * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION */ -#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /** * Initializer to zero a whole Ewk_View_Smart_Class structure. @@ -186,6 +188,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 +368,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); |
