Diff
Modified: trunk/Source/WebKit2/ChangeLog (218690 => 218691)
--- trunk/Source/WebKit2/ChangeLog 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-22 11:55:07 UTC (rev 218691)
@@ -1,5 +1,32 @@
2017-06-22 Carlos Garcia Campos <[email protected]>
+ [WPE] Downloads never have a web view associated in WPE
+ https://bugs.webkit.org/show_bug.cgi?id=173709
+
+ Reviewed by Žan Doberšek.
+
+ Convert the WPE view client into an API client and add handleDownloadRequest(). WebKitWebView now uses it to
+ associate itself to the download like the GTK+ port does.
+
+ * PlatformWPE.cmake:
+ * UIProcess/API/C/wpe/WKView.cpp:
+ (WKViewSetViewClient): Add C API client implementation here.
+ * UIProcess/API/glib/WebKitWebView.cpp:
+ (webkitWebViewConstructed): Set the view client in WPE.
+ * UIProcess/API/wpe/APIViewClient.h: Renamed from Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h.
+ (API::ViewClient::frameDisplayed):
+ (API::ViewClient::handleDownloadRequest):
+ * UIProcess/API/wpe/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::handleDownloadRequest): Call WKWPE::View::handleDownloadRequest().
+ * UIProcess/API/wpe/WPEView.cpp:
+ (WKWPE::View::View): Initialize the view client.
+ (WKWPE::View::setClient): Set or reset the client.
+ (WKWPE::View::handleDownloadRequest): Notify the client.
+ * UIProcess/API/wpe/WPEView.h:
+ * UIProcess/API/wpe/WPEViewClient.cpp: Removed.
+
+2017-06-22 Carlos Garcia Campos <[email protected]>
+
[WPE] Page should be closed on WebKitWebView dispose
https://bugs.webkit.org/show_bug.cgi?id=173707
Modified: trunk/Source/WebKit2/PlatformWPE.cmake (218690 => 218691)
--- trunk/Source/WebKit2/PlatformWPE.cmake 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/PlatformWPE.cmake 2017-06-22 11:55:07 UTC (rev 218691)
@@ -193,7 +193,6 @@
UIProcess/API/wpe/ScrollGestureController.cpp
UIProcess/API/wpe/WebKitWebViewWPE.cpp
UIProcess/API/wpe/WPEView.cpp
- UIProcess/API/wpe/WPEViewClient.cpp
UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp
Modified: trunk/Source/WebKit2/UIProcess/API/C/wpe/WKView.cpp (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/C/wpe/WKView.cpp 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/C/wpe/WKView.cpp 2017-06-22 11:55:07 UTC (rev 218691)
@@ -27,6 +27,7 @@
#include "WKView.h"
#include "APIPageConfiguration.h"
+#include "APIViewClient.h"
#include "PageClientImpl.h"
#include "WKAPICast.h"
#include "WPEView.h"
@@ -33,6 +34,12 @@
using namespace WebKit;
+namespace API {
+template<> struct ClientTraits<WKViewClientBase> {
+ typedef std::tuple<WKViewClientV0> Versions;
+};
+}
+
WKViewRef WKViewCreate(WKPageConfigurationRef configuration)
{
return toAPI(WKWPE::View::create(nullptr, *toImpl(configuration)));
@@ -55,5 +62,21 @@
void WKViewSetViewClient(WKViewRef view, const WKViewClientBase* client)
{
- toImpl(view)->initializeClient(client);
+ class ViewClient final : public API::Client<WKViewClientBase>, public API::ViewClient {
+ public:
+ explicit ViewClient(const WKViewClientBase* client)
+ {
+ initialize(client);
+ }
+
+ private:
+ void frameDisplayed(WKWPE::View& view) override
+ {
+ if (!m_client.frameDisplayed)
+ return;
+ m_client.frameDisplayed(toAPI(&view), m_client.base.clientInfo);
+ }
+ };
+
+ toImpl(view)->setClient(std::make_unique<ViewClient>(client));
}
Modified: trunk/Source/WebKit2/UIProcess/API/glib/WebKitWebView.cpp (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/glib/WebKitWebView.cpp 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/glib/WebKitWebView.cpp 2017-06-22 11:55:07 UTC (rev 218691)
@@ -77,6 +77,7 @@
#endif
#if PLATFORM(WPE)
+#include "APIViewClient.h"
#include "WPEView.h"
#endif
@@ -335,6 +336,24 @@
WebKitWebView* m_webView;
};
+#if PLATFORM(WPE)
+class WebViewClient final : public API::ViewClient {
+public:
+ explicit WebViewClient(WebKitWebView* webView)
+ : m_webView(webView)
+ {
+ }
+
+private:
+ void handleDownloadRequest(WKWPE::View&, DownloadProxy& downloadProxy) override
+ {
+ webkitWebViewHandleDownloadRequest(m_webView, &downloadProxy);
+ }
+
+ WebKitWebView* m_webView;
+};
+#endif
+
static gboolean webkitWebViewLoadFail(WebKitWebView* webView, WebKitLoadEvent, const char* failingURI, GError* error)
{
if (g_error_matches(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)
@@ -615,6 +634,10 @@
attachContextMenuClientToView(webView);
attachFormClientToView(webView);
+#if PLATFORM(WPE)
+ priv->view->setClient(std::make_unique<WebViewClient>(webView));
+#endif
+
// This needs to be after attachUIClientToView() because WebPageProxy::setUIClient() calls setCanRunModal() with true.
// See https://bugs.webkit.org/show_bug.cgi?id=135412.
webkitWebViewUpdateSettings(webView);
Copied: trunk/Source/WebKit2/UIProcess/API/wpe/APIViewClient.h (from rev 218690, trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h) (0 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/wpe/APIViewClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/wpe/APIViewClient.h 2017-06-22 11:55:07 UTC (rev 218691)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebKit {
+class DownloadProxy;
+}
+
+namespace WKWPE {
+class View;
+}
+
+namespace API {
+
+class ViewClient {
+public:
+ virtual ~ViewClient() = default;
+
+ virtual void frameDisplayed(WKWPE::View&) { }
+ virtual void handleDownloadRequest(WKWPE::View&, WebKit::DownloadProxy&) { }
+};
+
+} // namespace API
Modified: trunk/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/wpe/PageClientImpl.cpp 2017-06-22 11:55:07 UTC (rev 218691)
@@ -112,8 +112,10 @@
{
}
-void PageClientImpl::handleDownloadRequest(DownloadProxy*)
+void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
{
+ ASSERT(download);
+ m_view.handleDownloadRequest(*download);
}
void PageClientImpl::didChangeContentSize(const WebCore::IntSize&)
Modified: trunk/Source/WebKit2/UIProcess/API/wpe/WPEView.cpp (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/wpe/WPEView.cpp 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/wpe/WPEView.cpp 2017-06-22 11:55:07 UTC (rev 218691)
@@ -27,6 +27,7 @@
#include "WPEView.h"
#include "APIPageConfiguration.h"
+#include "APIViewClient.h"
#include "DrawingAreaProxy.h"
#include "NativeWebKeyboardEvent.h"
#include "NativeWebMouseEvent.h"
@@ -41,7 +42,8 @@
namespace WKWPE {
View::View(struct wpe_view_backend* backend, const API::PageConfiguration& baseConfiguration)
- : m_pageClient(std::make_unique<PageClientImpl>(*this))
+ : m_client(std::make_unique<API::ViewClient>())
+ , m_pageClient(std::make_unique<PageClientImpl>(*this))
, m_size { 800, 600 }
, m_viewStateFlags(WebCore::ActivityState::WindowIsActive | WebCore::ActivityState::IsFocused | WebCore::ActivityState::IsVisible | WebCore::ActivityState::IsInWindow)
, m_compositingManagerProxy(*this)
@@ -130,16 +132,24 @@
wpe_view_backend_destroy(m_backend);
}
-void View::initializeClient(const WKViewClientBase* client)
+void View::setClient(std::unique_ptr<API::ViewClient>&& client)
{
- m_client.initialize(client);
+ if (!client)
+ m_client = std::make_unique<API::ViewClient>();
+ else
+ m_client = WTFMove(client);
}
void View::frameDisplayed()
{
- m_client.frameDisplayed(*this);
+ m_client->frameDisplayed(*this);
}
+void View::handleDownloadRequest(DownloadProxy& download)
+{
+ m_client->handleDownloadRequest(*this, download);
+}
+
void View::setSize(const WebCore::IntSize& size)
{
m_size = size;
Modified: trunk/Source/WebKit2/UIProcess/API/wpe/WPEView.h (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/wpe/WPEView.h 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/wpe/WPEView.h 2017-06-22 11:55:07 UTC (rev 218691)
@@ -28,7 +28,6 @@
#include "APIObject.h"
#include "CompositingManagerProxy.h"
#include "PageClientImpl.h"
-#include "WPEViewClient.h"
#include "WebPageProxy.h"
#include <WebCore/ActivityState.h>
#include <memory>
@@ -36,7 +35,12 @@
struct wpe_view_backend;
+namespace API {
+class ViewClient;
+}
+
namespace WebKit {
+class DownloadProxy;
class WebPageGroup;
class WebProcessPool;
}
@@ -52,8 +56,9 @@
virtual ~View();
// Client methods
- void initializeClient(const WKViewClientBase*);
+ void setClient(std::unique_ptr<API::ViewClient>&&);
void frameDisplayed();
+ void handleDownloadRequest(WebKit::DownloadProxy&);
WebKit::WebPageProxy& page() { return *m_pageProxy; }
@@ -71,7 +76,7 @@
void setSize(const WebCore::IntSize&);
- ViewClient m_client;
+ std::unique_ptr<API::ViewClient> m_client;
std::unique_ptr<WebKit::PageClientImpl> m_pageClient;
RefPtr<WebKit::WebPageProxy> m_pageProxy;
Deleted: trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.cpp (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.cpp 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.cpp 2017-06-22 11:55:07 UTC (rev 218691)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WPEViewClient.h"
-
-#include "WKAPICast.h"
-#include "WKBase.h"
-#include "WPEView.h"
-
-using namespace WebKit;
-
-namespace WKWPE {
-
-void ViewClient::frameDisplayed(View& view)
-{
- if (m_client.frameDisplayed)
- m_client.frameDisplayed(toAPI(&view), m_client.base.clientInfo);
-}
-
-} // namespace WKWPE
Deleted: trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h (218690 => 218691)
--- trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h 2017-06-22 11:53:33 UTC (rev 218690)
+++ trunk/Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h 2017-06-22 11:55:07 UTC (rev 218691)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2016 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "APIClient.h"
-#include <WebKit/WKView.h>
-
-namespace API {
-template<> struct ClientTraits<WKViewClientBase> {
- typedef std::tuple<WKViewClientV0> Versions;
-};
-}
-
-namespace WKWPE {
-
-class View;
-
-class ViewClient : public API::Client<WKViewClientBase> {
-public:
- void frameDisplayed(View&);
-};
-
-} // namespace WebKit