Diff
Modified: trunk/Source/WebKit/ChangeLog (284999 => 285000)
--- trunk/Source/WebKit/ChangeLog 2021-10-28 20:53:57 UTC (rev 284999)
+++ trunk/Source/WebKit/ChangeLog 2021-10-28 20:57:59 UTC (rev 285000)
@@ -1,3 +1,30 @@
+2021-10-28 Adrian Perez de Castro <ape...@igalia.com>
+
+ [WPE][Qt] Do not use WebKit internals in the implementation
+ https://bugs.webkit.org/show_bug.cgi?id=232228
+
+ Reviewed by Philippe Normand.
+
+ Remove usage of GRefPtr, GUniquePtr, WTF macros, and usage of the config.h header from
+ the WPE Qt API implementation, as all the funcionality can be achieved on top of the
+ public API. This allows building the Qt plug-in in a standalone fashion, without involving
+ any of the WebKit machinery, and a sample CMakeLists.txt which does that is provided as
+ well. Distributors may prefer to build using this approach instead of as part of the whole
+ WebKit compilation process, specially if when providing split packages on top of their
+ base WPE WebKit ones.
+
+ No new tests needed.
+
+ * UIProcess/API/wpe/qt/CMakeLists.txt: Added.
+ * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp:
+ * UIProcess/API/wpe/qt/WPEQtView.cpp:
+ (WPEQtView::createWebView):
+ (jsAsyncReadyCallback):
+ * UIProcess/API/wpe/qt/WPEQtView.h:
+ * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:
+ (WPEQtViewBackend::displayImage):
+ * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp:
+
2021-10-28 Wenson Hsieh <wenson_hs...@apple.com>
Add WebPageProxy identifiers to `ViewGestures` category logging
Added: trunk/Source/WebKit/UIProcess/API/wpe/qt/CMakeLists.txt (0 => 285000)
--- trunk/Source/WebKit/UIProcess/API/wpe/qt/CMakeLists.txt (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/wpe/qt/CMakeLists.txt 2021-10-28 20:57:59 UTC (rev 285000)
@@ -0,0 +1,59 @@
+cmake_minimum_required(VERSION 3.18)
+project(qtwpe LANGUAGES CXX)
+
+find_package(Qt5 REQUIRED COMPONENTS Core Quick Gui)
+find_package(Qt5Test REQUIRED)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(Epoxy REQUIRED IMPORTED_TARGET epoxy)
+pkg_check_modules(WPEWebKit REQUIRED IMPORTED_TARGET wpe-webkit-1.0)
+pkg_check_modules(WPEBackendFDO REQUIRED IMPORTED_TARGET wpebackend-fdo-1.0>=1.5.0)
+
+add_library(qtwpe MODULE
+ WPEQtViewBackend.cpp
+ WPEQmlExtensionPlugin.cpp
+ WPEQtView.cpp
+ WPEQtViewLoadRequest.cpp
+)
+set_target_properties(qtwpe PROPERTIES
+ OUTPUT_NAME qtwpe
+ AUTOMOC ON
+)
+target_compile_definitions(qtwpe PUBLIC
+ QT_NO_KEYWORDS=1
+)
+target_link_libraries(qtwpe PRIVATE
+ PkgConfig::Epoxy
+ PkgConfig::WPEWebKit
+ PkgConfig::WPEBackendFDO
+ Qt5::Core
+ Qt5::Quick
+)
+target_include_directories(qtwpe PRIVATE
+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
+)
+
+install(
+ TARGETS
+ qtwpe
+ DESTINATION
+ "${CMAKE_INSTALL_LIBDIR}/qt5/qml/org/wpewebkit/qtwpe/"
+ COMPONENT
+ runtime
+)
+install(
+ FILES
+ qmldir
+ DESTINATION
+ "${CMAKE_INSTALL_LIBDIR}/qt5/qml/org/wpewebkit/qtwpe/"
+ COMPONENT
+ runtime
+)
+install(
+ FILES
+ WPEQtView.h
+ WPEQtViewLoadRequest.h
+ DESTINATION
+ include/wpe-webkit-1.0/wpe/qt
+ COMPONENT
+ development
+)
Modified: trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp (284999 => 285000)
--- trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp 2021-10-28 20:53:57 UTC (rev 284999)
+++ trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp 2021-10-28 20:57:59 UTC (rev 285000)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2019 Igalia S.L
+ * Copyright (C) 2018, 2019, 2021 Igalia S.L
* Copyright (C) 2018, 2019 Zodiac Inflight Innovations
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,6 @@
* Boston, MA 02110-1301, USA.
*/
-#include "config.h"
#include "WPEQmlExtensionPlugin.h"
#include "WPEQtView.h"
Modified: trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.cpp (284999 => 285000)
--- trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.cpp 2021-10-28 20:53:57 UTC (rev 284999)
+++ trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.cpp 2021-10-28 20:57:59 UTC (rev 285000)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2019 Igalia S.L
+ * Copyright (C) 2018, 2019, 2021 Igalia S.L
* Copyright (C) 2018, 2019 Zodiac Inflight Innovations
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,6 @@
* Boston, MA 02110-1301, USA.
*/
-#include "config.h"
#include "WPEQtView.h"
#include "WPEQtViewBackend.h"
@@ -31,7 +30,6 @@
#include <QtGlobal>
#include <QtPlatformHeaders/QEGLNativeContext>
#include <qpa/qplatformnativeinterface.h>
-#include <wtf/glib/GUniquePtr.h>
/*!
\qmltype WPEView
@@ -97,18 +95,20 @@
auto display = static_cast<EGLDisplay>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("egldisplay"));
auto* context = window()->openglContext();
std::unique_ptr<WPEQtViewBackend> backend = WPEQtViewBackend::create(m_size, context, display, QPointer<WPEQtView>(this));
- RELEASE_ASSERT_WITH_MESSAGE(backend, "EGL initialization failed");
- if (!backend)
+ if (!backend) {
+ qFatal("WPEQtView::createWebView(): EGL initialization failed");
return;
+ }
m_backend = backend.get();
- auto settings = adoptGRef(webkit_settings_new_with_settings("enable-developer-extras", TRUE,
- "enable-webgl", TRUE, "enable-mediasource", TRUE, nullptr));
+ auto* settings = webkit_settings_new_with_settings("enable-developer-extras", TRUE,
+ "enable-webgl", TRUE, "enable-mediasource", TRUE, nullptr);
m_webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
"backend", webkit_web_view_backend_new(m_backend->backend(), [](gpointer data) {
delete static_cast<WPEQtViewBackend*>(data);
}, backend.release()),
- "settings", settings.get(), nullptr));
+ "settings", settings, nullptr));
+ g_clear_object(&settings);
g_signal_connect_swapped(m_webView, "notify::uri", G_CALLBACK(notifyUrlChangedCallback), this);
g_signal_connect_swapped(m_webView, "notify::title", G_CALLBACK(notifyTitleChangedCallback), this);
@@ -404,11 +404,12 @@
static void jsAsyncReadyCallback(GObject* object, GAsyncResult* result, gpointer userData)
{
- GUniqueOutPtr<GError> error;
+ GError* error { nullptr };
std::unique_ptr<_javascript_CallbackData> data(reinterpret_cast<_javascript_CallbackData*>(userData));
- WebKitJavascriptResult* jsResult = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error.outPtr());
+ WebKitJavascriptResult* jsResult = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error);
if (!jsResult) {
qWarning("Error running _javascript_: %s", error->message);
+ g_error_free(error);
return;
}
@@ -425,7 +426,7 @@
QVariant variant;
// FIXME: Handle more value types?
if (jsc_value_is_string(value)) {
- GUniquePtr<gchar> strValue(jsc_value_to_string(value));
+ auto* strValue = jsc_value_to_string(value);
JSCContext* context = jsc_value_get_context(value);
JSCException* exception = jsc_context_get_exception(context);
if (exception) {
@@ -432,7 +433,8 @@
qWarning("Error running _javascript_: %s", jsc_exception_get_message(exception));
jsc_context_clear_exception(context);
} else
- variant.setValue(QString::fromUtf8(strValue.get()));
+ variant.setValue(QString::fromUtf8(strValue));
+ g_free(strValue);
}
args.append(engine->toScriptValue(variant));
data->callback.call(args);
Modified: trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.h (284999 => 285000)
--- trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.h 2021-10-28 20:53:57 UTC (rev 284999)
+++ trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.h 2021-10-28 20:57:59 UTC (rev 285000)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2019 Igalia S.L
+ * Copyright (C) 2018, 2019, 2021 Igalia S.L
* Copyright (C) 2018, 2019 Zodiac Inflight Innovations
*
* This library is free software; you can redistribute it and/or
@@ -20,14 +20,11 @@
#pragma once
-#include "config.h"
-
#include <QQmlEngine>
#include <QQuickItem>
#include <QUrl>
#include <memory>
#include <wpe/webkit.h>
-#include <wtf/glib/GRefPtr.h>
class WPEQtViewBackend;
class WPEQtViewLoadRequest;
Modified: trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp (284999 => 285000)
--- trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp 2021-10-28 20:53:57 UTC (rev 284999)
+++ trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp 2021-10-28 20:57:59 UTC (rev 285000)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2019 Igalia S.L
+ * Copyright (C) 2018, 2019, 2021 Igalia S.L
* Copyright (C) 2018, 2019 Zodiac Inflight Innovations
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,6 @@
* Boston, MA 02110-1301, USA.
*/
-#include "config.h"
#include "WPEQtViewBackend.h"
#include "WPEQtView.h"
@@ -210,7 +209,7 @@
void WPEQtViewBackend::displayImage(struct wpe_fdo_egl_exported_image* image)
{
- RELEASE_ASSERT(!m_lockedImage);
+ Q_ASSUME(!m_lockedImage);
m_lockedImage = image;
if (m_view)
m_view->triggerUpdate();
Modified: trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp (284999 => 285000)
--- trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp 2021-10-28 20:53:57 UTC (rev 284999)
+++ trunk/Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp 2021-10-28 20:57:59 UTC (rev 285000)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2019 Igalia S.L
+ * Copyright (C) 2018, 2019, 2021 Igalia S.L
* Copyright (C) 2018, 2019 Zodiac Inflight Innovations
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,6 @@
* Boston, MA 02110-1301, USA.
*/
-#include "config.h"
#include "WPEQtViewLoadRequest.h"
#include "WPEQtView.h"