Title: [223953] trunk
Revision
223953
Author
[email protected]
Date
2017-10-25 01:34:13 -0700 (Wed, 25 Oct 2017)

Log Message

[WPE] Remove GLib API functions which use Cairo
https://bugs.webkit.org/show_bug.cgi?id=178205

Reviewed by Michael Catanzaro.

Source/WebKit:

Add PLATFORM(GTK) guards for the parts of of the GLib API which use cairo_surface_t (web
page snapshots and favicons), and remove the affected function prototypes from public API
headers. This way, the WPE version of the API is not tied to Cairo.

* PlatformWPE.cmake:
* UIProcess/API/glib/WebKitFaviconDatabase.cpp:
* UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
* UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed):
(webkitWebViewGetProperty):
(webkitWebViewDispose):
(webkit_web_view_class_init):
(webkitWebViewLoadChanged):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/wpe/WebKitFaviconDatabase.h:
* UIProcess/API/wpe/WebKitWebView.h:
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
(webkitWebPageDidReceiveMessage):

Tools:

Add PLATFORM(GTK) guards for the API tests (or parts of them) which use cairo_surface_t (web
page snapshots and favicons) which are not available in the WPE version of the GLib API.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp:
(testNotInitialized):
(testPrivateBrowsing):
(testFaviconDatabase):
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitFindController.cpp:
(testFindControllerHide):
(beforeAll):
* TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp:
* TestWebKitAPI/glib/WebKitGLib/WebViewTest.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (223952 => 223953)


--- trunk/Source/WebKit/ChangeLog	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/ChangeLog	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,3 +1,30 @@
+2017-10-25  Adrian Perez de Castro  <[email protected]>
+
+        [WPE] Remove GLib API functions which use Cairo
+        https://bugs.webkit.org/show_bug.cgi?id=178205
+
+        Reviewed by Michael Catanzaro.
+
+        Add PLATFORM(GTK) guards for the parts of of the GLib API which use cairo_surface_t (web
+        page snapshots and favicons), and remove the affected function prototypes from public API
+        headers. This way, the WPE version of the API is not tied to Cairo.
+
+        * PlatformWPE.cmake:
+        * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
+        * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
+        * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkitWebViewConstructed):
+        (webkitWebViewGetProperty):
+        (webkitWebViewDispose):
+        (webkit_web_view_class_init):
+        (webkitWebViewLoadChanged):
+        * UIProcess/API/glib/WebKitWebViewPrivate.h:
+        * UIProcess/API/wpe/WebKitFaviconDatabase.h:
+        * UIProcess/API/wpe/WebKitWebView.h:
+        * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
+        (webkitWebPageDidReceiveMessage):
+
 2017-10-25  Zan Dobersek  <[email protected]>
 
         Make SERVICE_WORKER feature buildable on GTK, WPE

Modified: trunk/Source/WebKit/PlatformWPE.cmake (223952 => 223953)


--- trunk/Source/WebKit/PlatformWPE.cmake	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/PlatformWPE.cmake	2017-10-25 08:34:13 UTC (rev 223953)
@@ -164,7 +164,6 @@
     UIProcess/API/glib/WebKitFormSubmissionRequest.cpp
     UIProcess/API/glib/WebKitGeolocationPermissionRequest.cpp
     UIProcess/API/glib/WebKitGeolocationProvider.cpp
-    UIProcess/API/glib/WebKitIconLoadingClient.cpp
     UIProcess/API/glib/WebKitInjectedBundleClient.cpp
     UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp
     UIProcess/API/glib/WebKitJavascriptResult.cpp

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2012, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -120,6 +120,7 @@
         G_TYPE_STRING);
 }
 
+#if PLATFORM(GTK)
 struct GetFaviconSurfaceAsyncData {
     ~GetFaviconSurfaceAsyncData()
     {
@@ -183,6 +184,7 @@
     }
     deletePendingIconRequests(database, pendingIconRequests, pageURL);
 }
+#endif
 
 static void webkitFaviconDatabaseSetIconURLForPageURL(WebKitFaviconDatabase* database, const String& iconURL, const String& pageURL)
 {
@@ -225,7 +227,9 @@
 
     void didImportIconDataForPageURL(const String& pageURL) override
     {
+#if PLATFORM(GTK)
         processPendingIconsForPageURL(m_database, pageURL);
+#endif
         String iconURL = m_database->priv->iconDatabase->synchronousIconURLForPageURL(pageURL);
         webkitFaviconDatabaseSetIconURLForPageURL(m_database, iconURL, pageURL);
     }
@@ -282,6 +286,7 @@
         database->priv->iconDatabase->setPrivateBrowsingEnabled(enabled);
 }
 
+#if PLATFORM(GTK)
 void webkitFaviconDatabaseGetLoadDecisionForIcon(WebKitFaviconDatabase* database, const LinkIcon& icon, const String& pageURL, Function<void(bool)>&& completionHandler)
 {
     if (!webkitFaviconDatabaseIsOpen(database)) {
@@ -330,6 +335,7 @@
 
     return icons;
 }
+#endif
 
 GQuark webkit_favicon_database_error_quark(void)
 {
@@ -336,6 +342,7 @@
     return g_quark_from_static_string("WebKitFaviconDatabaseError");
 }
 
+#if PLATFORM(GTK)
 /**
  * webkit_favicon_database_get_favicon:
  * @database: a #WebKitFaviconDatabase
@@ -442,6 +449,7 @@
     GetFaviconSurfaceAsyncData* data = ""
     return cairo_surface_reference(data->icon.get());
 }
+#endif
 
 /**
  * webkit_favicon_database_get_favicon_uri:

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2012, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -27,5 +27,7 @@
 void webkitFaviconDatabaseOpen(WebKitFaviconDatabase*, const String& path);
 bool webkitFaviconDatabaseIsOpen(WebKitFaviconDatabase*);
 void webkitFaviconDatabaseSetPrivateBrowsingEnabled(WebKitFaviconDatabase*, bool);
+#if PLATFORM(GTK)
 void webkitFaviconDatabaseGetLoadDecisionForIcon(WebKitFaviconDatabase*, const WebCore::LinkIcon&, const String&, Function<void(bool)>&&);
 void webkitFaviconDatabaseSetIconForPageURL(WebKitFaviconDatabase*, const WebCore::LinkIcon&, API::Data&, const String&);
+#endif

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitInjectedBundleClient.cpp (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitInjectedBundleClient.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitInjectedBundleClient.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Igalia S.L.
+ * Copyright (C) 2013, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -104,10 +104,12 @@
                 webkitWebResourceFailed(resource.get(), resourceError.get());
 
             webkitWebViewRemoveLoadingWebResource(webView, resourceIdentifier->value());
+#if PLATFORM(GTK)
         } else if (g_str_equal(messageName, "DidGetSnapshot")) {
             API::UInt64* callbackID = static_cast<API::UInt64*>(message.get("CallbackID"));
             WebImage* image = static_cast<WebImage*>(message.get("Snapshot"));
             webKitWebViewDidReceiveSnapshot(webView, callbackID->value(), image);
+#endif
         } else
             ASSERT_NOT_REACHED();
     }

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -2,6 +2,7 @@
  * Copyright (C) 2011 Igalia S.L.
  * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
  * Copyright (C) 2014 Collabora Ltd.
+ * Copyright (C) 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -166,7 +167,11 @@
     PROP_USER_CONTENT_MANAGER,
     PROP_TITLE,
     PROP_ESTIMATED_LOAD_PROGRESS,
+
+#if PLATFORM(GTK)
     PROP_FAVICON,
+#endif
+
     PROP_URI,
     PROP_ZOOM_LEVEL,
     PROP_IS_LOADING,
@@ -225,14 +230,16 @@
 
 #if PLATFORM(GTK)
     GRefPtr<WebKitWebInspector> inspector;
-#endif
 
     RefPtr<cairo_surface_t> favicon;
     GRefPtr<GCancellable> faviconCancellable;
+
     CString faviconURI;
     unsigned long faviconChangedHandlerID;
 
     SnapshotResultsMap snapshotResultsMap;
+#endif
+
     GRefPtr<WebKitAuthenticationRequest> authenticationRequest;
 
     GRefPtr<WebKitWebsiteDataManager> websiteDataManager;
@@ -434,6 +441,7 @@
     getPage(webView).setCustomUserAgent(String::fromUTF8(webkit_settings_get_user_agent(settings)));
 }
 
+#if PLATFORM(GTK)
 static void webkitWebViewUpdateFavicon(WebKitWebView* webView, cairo_surface_t* favicon)
 {
     WebKitWebViewPrivate* priv = webView->priv;
@@ -491,6 +499,7 @@
 
     webkitWebViewUpdateFaviconURI(webView, faviconURI);
 }
+#endif
 
 static bool webkitWebViewIsConstructed(WebKitWebView* webView)
 {
@@ -530,6 +539,7 @@
     g_signal_handlers_disconnect_by_func(settings, reinterpret_cast<gpointer>(userAgentChanged), webView);
 }
 
+#if PLATFORM(GTK)
 static void webkitWebViewWatchForChangesInFavicon(WebKitWebView* webView)
 {
     WebKitWebViewPrivate* priv = webView->priv;
@@ -547,6 +557,7 @@
         g_signal_handler_disconnect(webkit_web_context_get_favicon_database(priv->context.get()), priv->faviconChangedHandlerID);
     priv->faviconChangedHandlerID = 0;
 }
+#endif
 
 #if USE(LIBNOTIFY)
 static const char* gNotifyNotificationID = "wk-notify-notification";
@@ -641,7 +652,10 @@
     attachPolicyClientToView(webView);
     attachContextMenuClientToView(webView);
     attachFormClientToView(webView);
+
+#if PLATFORM(GTK)
     attachIconLoadingClientToView(webView);
+#endif
 
 #if PLATFORM(WPE)
     priv->view->setClient(std::make_unique<WebViewClient>(webView));
@@ -717,9 +731,11 @@
     case PROP_ESTIMATED_LOAD_PROGRESS:
         g_value_set_double(value, webkit_web_view_get_estimated_load_progress(webView));
         break;
+#if PLATFORM(GTK)
     case PROP_FAVICON:
         g_value_set_pointer(value, webkit_web_view_get_favicon(webView));
         break;
+#endif
     case PROP_URI:
         g_value_set_string(value, webkit_web_view_get_uri(webView));
         break;
@@ -749,10 +765,14 @@
 static void webkitWebViewDispose(GObject* object)
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
+
+#if PLATFORM(GTK)
     webkitWebViewCancelFaviconRequest(webView);
-    webkitWebViewDisconnectSettingsSignalHandlers(webView);
     webkitWebViewDisconnectFaviconDatabaseSignalHandlers(webView);
+#endif
 
+    webkitWebViewDisconnectSettingsSignalHandlers(webView);
+
     if (webView->priv->loadObserver) {
         getPage(webView).pageLoadState().removeObserver(*webView->priv->loadObserver);
         webView->priv->loadObserver.reset();
@@ -899,6 +919,7 @@
                                                         _("An estimate of the percent completion for a document load"),
                                                         0.0, 1.0, 0.0,
                                                         WEBKIT_PARAM_READABLE));
+#if PLATFORM(GTK)
     /**
      * WebKitWebView:favicon:
      *
@@ -911,6 +932,8 @@
                                                          _("Favicon"),
                                                          _("The favicon associated to the view, if any"),
                                                          WEBKIT_PARAM_READABLE));
+#endif
+
     /**
      * WebKitWebView:uri:
      *
@@ -1907,12 +1930,15 @@
     WebKitWebViewPrivate* priv = webView->priv;
     switch (loadEvent) {
     case WEBKIT_LOAD_STARTED:
+#if PLATFORM(GTK)
         webkitWebViewCancelFaviconRequest(webView);
         webkitWebViewWatchForChangesInFavicon(webView);
+#endif
         webkitWebViewCancelAuthenticationRequest(webView);
         priv->loadingResourcesMap.clear();
         priv->mainResource = nullptr;
         break;
+#if PLATFORM(GTK)
     case WEBKIT_LOAD_COMMITTED: {
         WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(priv->context.get());
         GUniquePtr<char> faviconURI(webkit_favicon_database_get_favicon_uri(database, priv->activeURI.data()));
@@ -1919,6 +1945,7 @@
         webkitWebViewUpdateFaviconURI(webView, faviconURI.get());
         break;
     }
+#endif
     case WEBKIT_LOAD_FINISHED:
         webkitWebViewCancelAuthenticationRequest(webView);
         break;
@@ -1953,6 +1980,7 @@
     g_signal_emit(webView, signals[LOAD_CHANGED], 0, WEBKIT_LOAD_FINISHED);
 }
 
+#if PLATFORM(GTK)
 void webkitWebViewGetLoadDecisionForIcon(WebKitWebView* webView, const LinkIcon& icon, Function<void(bool)>&& completionHandler)
 {
     WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(webView->priv->context.get());
@@ -1964,6 +1992,7 @@
     WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(webView->priv->context.get());
     webkitFaviconDatabaseSetIconForPageURL(database, icon, iconData, getPage(webView).pageLoadState().activeURL());
 }
+#endif
 
 WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView* webView, const WindowFeatures& windowFeatures, WebKitNavigationAction* navigationAction)
 {
@@ -2814,6 +2843,7 @@
     return webView->priv->activeURI.data();
 }
 
+#if PLATFORM(GTK)
 /**
  * webkit_web_view_get_favicon:
  * @web_view: a #WebKitWebView
@@ -2833,6 +2863,7 @@
 
     return webView->priv->favicon.get();
 }
+#endif
 
 /**
  * webkit_web_view_get_custom_charset:
@@ -3629,6 +3660,7 @@
     return !!certificateInfo.certificate();
 }
 
+#if PLATFORM(GTK)
 void webKitWebViewDidReceiveSnapshot(WebKitWebView* webView, uint64_t callbackID, WebImage* webImage)
 {
     GRefPtr<GTask> task = webView->priv->snapshotResultsMap.take(callbackID);
@@ -3721,6 +3753,7 @@
 
     return static_cast<cairo_surface_t*>(g_task_propagate_pointer(G_TASK(result), error));
 }
+#endif
 
 void webkitWebViewWebProcessCrashed(WebKitWebView* webView)
 {

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2011, 2017 Igalia S.L.
  * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,8 +43,10 @@
 void webkitWebViewLoadChanged(WebKitWebView*, WebKitLoadEvent);
 void webkitWebViewLoadFailed(WebKitWebView*, WebKitLoadEvent, const char* failingURI, GError*);
 void webkitWebViewLoadFailedWithTLSErrors(WebKitWebView*, const char* failingURI, GError*, GTlsCertificateFlags, GTlsCertificate*);
+#if PLATFORM(GTK)
 void webkitWebViewGetLoadDecisionForIcon(WebKitWebView*, const WebCore::LinkIcon&, Function<void(bool)>&&);
 void webkitWebViewSetIcon(WebKitWebView*, const WebCore::LinkIcon&, API::Data&);
+#endif
 WebKit::WebPageProxy* webkitWebViewCreateNewPage(WebKitWebView*, const WebCore::WindowFeatures&, WebKitNavigationAction*);
 void webkitWebViewReadyToShowPage(WebKitWebView*);
 void webkitWebViewRunAsModal(WebKitWebView*);
@@ -68,7 +70,9 @@
 void webkitWebViewResourceLoadStarted(WebKitWebView*, WebKit::WebFrameProxy*, uint64_t resourceIdentifier, WebKitURIRequest*);
 void webkitWebViewRunFileChooserRequest(WebKitWebView*, WebKitFileChooserRequest*);
 WebKitWebResource* webkitWebViewGetLoadingWebResource(WebKitWebView*, uint64_t resourceIdentifier);
+#if PLATFORM(GTK)
 void webKitWebViewDidReceiveSnapshot(WebKitWebView*, uint64_t callbackID, WebKit::WebImage*);
+#endif
 void webkitWebViewRemoveLoadingWebResource(WebKitWebView*, uint64_t resourceIdentifier);
 void webkitWebViewEnterFullScreen(WebKitWebView*);
 void webkitWebViewExitFullScreen(WebKitWebView*);

Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitFaviconDatabase.h (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitFaviconDatabase.h	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitFaviconDatabase.h	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2012, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,6 @@
 #ifndef WebKitFaviconDatabase_h
 #define WebKitFaviconDatabase_h
 
-#include <cairo.h>
 #include <gio/gio.h>
 #include <glib-object.h>
 #include <wpe/WebKitDefines.h>
@@ -78,16 +77,6 @@
 WEBKIT_API GType
 webkit_favicon_database_get_type           (void);
 
-WEBKIT_API void
-webkit_favicon_database_get_favicon        (WebKitFaviconDatabase *database,
-                                            const gchar           *page_uri,
-                                            GCancellable          *cancellable,
-                                            GAsyncReadyCallback    callback,
-                                            gpointer               user_data);
-WEBKIT_API cairo_surface_t *
-webkit_favicon_database_get_favicon_finish (WebKitFaviconDatabase *database,
-                                            GAsyncResult          *result,
-                                            GError               **error);
 WEBKIT_API gchar *
 webkit_favicon_database_get_favicon_uri    (WebKitFaviconDatabase *database,
                                             const gchar           *page_uri);

Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h (223952 => 223953)


--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h	2017-10-25 08:34:13 UTC (rev 223953)
@@ -2,7 +2,7 @@
  * Copyright (C) 2007 Holger Hans Peter Freyther
  * Copyright (C) 2007, 2008 Alp Toker <[email protected]>
  * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2011, 2017 Igalia S.L.
  * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -152,37 +152,6 @@
     WEBKIT_INSECURE_CONTENT_DISPLAYED
 } WebKitInsecureContentEvent;
 
-/**
- * WebKitSnapshotOptions:
- * @WEBKIT_SNAPSHOT_OPTIONS_NONE: Do not include any special options.
- * @WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING: Whether to include in the
- * snapshot the highlight of the selected content.
- * @WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND: Do not fill the background with white before
- * rendering the snapshot. Since 2.8
- *
- * Enum values used to specify options when taking a snapshot
- * from a #WebKitWebView.
- */
-typedef enum {
-  WEBKIT_SNAPSHOT_OPTIONS_NONE = 0,
-  WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING = 1 << 0,
-  WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND = 1 << 1,
-} WebKitSnapshotOptions;
-
-/**
- * WebKitSnapshotRegion:
- * @WEBKIT_SNAPSHOT_REGION_VISIBLE: Specifies a snapshot only for the area that is
- * visible in the webview
- * @WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT: A snapshot of the entire document.
- *
- * Enum values used to specify the region from which to get a #WebKitWebView
- * snapshot
- */
-typedef enum {
-  WEBKIT_SNAPSHOT_REGION_VISIBLE = 0,
-  WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
-} WebKitSnapshotRegion;
-
 struct _WebKitWebView {
     GObject parent;
 
@@ -361,9 +330,6 @@
 WEBKIT_API const gchar *
 webkit_web_view_get_uri                              (WebKitWebView             *web_view);
 
-WEBKIT_API cairo_surface_t *
-webkit_web_view_get_favicon                          (WebKitWebView             *web_view);
-
 WEBKIT_API const gchar *
 webkit_web_view_get_custom_charset                   (WebKitWebView             *web_view);
 
@@ -477,19 +443,7 @@
 webkit_web_view_get_tls_info                         (WebKitWebView             *web_view,
                                                       GTlsCertificate          **certificate,
                                                       GTlsCertificateFlags      *errors);
-WEBKIT_API void
-webkit_web_view_get_snapshot                         (WebKitWebView             *web_view,
-                                                      WebKitSnapshotRegion       region,
-                                                      WebKitSnapshotOptions      options,
-                                                      GCancellable              *cancellable,
-                                                      GAsyncReadyCallback        callback,
-                                                      gpointer                   user_data);
 
-WEBKIT_API cairo_surface_t *
-webkit_web_view_get_snapshot_finish                  (WebKitWebView             *web_view,
-                                                      GAsyncResult              *result,
-                                                      GError                   **error);
-
 WEBKIT_API WebKitUserContentManager *
 webkit_web_view_get_user_content_manager             (WebKitWebView             *web_view);
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp (223952 => 223953)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2012, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -585,6 +585,7 @@
 
 void webkitWebPageDidReceiveMessage(WebKitWebPage* page, const String& messageName, API::Dictionary& message)
 {
+#if PLATFORM(GTK)
     if (messageName == String("GetSnapshot")) {
         SnapshotOptions snapshotOptions = static_cast<SnapshotOptions>(static_cast<API::UInt64*>(message.get("SnapshotOptions"))->value());
         uint64_t callbackID = static_cast<API::UInt64*>(message.get("CallbackID"))->value();
@@ -623,6 +624,7 @@
         messageReply.set("Snapshot", snapshotImage);
         WebProcess::singleton().injectedBundle()->postMessage("WebPage.DidGetSnapshot", API::Dictionary::create(WTFMove(messageReply)).ptr());
     } else
+#endif
         ASSERT_NOT_REACHED();
 }
 

Modified: trunk/Tools/ChangeLog (223952 => 223953)


--- trunk/Tools/ChangeLog	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Tools/ChangeLog	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,3 +1,23 @@
+2017-10-25  Adrian Perez de Castro  <[email protected]>
+
+        [WPE] Remove GLib API functions which use Cairo
+        https://bugs.webkit.org/show_bug.cgi?id=178205
+
+        Reviewed by Michael Catanzaro.
+
+        Add PLATFORM(GTK) guards for the API tests (or parts of them) which use cairo_surface_t (web
+        page snapshots and favicons) which are not available in the WPE version of the GLib API.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp:
+        (testNotInitialized):
+        (testPrivateBrowsing):
+        (testFaviconDatabase):
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitFindController.cpp:
+        (testFindControllerHide):
+        (beforeAll):
+        * TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp:
+        * TestWebKitAPI/glib/WebKitGLib/WebViewTest.h:
+
 2017-10-25  Zan Dobersek  <[email protected]>
 
         Make SERVICE_WORKER feature buildable on GTK, WPE

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp (223952 => 223953)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2012, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -41,8 +41,10 @@
 
     ~FaviconDatabaseTest()
     {
+#if PLATFORM(GTK)
         if (m_favicon)
             cairo_surface_destroy(m_favicon);
+#endif
 
         WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(m_webContext.get());
         g_signal_handlers_disconnect_matched(database, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
@@ -65,6 +67,7 @@
         test->quitMainLoop();
     }
 
+#if PLATFORM(GTK)
     static void getFaviconCallback(GObject* sourceObject, GAsyncResult* result, void* data)
     {
         FaviconDatabaseTest* test = static_cast<FaviconDatabaseTest*>(data);
@@ -80,9 +83,11 @@
         g_main_loop_run(m_mainLoop);
         g_signal_handler_disconnect(m_webView, handlerID);
     }
+#endif
 
     void getFaviconForPageURIAndWaitUntilReady(const char* pageURI)
     {
+#if PLATFORM(GTK)
         if (m_favicon) {
             cairo_surface_destroy(m_favicon);
             m_favicon = 0;
@@ -90,6 +95,8 @@
 
         WebKitFaviconDatabase* database = webkit_web_context_get_favicon_database(m_webContext.get());
         webkit_favicon_database_get_favicon(database, pageURI, 0, getFaviconCallback, this);
+#endif
+
         g_main_loop_run(m_mainLoop);
     }
 
@@ -103,6 +110,7 @@
     }
 
     cairo_surface_t* m_favicon;
+
     CString m_faviconURI;
     GUniqueOutPtr<GError> m_error;
     bool m_faviconNotificationReceived;
@@ -189,6 +197,7 @@
     g_assert(test->m_error);
 }
 
+#if PLATFORM(GTK)
 static void testGetFavicon(FaviconDatabaseTest* test)
 {
     // We need to load the page first to ensure the icon data will be
@@ -231,6 +240,7 @@
     g_assert(!test->m_favicon);
     g_assert(test->m_error);
 }
+#endif
 
 static void testGetFaviconURI(FaviconDatabaseTest* test)
 {
@@ -241,6 +251,7 @@
     ASSERT_CMP_CSTRING(iconURI.get(), ==, kServer->getURIForPath("/icon/favicon.ico"));
 }
 
+#if PLATFORM(GTK)
 static void testWebViewFavicon(FaviconDatabaseTest* test)
 {
     test->m_faviconURI = CString();
@@ -260,6 +271,7 @@
     g_assert_cmpuint(cairo_image_surface_get_width(iconFromWebView), ==, 16);
     g_assert_cmpuint(cairo_image_surface_get_height(iconFromWebView), ==, 16);
 }
+#endif
 
 static void testFaviconDatabase(FaviconDatabaseTest* test, gconstpointer)
 {
@@ -268,9 +280,13 @@
     testNotInitialized(test);
     testSetDirectory(test);
     testPrivateBrowsing(test);
+
+#if PLATFORM(GTK)
     testGetFavicon(test);
+    testWebViewFavicon(test);
+#endif
+
     testGetFaviconURI(test);
-    testWebViewFavicon(test);
     testClearDatabase(test);
 }
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFindController.cpp (223952 => 223953)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFindController.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFindController.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Igalia S.L.
+ * Copyright (C) 2012, 2017 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -257,14 +257,15 @@
     g_assert(test->m_textFound);
 }
 
+// TODO: Rewrite this test to avoid using snapshots so it can be re-enabled
+// for WPE or, alternatively, make snapshots work for WPE as well.
+#if PLATFORM(GTK)
 static void testFindControllerHide(FindControllerTest* test, gconstpointer)
 {
     test->loadHtml(testString, 0);
     test->waitUntilLoadFinished();
 
-#if PLATFORM(GTK)
     test->showInWindowAndWaitUntilMapped();
-#endif
 
     cairo_surface_t* originalSurface = cairo_surface_reference(
         test->getSnapshotAndWaitUntilReady(WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT, WEBKIT_SNAPSHOT_OPTIONS_NONE));
@@ -292,6 +293,7 @@
     cairo_surface_destroy(highlightSurface);
     cairo_surface_destroy(unhighlightSurface);
 }
+#endif
 
 static void testFindControllerInstance(FindControllerTest* test, gconstpointer)
 {
@@ -327,7 +329,9 @@
     FindControllerTest::add("WebKitFindController", "previous", testFindControllerPrevious);
     FindControllerTest::add("WebKitFindController", "counted-matches", testFindControllerCountedMatches);
     FindControllerTest::add("WebKitFindController", "options", testFindControllerOptions);
+#if PLATFORM(GTK)
     FindControllerTest::add("WebKitFindController", "hide", testFindControllerHide);
+#endif
 }
 
 void afterAll()

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp (223952 => 223953)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2011, 2017 Igalia S.L.
  * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -369,6 +369,7 @@
     return JSValueIsUndefined(context, value);
 }
 
+#if PLATFORM(GTK)
 static void onSnapshotReady(WebKitWebView* web_view, GAsyncResult* res, WebViewTest* test)
 {
     GUniqueOutPtr<GError> error;
@@ -388,6 +389,7 @@
     g_main_loop_run(m_mainLoop);
     return m_surface;
 }
+#endif
 
 bool WebViewTest::runWebProcessTest(const char* suiteName, const char* testName)
 {

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.h (223952 => 223953)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.h	2017-10-25 07:39:05 UTC (rev 223952)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.h	2017-10-25 08:34:13 UTC (rev 223953)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2011, 2017 Igalia S.L.
  * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -80,7 +80,9 @@
     static bool _javascript_ResultIsNull(WebKitJavascriptResult*);
     static bool _javascript_ResultIsUndefined(WebKitJavascriptResult*);
 
+#if PLATFORM(GTK)
     cairo_surface_t* getSnapshotAndWaitUntilReady(WebKitSnapshotRegion, WebKitSnapshotOptions);
+#endif
 
     bool runWebProcessTest(const char* suiteName, const char* testName);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to