diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-15 16:08:57 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-15 16:08:57 +0200 |
commit | 5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch) | |
tree | 8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | |
parent | 33b26980cb24288b5a9f2590ccf32a949281bb79 (diff) | |
download | qtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz |
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1
widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're
working on completing the entire split as part of
https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/WebKit2/UIProcess/API/efl/ewk_view.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 318 |
1 files changed, 272 insertions, 46 deletions
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 10a68c404..07a942264 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -44,6 +44,7 @@ #include "ewk_popup_menu_item.h" #include "ewk_popup_menu_item_private.h" #include "ewk_private.h" +#include "ewk_resource.h" #include "ewk_settings_private.h" #include "ewk_view_find_client_private.h" #include "ewk_view_form_client_private.h" @@ -52,7 +53,6 @@ #include "ewk_view_private.h" #include "ewk_view_resource_load_client_private.h" #include "ewk_view_ui_client_private.h" -#include "ewk_web_resource.h" #include <Ecore_Evas.h> #include <Edje.h> #include <WebCore/Cursor.h> @@ -64,6 +64,10 @@ #include "WebFullScreenManagerProxy.h" #endif +#if ENABLE(INSPECTOR) +#include "WebInspectorProxy.h" +#endif + #if USE(ACCELERATED_COMPOSITING) #include <Evas_GL.h> #endif @@ -79,9 +83,33 @@ static const char EWK_VIEW_TYPE_STR[] = "EWK2_View"; static const int defaultCursorSize = 16; -typedef HashMap<uint64_t, Ewk_Web_Resource*> LoadingResourcesMap; +typedef HashMap<uint64_t, Ewk_Resource*> LoadingResourcesMap; static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingResourcesMap); +typedef HashMap<const WebPageProxy*, const Evas_Object*> PageViewMap; + +static inline PageViewMap& pageViewMap() +{ + DEFINE_STATIC_LOCAL(PageViewMap, map, ()); + return map; +} + +static inline void addToPageViewMap(const Evas_Object* ewkView) +{ + ASSERT(ewkView); + ASSERT(ewk_view_page_get(ewkView)); + PageViewMap::AddResult result = pageViewMap().add(ewk_view_page_get(ewkView), ewkView); + ASSERT_UNUSED(result, result.isNewEntry); +} + +static inline void removeFromPageViewMap(const Evas_Object* ewkView) +{ + ASSERT(ewkView); + ASSERT(ewk_view_page_get(ewkView)); + ASSERT(pageViewMap().contains(ewk_view_page_get(ewkView))); + pageViewMap().remove(ewk_view_page_get(ewkView)); +} + struct _Ewk_View_Private_Data { OwnPtr<PageClientImpl> pageClient; #if USE(COORDINATED_GRAPHICS) @@ -89,7 +117,7 @@ struct _Ewk_View_Private_Data { #endif RefPtr<WebPageProxy> pageProxy; - WKEinaSharedString uri; + WKEinaSharedString url; WKEinaSharedString title; WKEinaSharedString theme; WKEinaSharedString customEncoding; @@ -101,6 +129,9 @@ struct _Ewk_View_Private_Data { bool areMouseEventsEnabled; WKColorPickerResultListenerRef colorPickerResultListener; Ewk_Context* context; +#if ENABLE(TOUCH_EVENTS) + bool areTouchEventsEnabled; +#endif WebPopupMenuProxyEfl* popupMenuProxy; Eina_List* popupMenuItems; @@ -121,6 +152,9 @@ struct _Ewk_View_Private_Data { , areMouseEventsEnabled(false) , colorPickerResultListener(0) , context(0) +#if ENABLE(TOUCH_EVENTS) + , areTouchEventsEnabled(false) +#endif , popupMenuProxy(0) , popupMenuItems(0) #ifdef HAVE_ECORE_X @@ -356,6 +390,65 @@ static void _ewk_view_on_key_up(void* data, Evas*, Evas_Object*, void* eventInfo smartData->api->key_up(smartData, upEvent); } +static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/) +{ + Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); +} + +static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/) +{ + Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + // This call may look wrong, but we really need to pass ViewIsVisible here. + // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden + // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process. + priv->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible); +} + +#if ENABLE(TOUCH_EVENTS) +static inline void _ewk_view_feed_touch_event_using_touch_point_list_of_evas(Evas_Object* ewkView, Ewk_Touch_Event_Type type) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + + unsigned count = evas_touch_point_list_count(smartData->base.evas); + if (!count) + return; + + Eina_List* points = 0; + for (unsigned i = 0; i < count; ++i) { + Ewk_Touch_Point* point = new Ewk_Touch_Point; + point->id = evas_touch_point_list_nth_id_get(smartData->base.evas, i); + evas_touch_point_list_nth_xy_get(smartData->base.evas, i, &point->x, &point->y); + point->state = evas_touch_point_list_nth_state_get(smartData->base.evas, i); + points = eina_list_append(points, point); + } + + ewk_view_feed_touch_event(ewkView, type, points, evas_key_modifier_get(smartData->base.evas)); + + void* data; + EINA_LIST_FREE(points, data) + delete static_cast<Ewk_Touch_Point*>(data); +} + +static void _ewk_view_on_touch_down(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) +{ + _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_START); +} + +static void _ewk_view_on_touch_up(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) +{ + _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_END); +} + +static void _ewk_view_on_touch_move(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */) +{ + _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_MOVE); +} +#endif + static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL; static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) @@ -379,7 +472,7 @@ static void _ewk_view_priv_loading_resources_clear(LoadingResourcesMap& loadingR LoadingResourcesMap::iterator it = loadingResourcesMap.begin(); LoadingResourcesMap::iterator end = loadingResourcesMap.end(); for ( ; it != end; ++it) - ewk_web_resource_unref(it->second); + ewk_resource_unref(it->value); loadingResourcesMap.clear(); } @@ -434,11 +527,14 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel); CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down); CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up); + CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show); + CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide); #undef CONNECT } static void _ewk_view_smart_del(Evas_Object* ewkView) { + removeFromPageViewMap(ewkView); EWK_VIEW_SD_GET(ewkView, smartData); if (smartData && smartData->priv) _ewk_view_priv_del(smartData->priv); @@ -530,6 +626,7 @@ bool ewk_view_accelerated_compositing_mode_enter(const Evas_Object* ewkView) return false; } + priv->viewportHandler->setRendererActive(true); return true; } @@ -708,6 +805,9 @@ static void _ewk_view_initialize(Evas_Object* ewkView, Ewk_Context* context, WKP priv->pageProxy = toImpl(ewk_context_WKContext_get(context))->createWebPage(priv->pageClient.get(), toImpl(pageGroupRef)); else priv->pageProxy = toImpl(ewk_context_WKContext_get(context))->createWebPage(priv->pageClient.get(), WebPageGroup::create().get()); + + addToPageViewMap(ewkView); + #if USE(COORDINATED_GRAPHICS) priv->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); priv->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true); @@ -812,11 +912,11 @@ Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView) /** * @internal - * The uri of view was changed by the frame loader. + * The url of view was changed by the frame loader. * - * Emits signal: "uri,changed" with pointer to new uri string. + * Emits signal: "url,changed" with pointer to new url string. */ -void ewk_view_uri_update(Evas_Object* ewkView) +void ewk_view_url_update(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); @@ -825,32 +925,32 @@ void ewk_view_uri_update(Evas_Object* ewkView) if (activeURL.isEmpty()) return; - if (priv->uri == activeURL.utf8().data()) + if (priv->url == activeURL.utf8().data()) return; - priv->uri = activeURL.utf8().data(); - const char* callbackArgument = static_cast<const char*>(priv->uri); - evas_object_smart_callback_call(ewkView, "uri,changed", const_cast<char*>(callbackArgument)); + priv->url = activeURL.utf8().data(); + const char* callbackArgument = static_cast<const char*>(priv->url); + evas_object_smart_callback_call(ewkView, "url,changed", const_cast<char*>(callbackArgument)); } -Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri) +Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - EINA_SAFETY_ON_NULL_RETURN_VAL(uri, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(url, false); - priv->pageProxy->loadURL(uri); - ewk_view_uri_update(ewkView); + priv->pageProxy->loadURL(url); + ewk_view_url_update(ewkView); return true; } -const char* ewk_view_uri_get(const Evas_Object* ewkView) +const char* ewk_view_url_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); - return priv->uri; + return priv->url; } Eina_Bool ewk_view_reload(Evas_Object* ewkView) @@ -859,7 +959,7 @@ Eina_Bool ewk_view_reload(Evas_Object* ewkView) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); priv->pageProxy->reload(/*reloadFromOrigin*/ false); - ewk_view_uri_update(ewkView); + ewk_view_url_update(ewkView); return true; } @@ -870,7 +970,7 @@ Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView) EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); priv->pageProxy->reload(/*reloadFromOrigin*/ true); - ewk_view_uri_update(ewkView); + ewk_view_url_update(ewkView); return true; } @@ -899,15 +999,15 @@ Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView) * * Emits signal: "resource,request,new" with pointer to resource request. */ -void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request) +void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Resource* resource, Ewk_Url_Request* request) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); - Ewk_Web_Resource_Request resourceRequest = {resource, request, 0}; + Ewk_Resource_Request resourceRequest = {resource, request, 0}; // Keep the resource internally to reuse it later. - priv->loadingResourcesMap.add(resourceIdentifier, ewk_web_resource_ref(resource)); + priv->loadingResourcesMap.add(resourceIdentifier, ewk_resource_ref(resource)); evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest); } @@ -926,8 +1026,8 @@ void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIden if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Web_Resource_Load_Response resourceLoadResponse = {resource, response}; + Ewk_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Resource_Load_Response resourceLoadResponse = {resource, response}; evas_object_smart_callback_call(ewkView, "resource,request,response", &resourceLoadResponse); } @@ -937,7 +1037,7 @@ void ewk_view_resource_load_response(Evas_Object* ewkView, uint64_t resourceIden * * Emits signal: "resource,request,finished" with pointer to the resource load error. */ -void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Error* error) +void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Error* error) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); @@ -945,8 +1045,8 @@ void ewk_view_resource_load_failed(Evas_Object* ewkView, uint64_t resourceIdenti if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Web_Resource_Load_Error resourceLoadError = {resource, error}; + Ewk_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Resource_Load_Error resourceLoadError = {resource, error}; evas_object_smart_callback_call(ewkView, "resource,request,failed", &resourceLoadError); } @@ -964,10 +1064,10 @@ void ewk_view_resource_load_finished(Evas_Object* ewkView, uint64_t resourceIden if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Web_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier); + Ewk_Resource* resource = priv->loadingResourcesMap.take(resourceIdentifier); evas_object_smart_callback_call(ewkView, "resource,request,finished", resource); - ewk_web_resource_unref(resource); + ewk_resource_unref(resource); } /** @@ -984,8 +1084,8 @@ void ewk_view_resource_request_sent(Evas_Object* ewkView, uint64_t resourceIdent if (!priv->loadingResourcesMap.contains(resourceIdentifier)) return; - Ewk_Web_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); - Ewk_Web_Resource_Request resourceRequest = {resource, request, redirectResponse}; + Ewk_Resource* resource = priv->loadingResourcesMap.get(resourceIdentifier); + Ewk_Resource_Request resourceRequest = {resource, request, redirectResponse}; evas_object_smart_callback_call(ewkView, "resource,request,sent", &resourceRequest); } @@ -1207,6 +1307,22 @@ void ewk_view_full_screen_exit(Evas_Object* ewkView) } #endif +#if ENABLE(SQL_DATABASE) +/** + * @internal + * Calls exceeded_database_quota callback or falls back to default behavior returns default database quota. + */ +unsigned long long ewk_view_database_quota_exceeded(Evas_Object* ewkView, const char* databaseName, const char* displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + + static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB + if (smartData->api->exceeded_database_quota) + return smartData->api->exceeded_database_quota(smartData, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage); + + return defaultQuota; +} +#endif /** * @internal @@ -1236,7 +1352,7 @@ void ewk_view_download_job_requested(Evas_Object* ewkView, Ewk_Download_Job* dow * * Emits signal: "download,failed" with pointer to a Ewk_Download_Job_Error. */ -void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Web_Error* error) +void ewk_view_download_job_failed(Evas_Object* ewkView, Ewk_Download_Job* download, Ewk_Error* error) { Ewk_Download_Job_Error downloadError = { download, error }; evas_object_smart_callback_call(ewkView, "download,failed", &downloadError); @@ -1347,11 +1463,11 @@ void ewk_view_form_submission_request_new(Evas_Object* ewkView, Ewk_Form_Submiss * @internal * Reports load failed with error information. * - * Emits signal: "load,error" with pointer to Ewk_Web_Error. + * Emits signal: "load,error" with pointer to Ewk_Error. */ -void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error) +void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Error* error) { - evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Web_Error*>(error)); + evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Error*>(error)); } /** @@ -1362,7 +1478,7 @@ void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error) */ void ewk_view_load_finished(Evas_Object* ewkView) { - ewk_view_uri_update(ewkView); + ewk_view_url_update(ewkView); evas_object_smart_callback_call(ewkView, "load,finished", 0); } @@ -1370,11 +1486,11 @@ void ewk_view_load_finished(Evas_Object* ewkView) * @internal * Reports view provisional load failed with error information. * - * Emits signal: "load,provisional,failed" with pointer to Ewk_Web_Error. + * Emits signal: "load,provisional,failed" with pointer to Ewk_Error. */ -void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error) +void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Error* error) { - evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Web_Error*>(error)); + evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Error*>(error)); } /** @@ -1385,7 +1501,7 @@ void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* */ void ewk_view_load_provisional_redirect(Evas_Object* ewkView) { - ewk_view_uri_update(ewkView); + ewk_view_url_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0); } @@ -1404,12 +1520,23 @@ void ewk_view_load_provisional_started(Evas_Object* ewkView) // the loadingResources HashMap to start clean. _ewk_view_priv_loading_resources_clear(priv->loadingResourcesMap); - ewk_view_uri_update(ewkView); + ewk_view_url_update(ewkView); evas_object_smart_callback_call(ewkView, "load,provisional,started", 0); } /** * @internal + * Reports that the view's back / forward list has changed. + * + * Emits signal: "back,forward,list,changed". + */ +void ewk_view_back_forward_list_changed(Evas_Object* ewkView) +{ + evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0); +} + +/** + * @internal * Reports that a navigation policy decision should be taken. * * Emits signal: "policy,decision,navigation". @@ -1440,7 +1567,7 @@ Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, cons priv->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); else priv->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); - ewk_view_uri_update(ewkView); + ewk_view_url_update(ewkView); return true; } @@ -1458,6 +1585,13 @@ void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Ser } #endif // ENABLE(WEB_INTENTS_TAG) +const Evas_Object* ewk_view_from_page_get(const WebKit::WebPageProxy* page) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0); + + return pageViewMap().get(page); +} + WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); @@ -1517,14 +1651,13 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOv COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator); COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight); -Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned int maxMatchCount) +Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); - WKRetainPtr<WKStringRef> findText(AdoptWK, WKStringCreateWithUTF8CString(text)); - WKPageFindString(toAPI(priv->pageProxy.get()), findText.get(), static_cast<WKFindOptions>(options), maxMatchCount); + priv->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); return true; } @@ -1534,7 +1667,18 @@ Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView) EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - WKPageHideFindUI(toAPI(priv->pageProxy.get())); + priv->pageProxy->hideFindUI(); + + return true; +} + +Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); + + priv->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); return true; } @@ -1778,3 +1922,85 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type t return false; #endif } + +Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled) +{ +#if ENABLE(TOUCH_EVENTS) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + enabled = !!enabled; + if (priv->areTouchEventsEnabled == enabled) + return true; + + priv->areTouchEventsEnabled = enabled; + if (enabled) { + // FIXME: We have to connect touch callbacks with mouse and multi events + // because the Evas creates mouse events for first touch and multi events + // for second and third touches. Below codes should be fixed when the Evas + // supports the touch events. + // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details. + evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down, smartData); + evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up, smartData); + evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move, smartData); + evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down, smartData); + evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up, smartData); + evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move, smartData); + } else { + evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down); + evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up); + evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move); + evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down); + evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up); + evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move); + } + + return true; +#else + return false; +#endif +} + +Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView) +{ +#if ENABLE(TOUCH_EVENTS) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + return priv->areTouchEventsEnabled; +#else + return false; +#endif +} + +Eina_Bool ewk_view_inspector_show(Evas_Object* ewkView) +{ +#if ENABLE(INSPECTOR) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + WebInspectorProxy* inspector = priv->pageProxy->inspector(); + if (inspector) + inspector->show(); + + return true; +#else + return false; +#endif +} + +Eina_Bool ewk_view_inspector_close(Evas_Object* ewkView) +{ +#if ENABLE(INSPECTOR) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + + WebInspectorProxy* inspector = priv->pageProxy->inspector(); + if (inspector) + inspector->close(); + + return true; +#else + return false; +#endif +} |