diff options
Diffstat (limited to 'Source/WebKit2/UIProcess')
7 files changed, 54 insertions, 27 deletions
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h index 6064cf855..afa45846f 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h @@ -273,7 +273,7 @@ EAPI Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class *api); * * @return view object on success or @c NULL on failure */ -Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context); +EAPI Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context); /** * Creates a new EFL WebKit view object. @@ -475,7 +475,7 @@ Eina_Bool ewk_view_scale_set(Evas_Object *o, double scaleFactor, int x, int y); * * @return current scale factor in use on success or @c -1.0 on failure */ -double ewk_view_scale_get(const Evas_Object *o); +EAPI double ewk_view_scale_get(const Evas_Object *o); /** * Queries the ratio between the CSS units and device pixels when the content is unscaled. diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp index 620c9a876..211133f0a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp @@ -35,6 +35,8 @@ #include <WebCore/Language.h> #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> @@ -47,23 +49,46 @@ enum { LAST_SIGNAL }; -struct WebKitURISchemeHandler { +class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> { +public: WebKitURISchemeHandler() - : callback(0) - , userData(0) + : m_callback(0) + , m_userData(0) + , m_destroyNotify(0) { } - WebKitURISchemeHandler(WebKitURISchemeRequestCallback callback, void* userData) - : callback(callback) - , userData(userData) + WebKitURISchemeHandler(WebKitURISchemeRequestCallback callback, void* userData, GDestroyNotify destroyNotify) + : m_callback(callback) + , m_userData(userData) + , m_destroyNotify(destroyNotify) { } - WebKitURISchemeRequestCallback callback; - void* userData; + ~WebKitURISchemeHandler() + { + if (m_destroyNotify) + m_destroyNotify(m_userData); + } + + bool hasCallback() + { + return m_callback; + } + + void performCallback(WebKitURISchemeRequest* request) + { + ASSERT(m_callback); + + m_callback(request, m_userData); + } + +private: + WebKitURISchemeRequestCallback m_callback; + void* m_userData; + GDestroyNotify m_destroyNotify; }; -typedef HashMap<String, WebKitURISchemeHandler> URISchemeHandlerMap; +typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap; typedef HashMap<uint64_t, GRefPtr<WebKitURISchemeRequest> > URISchemeRequestMap; struct _WebKitWebContextPrivate { @@ -379,8 +404,9 @@ GList* webkit_web_context_get_plugins_finish(WebKitWebContext* context, GAsyncRe * webkit_web_context_register_uri_scheme: * @context: a #WebKitWebContext * @scheme: the network scheme to register - * @callback: a #WebKitURISchemeRequestCallback + * @callback: (scope async): a #WebKitURISchemeRequestCallback * @user_data: data to pass to callback function + * @user_data_destroy_func: destroy notify for @user_data * * Register @scheme in @context, so that when an URI request with @scheme is made in the * #WebKitWebContext, the #WebKitURISchemeRequestCallback registered will be called with a @@ -417,13 +443,14 @@ GList* webkit_web_context_get_plugins_finish(WebKitWebContext* context, GAsyncRe * } * </programlisting></informalexample> */ -void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const char* scheme, WebKitURISchemeRequestCallback callback, gpointer userData) +void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const char* scheme, WebKitURISchemeRequestCallback callback, gpointer userData, GDestroyNotify destroyNotify) { g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); g_return_if_fail(scheme); g_return_if_fail(callback); - context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), WebKitURISchemeHandler(callback, userData)); + RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData, destroyNotify)); + context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), handler.get()); WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme)); WKSoupRequestManagerRegisterURIScheme(context->priv->requestManager.get(), wkScheme.get()); } @@ -579,12 +606,14 @@ WKSoupRequestManagerRef webkitWebContextGetRequestManager(WebKitWebContext* cont void webkitWebContextReceivedURIRequest(WebKitWebContext* context, WebKitURISchemeRequest* request) { - WebKitURISchemeHandler handler = context->priv->uriSchemeHandlers.get(webkit_uri_scheme_request_get_scheme(request)); - if (!handler.callback) + String scheme(String::fromUTF8(webkit_uri_scheme_request_get_scheme(request))); + RefPtr<WebKitURISchemeHandler> handler = context->priv->uriSchemeHandlers.get(scheme); + ASSERT(handler.get()); + if (!handler->hasCallback()) return; context->priv->uriSchemeRequests.set(webkitURISchemeRequestGetID(request), request); - handler.callback(request, handler.userData); + handler->performCallback(request); } void webkitWebContextDidFailToLoadURIRequest(WebKitWebContext* context, uint64_t requestID) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h index 5af7f2414..3c97c71cb 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h @@ -131,7 +131,8 @@ WEBKIT_API void webkit_web_context_register_uri_scheme (WebKitWebContext *context, const gchar *scheme, WebKitURISchemeRequestCallback callback, - gpointer user_data); + gpointer user_data, + GDestroyNotify user_data_destroy_func); WEBKIT_API gboolean webkit_web_context_get_spell_checking_enabled (WebKitWebContext *context); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp index a2af7bd8d..90159b87f 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp @@ -312,7 +312,7 @@ static void testFindControllerHide(FindControllerTest* test, gconstpointer) g_assert(webViewGdkWindow); test->waitUntilWebViewDrawSignal(); - GRefPtr<GdkPixbuf> originalPixbuf = gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth); + GRefPtr<GdkPixbuf> originalPixbuf = adoptGRef(gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth)); g_assert(originalPixbuf); test->find("testing", WEBKIT_FIND_OPTIONS_NONE, 1); @@ -320,7 +320,7 @@ static void testFindControllerHide(FindControllerTest* test, gconstpointer) g_assert(test->m_textFound); test->waitUntilWebViewDrawSignal(); - GRefPtr<GdkPixbuf> highlightPixbuf = gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth); + GRefPtr<GdkPixbuf> highlightPixbuf = adoptGRef(gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth)); g_assert(highlightPixbuf); g_assert(!gdkPixbufEqual(originalPixbuf.get(), highlightPixbuf.get())); @@ -329,7 +329,7 @@ static void testFindControllerHide(FindControllerTest* test, gconstpointer) webkit_web_view_execute_editing_command(test->m_webView, "Unselect"); test->waitUntilWebViewDrawSignal(); - GRefPtr<GdkPixbuf> unhighlightPixbuf = gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth); + GRefPtr<GdkPixbuf> unhighlightPixbuf = adoptGRef(gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth)); g_assert(unhighlightPixbuf); g_assert(gdkPixbufEqual(originalPixbuf.get(), unhighlightPixbuf.get())); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp index cde0bc34a..27f6a5447 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp @@ -165,7 +165,7 @@ public: void registerURISchemeHandler(const char* scheme, const char* reply, int replyLength, const char* mimeType, bool replyWithPath = false) { m_handlersMap.set(String::fromUTF8(scheme), URISchemeHandler(reply, replyLength, mimeType, replyWithPath)); - webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this); + webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this, 0); } GRefPtr<WebKitURISchemeRequest> m_uriSchemeRequest; diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp index 0aed5d948..6250348a6 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp @@ -380,9 +380,9 @@ void QRawWebView::sendWheelEvent(QWheelEvent* event) d->m_webPageProxy->handleWheelEvent(WebKit::NativeWebWheelEvent(event, QTransform())); } -#if ENABLE(TOUCH_EVENTS) void QRawWebView::sendTouchEvent(QTouchEvent* event) { +#if ENABLE(TOUCH_EVENTS) d->m_webPageProxy->handleTouchEvent(WebKit::NativeWebTouchEvent(event, QTransform())); -} #endif +} diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h index 4608ff9d7..f8f15b06d 100644 --- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h @@ -30,7 +30,6 @@ #include <WebKit2/WKContext.h> #include <WebKit2/WKPage.h> #include <WebKit2/WKPageGroup.h> -#include <wtf/Platform.h> QT_BEGIN_NAMESPACE class QRect; @@ -95,9 +94,7 @@ public: void sendKeyEvent(QKeyEvent*); void sendMouseEvent(QMouseEvent*, int clickCount = 0); void sendWheelEvent(QWheelEvent*); -#if ENABLE(TOUCH_EVENTS) void sendTouchEvent(QTouchEvent*); -#endif private: QRawWebViewPrivate* d; |