Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scarthgap] Backport Updates for WebKitGTK and WPEWebKit 2.46.4 #526

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion recipes-browser/images/webkit-dev-ci-tools.bb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ SDK_NATIVE_TOOLS = " \
nativesdk-wayland-dev \
"

TOOLCHAIN_HOST_TASK:append = "${SDK_NATIVE_TOOLS}"
TOOLCHAIN_HOST_TASK:append = " ${SDK_NATIVE_TOOLS}"
TOOLCHAIN_TARGET_TASK:append = " openjpeg-staticdev libjxl"
TOOLCHAIN_TARGET_TASK:remove = "target-sdk-provides-dummy"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
From bfb9d664b19813a407d5a0eaf477c28cdf96d850 Mon Sep 17 00:00:00 2001
From: Philippe Normand <[email protected]>
Date: Wed, 27 Nov 2024 07:20:41 -0800
Subject: [PATCH] Build fixes for gbm disabled and release logs disabled
https://bugs.webkit.org/show_bug.cgi?id=283750

Reviewed by Michael Catanzaro.

* Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::PeerConnectionBackend):
* Source/WebCore/Modules/mediastream/PeerConnectionBackend.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:
(WebCore::GStreamerMediaEndpoint::startRTCLogs):
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h:
* Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp:
(WKWPE::ViewPlatform::ViewPlatform):

Canonical link: https://commits.webkit.org/287124@main

Upstream-Status: Backport [https://commits.webkit.org/287124@main]
---
.../WebCore/Modules/mediastream/PeerConnectionBackend.cpp | 4 ++++
.../WebCore/Modules/mediastream/PeerConnectionBackend.h | 2 +-
.../mediastream/gstreamer/GStreamerMediaEndpoint.cpp | 2 ++
.../platform/graphics/gstreamer/GStreamerCommon.cpp | 8 ++++----
.../graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h | 3 ++-
5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
index d6bb7ef7..d9c85af5 100644
--- a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
+++ b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
@@ -165,6 +165,10 @@ PeerConnectionBackend::PeerConnectionBackend(RTCPeerConnection& peerConnection)
m_shouldFilterICECandidates = page->webRTCProvider().isSupportingMDNS();
#endif

+#if RELEASE_LOG_DISABLED
+ m_logIdentifierString = makeString(hex(reinterpret_cast<uintptr_t>(this)));
+#endif
+
#if !RELEASE_LOG_DISABLED && (PLATFORM(WPE) || PLATFORM(GTK))
m_jsonFilePath = String::fromUTF8(getenv("WEBKIT_WEBRTC_JSON_EVENTS_FILE"));
if (!m_jsonFilePath.isEmpty())
diff --git a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
index e0615025..cd7912df 100644
--- a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
+++ b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
@@ -281,8 +281,8 @@ private:
#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
const void* m_logIdentifier;
- String m_logIdentifierString;
#endif
+ String m_logIdentifierString;
bool m_finishedGatheringCandidates { false };
bool m_isProcessingLocalDescriptionAnswer { false };

diff --git a/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp b/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp
index deb6281f..e678b04e 100644
--- a/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp
+++ b/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp
@@ -2228,7 +2228,9 @@ std::optional<bool> GStreamerMediaEndpoint::canTrickleIceCandidates() const
void GStreamerMediaEndpoint::startRTCLogs()
{
m_isGatheringRTCLogs = true;
+#if !RELEASE_LOG_DISABLED
startLoggingStats();
+#endif
}

void GStreamerMediaEndpoint::stopRTCLogs()
diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
index 812a1f6a..1d83f3b2 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
@@ -1726,7 +1726,7 @@ void gstStructureFilterAndMapInPlace(GstStructure* structure, Function<bool(GstI
#endif
}

-#if !GST_CHECK_VERSION(1, 24, 0)
+#if USE(GBM) && !GST_CHECK_VERSION(1, 24, 0)
static GstVideoFormat drmFourccToGstVideoFormat(uint32_t fourcc)
{
switch (fourcc) {
@@ -1761,7 +1761,7 @@ static GstVideoFormat drmFourccToGstVideoFormat(uint32_t fourcc)
RELEASE_ASSERT_NOT_REACHED();
return GST_VIDEO_FORMAT_UNKNOWN;
}
-#endif // !GST_CHECK_VERSION(1, 24, 0)
+#endif // USE(GBM) && !GST_CHECK_VERSION(1, 24, 0)

#if USE(GBM)
GRefPtr<GstCaps> buildDMABufCaps()
@@ -1805,7 +1805,7 @@ GRefPtr<GstCaps> buildDMABufCaps()
gst_value_list_append_and_take_value(&supportedFormats, &value);
}
}
-#else
+#elif USE(GBM)
GValue value = G_VALUE_INIT;
g_value_init(&value, G_TYPE_STRING);
g_value_set_string(&value, gst_video_format_to_string(drmFourccToGstVideoFormat(format.fourcc)));
@@ -1815,7 +1815,7 @@ GRefPtr<GstCaps> buildDMABufCaps()

#if GST_CHECK_VERSION(1, 24, 0)
gst_caps_set_value(caps.get(), "drm-format", &supportedFormats);
-#else
+#elif USE(GBM)
gst_caps_set_value(caps.get(), "format", &supportedFormats);
#endif
g_value_unset(&supportedFormats);
diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h
index 701a300d..5264b32a 100644
--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h
+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h
@@ -93,13 +93,14 @@ private:
#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
const void* m_logIdentifier;
+#endif
+
uint64_t m_nextSourceBufferID { 0 };

// Stores known track IDs, so we can work around ID collisions between multiple source buffers.
// The registry is placed here to enforce ID uniqueness specifically by player, not by process,
// since its not an issue if multiple players use the same ID, and we want to preserve IDs as much as possible.
HashSet<TrackID, WTF::IntHash<TrackID>, WTF::UnsignedWithZeroKeyHashTraits<TrackID>> m_trackIdRegistry;
-#endif
};

} // namespace WebCore
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ DEPENDS = "curl libxml2 libxslt libidn \

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI = " \
https://www.webkitgtk.org/releases/webkitgtk-${PV}.tar.xz;name=tarball \
file://fix-bmalloc-armhf.patch \
"
SRC_URI = "https://www.webkitgtk.org/releases/webkitgtk-${PV}.tar.xz;name=tarball \
file://fix-bmalloc-armhf.patch \
file://0001-Build-fixes-for-gbm-disabled-and-release-logs-disabl.patch \
"

SRC_URI[tarball.sha256sum] = "5aae1c5c0a30d5e9c5831652b6f1bdefc31d75e0ad81cb40185b0aed92ce79b6"
SRC_URI[tarball.sha256sum] = "0eff5f0ab0a2872ec87df62bc32e3289c8af625716ac71e94b298d74e0374176"

RRECOMMENDS:${PN} = "${PN}-bin \
ca-certificates \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
From 5de7f3a82abc68a628da1b54c2981f565fd483d4 Mon Sep 17 00:00:00 2001
From: UndeadLeech <[email protected]>
Date: Tue, 24 Sep 2024 06:05:06 -0700
Subject: [WPEPlatform] Input methods do not work
https://bugs.webkit.org/show_bug.cgi?id=279930

Reviewed by Carlos Garcia Campos.

Implement ViewPlatform::synthesizeCompositionKeyPress(), which was
missing implementation for WPE.

* Source/WebKit/Shared/NativeWebKeyboardEvent.h:
* Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp:
(WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Add helper
constructor, needed by ::synthesizeCompositionKeyPress().
* Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp:
(WKWPE::ViewPlatform::synthesizeCompositionKeyPress): Implement.

Canonical link: https://commits.webkit.org/284155@main
---
Source/WebKit/Shared/NativeWebKeyboardEvent.h | 1 +
Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp | 5 +++++
Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp | 4 ++--
3 files changed, 8 insertions(+), 2 deletions(-)

Upstream-Status: Backport [https://commits.webkit.org/284155@main]

diff --git a/Source/WebKit/Shared/NativeWebKeyboardEvent.h b/Source/WebKit/Shared/NativeWebKeyboardEvent.h
index 17cb4210..c72c9733 100644
--- a/Source/WebKit/Shared/NativeWebKeyboardEvent.h
+++ b/Source/WebKit/Shared/NativeWebKeyboardEvent.h
@@ -83,6 +83,7 @@ public:
NativeWebKeyboardEvent(struct wpe_input_keyboard_event*, const String&, bool isAutoRepeat, HandledByInputMethod, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&);
#if PLATFORM(WPE) && ENABLE(WPE_PLATFORM)
NativeWebKeyboardEvent(WPEEvent*, const String&, bool isAutoRepeat);
+ NativeWebKeyboardEvent(const String&, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&);
#endif
#elif PLATFORM(WIN)
NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM, Vector<MSG>&& pendingCharEvents);
diff --git a/Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp b/Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp
index e6cc8715..34d56bca 100644
--- a/Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp
+++ b/Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp
@@ -37,6 +37,11 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(WPEEvent* event, const String& te
{
}

+NativeWebKeyboardEvent::NativeWebKeyboardEvent(const String& text, std::optional<Vector<WebCore::CompositionUnderline>>&& preeditUnderlines, std::optional<EditingRange>&& preeditSelectionRange)
+ : WebKeyboardEvent(WebEvent(WebEventType::KeyDown, { }, WallTime::now()), text, "Unidentified"_s, "Unidentified"_s, "U+0000"_s, 0, 0, true, WTFMove(preeditUnderlines), WTFMove(preeditSelectionRange), false, false)
+{
+}
+
} // namespace WebKit

#endif // ENABLE(WPE_PLATFORM)
diff --git a/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp b/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
index a1d1aeb7..d69b3580 100644
--- a/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
+++ b/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
@@ -437,9 +437,9 @@ void ViewPlatform::handleGesture(WPEEvent* event)
}
}

-void ViewPlatform::synthesizeCompositionKeyPress(const String&, std::optional<Vector<WebCore::CompositionUnderline>>&&, std::optional<EditingRange>&&)
+void ViewPlatform::synthesizeCompositionKeyPress(const String& text, std::optional<Vector<WebCore::CompositionUnderline>>&& underlines, std::optional<EditingRange>&& selectionRange)
{
- // FIXME: implement.
+ page().handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(text, WTFMove(underlines), WTFMove(selectionRange)));
}

void ViewPlatform::setCursor(const WebCore::Cursor& cursor)
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
From 6802852a0e5caaa1f8bac5813e18309e169d7751 Mon Sep 17 00:00:00 2001
From: Philippe Normand <[email protected]>
Date: Wed, 27 Nov 2024 07:20:41 -0800
Subject: [PATCH] [WPE][GTK] Build fixes for gbm disabled and release logs
disabled https://bugs.webkit.org/show_bug.cgi?id=283750

Reviewed by Michael Catanzaro.

* Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::PeerConnectionBackend):
* Source/WebCore/Modules/mediastream/PeerConnectionBackend.h:
* Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:
(WebCore::GStreamerMediaEndpoint::startRTCLogs):
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h:
* Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp:
(WKWPE::ViewPlatform::ViewPlatform):

Canonical link: https://commits.webkit.org/287124@main

Upstream-Status: Backport [https://commits.webkit.org/287124@main]
---
.../WebCore/Modules/mediastream/PeerConnectionBackend.cpp | 4 ++++
.../WebCore/Modules/mediastream/PeerConnectionBackend.h | 2 +-
.../mediastream/gstreamer/GStreamerMediaEndpoint.cpp | 2 ++
.../platform/graphics/gstreamer/GStreamerCommon.cpp | 8 ++++----
.../graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h | 3 ++-
Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp | 2 ++
6 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
index d6bb7ef7..d9c85af5 100644
--- a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
+++ b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
@@ -165,6 +165,10 @@ PeerConnectionBackend::PeerConnectionBackend(RTCPeerConnection& peerConnection)
m_shouldFilterICECandidates = page->webRTCProvider().isSupportingMDNS();
#endif

+#if RELEASE_LOG_DISABLED
+ m_logIdentifierString = makeString(hex(reinterpret_cast<uintptr_t>(this)));
+#endif
+
#if !RELEASE_LOG_DISABLED && (PLATFORM(WPE) || PLATFORM(GTK))
m_jsonFilePath = String::fromUTF8(getenv("WEBKIT_WEBRTC_JSON_EVENTS_FILE"));
if (!m_jsonFilePath.isEmpty())
diff --git a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
index e0615025..cd7912df 100644
--- a/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
+++ b/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
@@ -281,8 +281,8 @@ private:
#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
const void* m_logIdentifier;
- String m_logIdentifierString;
#endif
+ String m_logIdentifierString;
bool m_finishedGatheringCandidates { false };
bool m_isProcessingLocalDescriptionAnswer { false };

diff --git a/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp b/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp
index deb6281f..e678b04e 100644
--- a/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp
+++ b/Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp
@@ -2228,7 +2228,9 @@ std::optional<bool> GStreamerMediaEndpoint::canTrickleIceCandidates() const
void GStreamerMediaEndpoint::startRTCLogs()
{
m_isGatheringRTCLogs = true;
+#if !RELEASE_LOG_DISABLED
startLoggingStats();
+#endif
}

void GStreamerMediaEndpoint::stopRTCLogs()
diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
index 812a1f6a..1d83f3b2 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
@@ -1726,7 +1726,7 @@ void gstStructureFilterAndMapInPlace(GstStructure* structure, Function<bool(GstI
#endif
}

-#if !GST_CHECK_VERSION(1, 24, 0)
+#if USE(GBM) && !GST_CHECK_VERSION(1, 24, 0)
static GstVideoFormat drmFourccToGstVideoFormat(uint32_t fourcc)
{
switch (fourcc) {
@@ -1761,7 +1761,7 @@ static GstVideoFormat drmFourccToGstVideoFormat(uint32_t fourcc)
RELEASE_ASSERT_NOT_REACHED();
return GST_VIDEO_FORMAT_UNKNOWN;
}
-#endif // !GST_CHECK_VERSION(1, 24, 0)
+#endif // USE(GBM) && !GST_CHECK_VERSION(1, 24, 0)

#if USE(GBM)
GRefPtr<GstCaps> buildDMABufCaps()
@@ -1805,7 +1805,7 @@ GRefPtr<GstCaps> buildDMABufCaps()
gst_value_list_append_and_take_value(&supportedFormats, &value);
}
}
-#else
+#elif USE(GBM)
GValue value = G_VALUE_INIT;
g_value_init(&value, G_TYPE_STRING);
g_value_set_string(&value, gst_video_format_to_string(drmFourccToGstVideoFormat(format.fourcc)));
@@ -1815,7 +1815,7 @@ GRefPtr<GstCaps> buildDMABufCaps()

#if GST_CHECK_VERSION(1, 24, 0)
gst_caps_set_value(caps.get(), "drm-format", &supportedFormats);
-#else
+#elif USE(GBM)
gst_caps_set_value(caps.get(), "format", &supportedFormats);
#endif
g_value_unset(&supportedFormats);
diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h
index 701a300d..5264b32a 100644
--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h
+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h
@@ -93,13 +93,14 @@ private:
#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
const void* m_logIdentifier;
+#endif
+
uint64_t m_nextSourceBufferID { 0 };

// Stores known track IDs, so we can work around ID collisions between multiple source buffers.
// The registry is placed here to enforce ID uniqueness specifically by player, not by process,
// since its not an issue if multiple players use the same ID, and we want to preserve IDs as much as possible.
HashSet<TrackID, WTF::IntHash<TrackID>, WTF::UnsignedWithZeroKeyHashTraits<TrackID>> m_trackIdRegistry;
-#endif
};

} // namespace WebCore
diff --git a/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp b/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
index 7ecf6015..b516f4b8 100644
--- a/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
+++ b/Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
@@ -118,10 +118,12 @@ ViewPlatform::ViewPlatform(WPEDisplay* display, const API::PageConfiguration& co
auto& webView = *reinterpret_cast<ViewPlatform*>(userData);
webView.toplevelStateChanged(previousState, wpe_view_get_toplevel_state(view));
}), this);
+#if USE(GBM)
g_signal_connect(m_wpeView.get(), "preferred-dma-buf-formats-changed", G_CALLBACK(+[](WPEView*, gpointer userData) {
auto& webView = *reinterpret_cast<ViewPlatform*>(userData);
webView.page().preferredBufferFormatsDidChange();
}), this);
+#endif

createWebPage(configuration);
m_pageProxy->setIntrinsicDeviceScaleFactor(wpe_view_get_scale(m_wpeView.get()));
Loading