From eec7213ab04573e78e9b67127c08b03a86a790d8 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Sat, 16 Nov 2024 16:16:18 +0200 Subject: [PATCH] [wpewebkit] Upgrade to wpewebkit 2.46.3 With this many of the wpewebkit patches can be dropped because they are already included in 2.46.3 --- packages/wpewebkit-core.package | 2 +- packages/wpewebkit.package | 2 +- recipes/wpewebkit.recipe | 18 +- .../0001-Android-logging-macro.patch | 4 +- ...d-WebProcess-and-NetworkProcess-entr.patch | 42 +- ...jected-bundle-and-inspector-lib-path.patch | 8 +- ...04-Use-ASharedMemory-instead-of-shm.patch} | 4 +- ...ndroid-emulator-samplerExternalOES-p.patch | 31 -- ...0005-Compile-WebDriver-as-a-library.patch} | 4 +- ...e-Android-on-ANGLE-for-WebGL-support.patch | 56 --- ...ve-Float16Array-from-WebInspectorUI.patch} | 4 +- ...use-interaction-simulation-needs-to-.patch | 43 -- ...NABLE_WPE_PLATFORM-cannot-be-toggled.patch | 95 ----- ...Connection-fails-to-unset-FD_CLOEXEC.patch | 41 -- ...ocesses-fail-to-launch-if-ProcessPro.patch | 112 ----- ...-Android-support-to-Skia-integration.patch | 113 ----- ...eserve-3d-layers-don-t-get-flattened.patch | 390 ------------------ 17 files changed, 27 insertions(+), 942 deletions(-) rename recipes/wpewebkit/{0005-Use-ASharedMemory-instead-of-shm.patch => 0004-Use-ASharedMemory-instead-of-shm.patch} (97%) delete mode 100644 recipes/wpewebkit/0004-Workaround-for-Android-emulator-samplerExternalOES-p.patch rename recipes/wpewebkit/{0007-Compile-WebDriver-as-a-library.patch => 0005-Compile-WebDriver-as-a-library.patch} (95%) delete mode 100644 recipes/wpewebkit/0006-Enable-Android-on-ANGLE-for-WebGL-support.patch rename recipes/wpewebkit/{0013-Remove-Float16Array-from-WebInspectorUI.patch => 0006-Remove-Float16Array-from-WebInspectorUI.patch} (87%) delete mode 100644 recipes/wpewebkit/0008-WebDriver-WPE-Mouse-interaction-simulation-needs-to-.patch delete mode 100644 recipes/wpewebkit/0009-CMake-WPE-ENABLE_WPE_PLATFORM-cannot-be-toggled.patch delete mode 100644 recipes/wpewebkit/0010-GTK-WPE-IPC-Connection-fails-to-unset-FD_CLOEXEC.patch delete mode 100644 recipes/wpewebkit/0011-WPE-Auxiliary-processes-fail-to-launch-if-ProcessPro.patch delete mode 100644 recipes/wpewebkit/0012-Add-Android-support-to-Skia-integration.patch delete mode 100644 recipes/wpewebkit/0014-TextureMapper-Preserve-3d-layers-don-t-get-flattened.patch diff --git a/packages/wpewebkit-core.package b/packages/wpewebkit-core.package index bb1176be5..e77b57e94 100644 --- a/packages/wpewebkit-core.package +++ b/packages/wpewebkit-core.package @@ -2,7 +2,7 @@ class Package(package.Package): name = 'wpewebkit-core' - version = '2.44.1' + version = '2.46.3' shortdesc = 'Web Platform for Embedded' longdesc = 'WPE WebKit allows embedders to create simple and performant \ systems based on Web platform technologies. It is a WebKit port designed \ diff --git a/packages/wpewebkit.package b/packages/wpewebkit.package index 1252d9f01..f2e46ee01 100644 --- a/packages/wpewebkit.package +++ b/packages/wpewebkit.package @@ -2,7 +2,7 @@ class SDKPackage(package.SDKPackage): name = 'wpewebkit' - version = '2.46.0' + version = '2.46.3' shortdesc = 'Web Platform for Embedded' longdesc = 'WPE WebKit allows embedders to create simple and performant \ systems based on Web platform technologies. It is a WebKit port designed \ diff --git a/recipes/wpewebkit.recipe b/recipes/wpewebkit.recipe index 2a058fccf..a3a0b03c4 100644 --- a/recipes/wpewebkit.recipe +++ b/recipes/wpewebkit.recipe @@ -2,11 +2,11 @@ class Recipe(recipe.Recipe): name = 'wpewebkit' - version = '2.46.0' + version = '2.46.3' stype = SourceType.TARBALL btype = BuildType.CMAKE url = 'https://wpewebkit.org/releases/wpewebkit-{0}.tar.xz'.format(version) - tarball_checksum = '301550fbd8703f3ba4c4a65fe596686960569f8a3b0f6668243179cbc77bbc50' + tarball_checksum = '56709f8cf113650d8cc30dc22f2b69cb6f74e651731f12e1db52ecce12ab86f2' deps = [ 'icu', 'cairo', @@ -194,17 +194,9 @@ class Recipe(recipe.Recipe): 'wpewebkit/0001-Android-logging-macro.patch', 'wpewebkit/0002-Implement-Android-WebProcess-and-NetworkProcess-entr.patch', 'wpewebkit/0003-Allow-setting-injected-bundle-and-inspector-lib-path.patch', - 'wpewebkit/0004-Workaround-for-Android-emulator-samplerExternalOES-p.patch', - 'wpewebkit/0005-Use-ASharedMemory-instead-of-shm.patch', - 'wpewebkit/0006-Enable-Android-on-ANGLE-for-WebGL-support.patch', - 'wpewebkit/0007-Compile-WebDriver-as-a-library.patch', - 'wpewebkit/0008-WebDriver-WPE-Mouse-interaction-simulation-needs-to-.patch', - 'wpewebkit/0009-CMake-WPE-ENABLE_WPE_PLATFORM-cannot-be-toggled.patch', - 'wpewebkit/0010-GTK-WPE-IPC-Connection-fails-to-unset-FD_CLOEXEC.patch', - 'wpewebkit/0011-WPE-Auxiliary-processes-fail-to-launch-if-ProcessPro.patch', - 'wpewebkit/0012-Add-Android-support-to-Skia-integration.patch', - 'wpewebkit/0013-Remove-Float16Array-from-WebInspectorUI.patch', - 'wpewebkit/0014-TextureMapper-Preserve-3d-layers-don-t-get-flattened.patch' + 'wpewebkit/0004-Use-ASharedMemory-instead-of-shm.patch', + 'wpewebkit/0005-Compile-WebDriver-as-a-library.patch', + 'wpewebkit/0006-Remove-Float16Array-from-WebInspectorUI.patch' ] else: self.append_env('LDFLAGS', '-lrt') diff --git a/recipes/wpewebkit/0001-Android-logging-macro.patch b/recipes/wpewebkit/0001-Android-logging-macro.patch index d261e9fbf..6d544d2b4 100644 --- a/recipes/wpewebkit/0001-Android-logging-macro.patch +++ b/recipes/wpewebkit/0001-Android-logging-macro.patch @@ -1,7 +1,7 @@ -From 4d9121d87aab4d0866f4c570e26ed5a011b32d09 Mon Sep 17 00:00:00 2001 +From c1d61fe8b469b444f057f61a3880ace168b02ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 25 May 2021 15:32:57 +0200 -Subject: [PATCH 01/14] Android logging macro +Subject: [PATCH 1/6] Android logging macro --- Source/WebKit/config.h | 3 +++ diff --git a/recipes/wpewebkit/0002-Implement-Android-WebProcess-and-NetworkProcess-entr.patch b/recipes/wpewebkit/0002-Implement-Android-WebProcess-and-NetworkProcess-entr.patch index f73593975..94d7bdc98 100644 --- a/recipes/wpewebkit/0002-Implement-Android-WebProcess-and-NetworkProcess-entr.patch +++ b/recipes/wpewebkit/0002-Implement-Android-WebProcess-and-NetworkProcess-entr.patch @@ -1,46 +1,20 @@ -From ae486ebcc2ca2f5c40723af5c8e2f7a4f96909c4 Mon Sep 17 00:00:00 2001 +From 290b3245adbe0ac63d8e4377c84d9c8bc437f627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 25 May 2021 13:51:14 +0200 -Subject: [PATCH 02/14] Implement Android WebProcess and NetworkProcess entry +Subject: [PATCH 2/6] Implement Android WebProcess and NetworkProcess entry points --- - .../soup/NetworkProcessMainSoup.cpp | 34 ++++++++----------- - .../WebProcess/wpe/WebProcessMainWPE.cpp | 13 +++++++ - Source/WebKit/webkitglib-symbols.map | 1 + - 3 files changed, 28 insertions(+), 20 deletions(-) + .../NetworkProcess/soup/NetworkProcessMainSoup.cpp | 13 +++++++++++++ + Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp | 13 +++++++++++++ + Source/WebKit/webkitglib-symbols.map | 1 + + 3 files changed, 27 insertions(+) diff --git a/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp b/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp -index f98cd65a0ea1..3dae162d5cfa 100644 +index dc26ae7acb81..bb5898e947b2 100644 --- a/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp +++ b/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp -@@ -37,28 +37,22 @@ - - namespace WebKit { - --class NetworkProcessMainSoup final: public AuxiliaryProcessMainBaseNoSingleton { --public: -- bool platformInitialize() override -- { --#if USE(GCRYPT) -- PAL::GCrypt::initialize(); --#endif -- return true; -- } -- -- void platformFinalize() override -- { -- // FIXME: Is this still needed? We should probably destroy all existing sessions at this point instead. -- // Needed to destroy the SoupSession and SoupCookieJar, e.g. to avoid -- // leaking SQLite temporary journaling files. -- process().destroySession(PAL::SessionID::defaultSessionID()); -- } --}; -- - int NetworkProcessMain(int argc, char** argv) - { -- return AuxiliaryProcessMain(argc, argv); -+ return AuxiliaryProcessMain>(argc, argv); +@@ -67,3 +67,16 @@ int NetworkProcessMain(int argc, char** argv) } } // namespace WebKit diff --git a/recipes/wpewebkit/0003-Allow-setting-injected-bundle-and-inspector-lib-path.patch b/recipes/wpewebkit/0003-Allow-setting-injected-bundle-and-inspector-lib-path.patch index 751b96f9d..1b11c1828 100644 --- a/recipes/wpewebkit/0003-Allow-setting-injected-bundle-and-inspector-lib-path.patch +++ b/recipes/wpewebkit/0003-Allow-setting-injected-bundle-and-inspector-lib-path.patch @@ -1,8 +1,8 @@ -From e20f3344536da81cb533e03865fba97e59f3927f Mon Sep 17 00:00:00 2001 +From 9fae07d96c8c9e68bc9a68ec7893fd32e3f88513 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 24 Mar 2022 09:41:17 +0200 -Subject: [PATCH 03/14] Allow setting injected bundle and inspector lib paths - in non dev mode +Subject: [PATCH 3/6] Allow setting injected bundle and inspector lib paths in + non dev mode --- .../inspector/remote/glib/RemoteInspectorUtils.cpp | 4 ++-- @@ -30,7 +30,7 @@ index 04a49a2af4b5..c394cb86554a 100644 GModule* resourcesModule = g_module_open(bundleFilename.get(), G_MODULE_BIND_LAZY); if (!resourcesModule) { diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp -index 5ebc00dd4b58..1fe752e7e7b1 100644 +index 65cf0eb2b99a..f34220b0e762 100644 --- a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp @@ -337,11 +337,9 @@ void webkitWebContextWillCloseAutomationSession(WebKitWebContext* webContext) diff --git a/recipes/wpewebkit/0005-Use-ASharedMemory-instead-of-shm.patch b/recipes/wpewebkit/0004-Use-ASharedMemory-instead-of-shm.patch similarity index 97% rename from recipes/wpewebkit/0005-Use-ASharedMemory-instead-of-shm.patch rename to recipes/wpewebkit/0004-Use-ASharedMemory-instead-of-shm.patch index c019854a9..c38c141e7 100644 --- a/recipes/wpewebkit/0005-Use-ASharedMemory-instead-of-shm.patch +++ b/recipes/wpewebkit/0004-Use-ASharedMemory-instead-of-shm.patch @@ -1,7 +1,7 @@ -From 890959f49930b51a84b7af799825b3222f99b0e8 Mon Sep 17 00:00:00 2001 +From a02e5e2ec5d4cf0eb763cf450348e28d90435335 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 28 Sep 2022 15:13:08 +0300 -Subject: [PATCH 05/14] Use ASharedMemory instead of shm +Subject: [PATCH 4/6] Use ASharedMemory instead of shm --- .../platform/unix/SharedMemoryUnix.cpp | 63 +++++++++---------- diff --git a/recipes/wpewebkit/0004-Workaround-for-Android-emulator-samplerExternalOES-p.patch b/recipes/wpewebkit/0004-Workaround-for-Android-emulator-samplerExternalOES-p.patch deleted file mode 100644 index e0289d7fd..000000000 --- a/recipes/wpewebkit/0004-Workaround-for-Android-emulator-samplerExternalOES-p.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 231fd83807ef6e701e534567a5cb2690c3d5f203 Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Sun, 22 May 2022 23:03:03 +0300 -Subject: [PATCH 04/14] Workaround for Android emulator samplerExternalOES - precision issue - -For some unknown reason glShaderSource fails with 0x505 GL_OUT_OF_MEMORY -on Android Emulator if precision is not set right after SamplerExternalOESType -definition. Seems like emulator OpenGL ES implementation doesn't define any -precision for samplerExternalOES. Adding precision hint for samplerExternalOES -across all platforms is harmless because OpenGL ES implementation is not -required to use hint information. ---- - .../platform/graphics/texmap/TextureMapperShaderProgram.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp -index 0ea2e3c010ed..309a1b222285 100644 ---- a/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp -+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp -@@ -151,6 +151,7 @@ static const char* vertexTemplateCommon = - GLSL_DIRECTIVE(ifdef ENABLE_TextureExternalOES) \ - GLSL_DIRECTIVE(extension GL_OES_EGL_image_external : require) \ - GLSL_DIRECTIVE(define SamplerExternalOESType samplerExternalOES) \ -+ STRINGIFY(precision mediump samplerExternalOES;\n) \ - GLSL_DIRECTIVE(else) \ - GLSL_DIRECTIVE(define SamplerExternalOESType sampler2D) \ - GLSL_DIRECTIVE(endif) --- -2.43.0 - diff --git a/recipes/wpewebkit/0007-Compile-WebDriver-as-a-library.patch b/recipes/wpewebkit/0005-Compile-WebDriver-as-a-library.patch similarity index 95% rename from recipes/wpewebkit/0007-Compile-WebDriver-as-a-library.patch rename to recipes/wpewebkit/0005-Compile-WebDriver-as-a-library.patch index b69ce4bdb..bb091bac2 100644 --- a/recipes/wpewebkit/0007-Compile-WebDriver-as-a-library.patch +++ b/recipes/wpewebkit/0005-Compile-WebDriver-as-a-library.patch @@ -1,7 +1,7 @@ -From b78029f2b2c57eedbbb379b2a2a3b3e297c406b0 Mon Sep 17 00:00:00 2001 +From 258a35ec3035f55aade3031b9d19921220096c69 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 23 Sep 2024 13:51:10 +0300 -Subject: [PATCH 07/14] Compile WebDriver as a library. +Subject: [PATCH 5/6] Compile WebDriver as a library. --- Source/WebDriver/CMakeLists.txt | 4 ++-- diff --git a/recipes/wpewebkit/0006-Enable-Android-on-ANGLE-for-WebGL-support.patch b/recipes/wpewebkit/0006-Enable-Android-on-ANGLE-for-WebGL-support.patch deleted file mode 100644 index a1af8a027..000000000 --- a/recipes/wpewebkit/0006-Enable-Android-on-ANGLE-for-WebGL-support.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 052e869d493ae989b1cd2141f4a95bfe0a355ecd Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Wed, 25 Oct 2023 23:46:04 +0300 -Subject: [PATCH 06/14] Enable Android on ANGLE for WebGL support - ---- - Source/ThirdParty/ANGLE/CMakeLists.txt | 2 ++ - Source/ThirdParty/ANGLE/PlatformWPE.cmake | 6 +++++- - .../platform/graphics/angle/PlatformDisplayANGLE.cpp | 2 ++ - 3 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/Source/ThirdParty/ANGLE/CMakeLists.txt b/Source/ThirdParty/ANGLE/CMakeLists.txt -index 2e4c31b2433f..4e9fbde2054f 100644 ---- a/Source/ThirdParty/ANGLE/CMakeLists.txt -+++ b/Source/ThirdParty/ANGLE/CMakeLists.txt -@@ -7,6 +7,8 @@ elseif (WIN32) - set(angle_enable_d3d9 TRUE) - set(angle_enable_d3d11 TRUE) - set(angle_is_winuwp FALSE) -+elseif (ANDROID) -+ set(is_android TRUE) - elseif (UNIX) - set(is_linux TRUE) - endif () -diff --git a/Source/ThirdParty/ANGLE/PlatformWPE.cmake b/Source/ThirdParty/ANGLE/PlatformWPE.cmake -index f734f599b385..d5792550bec7 100644 ---- a/Source/ThirdParty/ANGLE/PlatformWPE.cmake -+++ b/Source/ThirdParty/ANGLE/PlatformWPE.cmake -@@ -1,4 +1,8 @@ --list(APPEND ANGLE_DEFINITIONS ANGLE_PLATFORM_LINUX EGL_NO_PLATFORM_SPECIFIC_TYPES) -+if (is_android) -+ list(APPEND ANGLE_DEFINITIONS ANGLE_PLATFORM_ANDROID) -+else () -+ list(APPEND ANGLE_DEFINITIONS ANGLE_PLATFORM_LINUX EGL_NO_PLATFORM_SPECIFIC_TYPES) -+endif () - include(linux.cmake) - - if (USE_OPENGL) -diff --git a/Source/WebCore/platform/graphics/angle/PlatformDisplayANGLE.cpp b/Source/WebCore/platform/graphics/angle/PlatformDisplayANGLE.cpp -index 832a1f22023a..a6959bf5afd0 100644 ---- a/Source/WebCore/platform/graphics/angle/PlatformDisplayANGLE.cpp -+++ b/Source/WebCore/platform/graphics/angle/PlatformDisplayANGLE.cpp -@@ -44,8 +44,10 @@ EGLDisplay PlatformDisplay::angleEGLDisplay() const - - Vector displayAttributes { - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, -+#if !defined(__ANDROID__) && !defined(ANDROID) - EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE, - EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE, m_anglePlatform.value(), -+#endif - EGL_NONE, - }; - --- -2.43.0 - diff --git a/recipes/wpewebkit/0013-Remove-Float16Array-from-WebInspectorUI.patch b/recipes/wpewebkit/0006-Remove-Float16Array-from-WebInspectorUI.patch similarity index 87% rename from recipes/wpewebkit/0013-Remove-Float16Array-from-WebInspectorUI.patch rename to recipes/wpewebkit/0006-Remove-Float16Array-from-WebInspectorUI.patch index 93a25bef8..149602025 100644 --- a/recipes/wpewebkit/0013-Remove-Float16Array-from-WebInspectorUI.patch +++ b/recipes/wpewebkit/0006-Remove-Float16Array-from-WebInspectorUI.patch @@ -1,7 +1,7 @@ -From 9a3139885a047037519bbfc4f3cc1d37f2105a1e Mon Sep 17 00:00:00 2001 +From aea652ec0cc796b51791ed1b00af6b16d2f53113 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 16 Oct 2024 16:44:03 +0300 -Subject: [PATCH 13/14] Remove Float16Array from WebInspectorUI +Subject: [PATCH 6/6] Remove Float16Array from WebInspectorUI * Source/WebInspectorUI/UserInterface/Base/Utilities.js: --- diff --git a/recipes/wpewebkit/0008-WebDriver-WPE-Mouse-interaction-simulation-needs-to-.patch b/recipes/wpewebkit/0008-WebDriver-WPE-Mouse-interaction-simulation-needs-to-.patch deleted file mode 100644 index d4d1977f1..000000000 --- a/recipes/wpewebkit/0008-WebDriver-WPE-Mouse-interaction-simulation-needs-to-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From e65ac14d30368972c7cc40010765982263d8fcec Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Thu, 12 Sep 2024 00:15:33 -0700 -Subject: [PATCH 08/14] [WebDriver][WPE] Mouse interaction simulation needs to - take accout device scale with old API - https://bugs.webkit.org/show_bug.cgi?id=279438 - -Reviewed by Carlos Garcia Campos. - -WebAutomationSession misses scaling mouse interaction simulation in case of old WPE API. - -* Source/WebKit/UIProcess/Automation/libwpe/WebAutomationSessionWPE.cpp: -(WebKit::WebAutomationSession::platformSimulateMouseInteraction): - -Canonical link: https://commits.webkit.org/283541@main ---- - .../UIProcess/Automation/libwpe/WebAutomationSessionWPE.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Source/WebKit/UIProcess/Automation/libwpe/WebAutomationSessionWPE.cpp b/Source/WebKit/UIProcess/Automation/libwpe/WebAutomationSessionWPE.cpp -index 47da2f79a4e9..9b705fae9426 100644 ---- a/Source/WebKit/UIProcess/Automation/libwpe/WebAutomationSessionWPE.cpp -+++ b/Source/WebKit/UIProcess/Automation/libwpe/WebAutomationSessionWPE.cpp -@@ -175,13 +175,14 @@ void WebAutomationSession::platformSimulateMouseInteraction(WebPageProxy& page, - { - UNUSED_PARAM(pointerType); - -+ auto location = deviceScaleLocationInView(page, locationInView); -+ - if (page.viewBackend()) { -- platformSimulateMouseInteractionLibWPE(page, interaction, button, locationInView, keyModifiers, pointerType, m_currentModifiers); -+ platformSimulateMouseInteractionLibWPE(page, interaction, button, location, keyModifiers, pointerType, m_currentModifiers); - return; - } - - #if ENABLE(WPE_PLATFORM) -- auto location = deviceScaleLocationInView(page, locationInView); - unsigned wpeButton = libWPEMouseButtonToWPEButton(button); - auto modifier = libWPEStateModifierForWPEButton(wpeButton); - uint32_t state = modifiersToEventState(keyModifiers) | m_currentModifiers; --- -2.43.0 - diff --git a/recipes/wpewebkit/0009-CMake-WPE-ENABLE_WPE_PLATFORM-cannot-be-toggled.patch b/recipes/wpewebkit/0009-CMake-WPE-ENABLE_WPE_PLATFORM-cannot-be-toggled.patch deleted file mode 100644 index 3790d4354..000000000 --- a/recipes/wpewebkit/0009-CMake-WPE-ENABLE_WPE_PLATFORM-cannot-be-toggled.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 527878df784541243dd99e842e35f0703bfe11d3 Mon Sep 17 00:00:00 2001 -From: Adrian Perez de Castro -Date: Wed, 18 Sep 2024 07:11:34 -0700 -Subject: [PATCH 09/14] [CMake][WPE] ENABLE_WPE_PLATFORM cannot be toggled - https://bugs.webkit.org/show_bug.cgi?id=279879 - -Reviewed by Carlos Garcia Campos. - -Use WEBKIT_OPTION_DEFINE() to define ENABLE_WPE_PLATFORM, defaulting to -enabled for developer builds. Ensure that the option cannot be enabled -with the old 1.1 API with WEBKIT_OPTION_CONFLICT(), because WPEPlatform -uses functionality from the 2.0 API. While at it, fix a build failure -with ENABLE_WPE_PLATFORM=OFF. - -* Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in: Replace an - ENABLE(2022_GLIB_API) guard with ENABLE(WPE_PLATFORM) around functions - that are available only when building the WPEPlatform library. -* Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp: Ditto. -* Source/cmake/OptionsWPE.cmake: Define option. - -Canonical link: https://commits.webkit.org/283838@main ---- - Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in | 4 ++-- - Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp | 2 +- - Source/cmake/OptionsWPE.cmake | 5 +++-- - 3 files changed, 6 insertions(+), 5 deletions(-) - -diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in b/Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in -index 1e3d3323f9ca..39a975473c58 100644 ---- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in -+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in -@@ -71,7 +71,7 @@ - #include - #include - #include --#if ENABLE(2022_GLIB_API) -+#if ENABLE(WPE_PLATFORM) - #include - #endif - #endif -@@ -475,7 +475,7 @@ webkit_web_view_new_with_user_content_manager (WebKitWebViewBackend - WEBKIT_API WebKitWebViewBackend * - webkit_web_view_get_backend (WebKitWebView *web_view); - --#if ENABLE(2022_GLIB_API) -+#if ENABLE(WPE_PLATFORM) - WEBKIT_API WPEDisplay * - webkit_web_view_get_display (WebKitWebView *web_view); - -diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp -index 697ce0c5a2bf..eb0c2505df78 100644 ---- a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp -+++ b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp -@@ -295,7 +295,7 @@ guint createShowOptionMenuSignal(WebKitWebViewClass* webViewClass) - WEBKIT_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE); - } - --#if ENABLE(2022_GLIB_API) -+#if ENABLE(WPE_PLATFORM) - /** - * webkit_web_view_toggle_inspector: - * @web_view: a #WebKitWebView -diff --git a/Source/cmake/OptionsWPE.cmake b/Source/cmake/OptionsWPE.cmake -index cbf8958e034c..6126dfff79f0 100644 ---- a/Source/cmake/OptionsWPE.cmake -+++ b/Source/cmake/OptionsWPE.cmake -@@ -96,6 +96,7 @@ endif () - WEBKIT_OPTION_DEFINE(ENABLE_DOCUMENTATION "Whether to generate documentation." PUBLIC ON) - WEBKIT_OPTION_DEFINE(ENABLE_INTROSPECTION "Whether to enable GObject introspection." PUBLIC ON) - WEBKIT_OPTION_DEFINE(ENABLE_JOURNALD_LOG "Whether to enable journald logging" PUBLIC ON) -+WEBKIT_OPTION_DEFINE(ENABLE_WPE_PLATFORM "Whether to enable the WPEPlatform library" PUBLIC ${ENABLE_DEVELOPER_MODE}) - WEBKIT_OPTION_DEFINE(ENABLE_WPE_PLATFORM_DRM "Whether to enable support for DRM platform" PUBLIC ON) - WEBKIT_OPTION_DEFINE(ENABLE_WPE_PLATFORM_HEADLESS "Whether to enable support for headless platform" PUBLIC ON) - WEBKIT_OPTION_DEFINE(ENABLE_WPE_PLATFORM_WAYLAND "Whether to enable support for Wayland platform" PUBLIC ON) -@@ -113,6 +114,8 @@ WEBKIT_OPTION_DEFINE(USE_EXTERNAL_HOLEPUNCH "Whether to enable external holepunc - WEBKIT_OPTION_DEFINE(USE_SYSPROF_CAPTURE "Whether to use libsysprof-capture for tracing." PRIVATE ON) - WEBKIT_OPTION_DEFINE(USE_SYSTEM_SYSPROF_CAPTURE "Whether to use a system-provided libsysprof-capture" PRIVATE ${USE_SYSTEM_SYSPROF_CAPTURE_DEFAULT}) - -+WEBKIT_OPTION_CONFLICT(ENABLE_WPE_PLATFORM ENABLE_WPE_1_1_API) -+ - WEBKIT_OPTION_DEPEND(ENABLE_DOCUMENTATION ENABLE_INTROSPECTION) - WEBKIT_OPTION_DEPEND(USE_SYSTEM_SYSPROF_CAPTURE USE_SYSPROF_CAPTURE) - -@@ -181,8 +184,6 @@ else () - endif () - find_package(GLIB ${GLIB_MINIMUM_VERSION} REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule) - --SET_AND_EXPOSE_TO_BUILD(ENABLE_WPE_PLATFORM ${ENABLE_2022_GLIB_API}) -- - if (WPE_API_VERSION VERSION_EQUAL "1.1") - CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 8 4 8) - else () --- -2.43.0 - diff --git a/recipes/wpewebkit/0010-GTK-WPE-IPC-Connection-fails-to-unset-FD_CLOEXEC.patch b/recipes/wpewebkit/0010-GTK-WPE-IPC-Connection-fails-to-unset-FD_CLOEXEC.patch deleted file mode 100644 index 499b937e4..000000000 --- a/recipes/wpewebkit/0010-GTK-WPE-IPC-Connection-fails-to-unset-FD_CLOEXEC.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 68f64322a1b220c325dfa10afaf3041e83def3ef Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Tue, 24 Sep 2024 03:16:13 -0700 -Subject: [PATCH 10/14] [GTK][WPE] IPC::Connection fails to unset FD_CLOEXEC - https://bugs.webkit.org/show_bug.cgi?id=280256 - -Reviewed by Carlos Garcia Campos. - -There's a logic error in UniStdExtrasUnix.cpp where unsetCloseOnExec(int) -expects fnctl(...) F_GETFD to return -1 as a flags value before trying to -remove FD_CLOEXEC flag. However, -1 indicates error so FD_CLOEXEC never gets -removed and calling function in ConnectionUnix createPlatformConnection has -RELEASE_ASSERT which leads to crash. - -unsetCloseOnExec should check if fnctl(...) F_GETFD return value is -!= -1 before setting new flag value. - -* Source/WTF/wtf/unix/UniStdExtrasUnix.cpp: -(WTF::unsetCloseOnExec): - -Canonical link: https://commits.webkit.org/284153@main ---- - Source/WTF/wtf/unix/UniStdExtrasUnix.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp b/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp -index b9a63fbc76a5..c45c75d96f0e 100644 ---- a/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp -+++ b/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp -@@ -47,7 +47,7 @@ bool unsetCloseOnExec(int fileDescriptor) - int returnValue = -1; - do { - int flags = fcntl(fileDescriptor, F_GETFD); -- if (flags == -1) -+ if (flags != -1) - returnValue = fcntl(fileDescriptor, F_SETFD, flags & ~FD_CLOEXEC); - } while (returnValue == -1 && errno == EINTR); - --- -2.43.0 - diff --git a/recipes/wpewebkit/0011-WPE-Auxiliary-processes-fail-to-launch-if-ProcessPro.patch b/recipes/wpewebkit/0011-WPE-Auxiliary-processes-fail-to-launch-if-ProcessPro.patch deleted file mode 100644 index 2c6a4b8ed..000000000 --- a/recipes/wpewebkit/0011-WPE-Auxiliary-processes-fail-to-launch-if-ProcessPro.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 67dfcd5df43b290b47a59f05c7b3c2658ff3f720 Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Wed, 25 Sep 2024 08:52:32 +0300 -Subject: [PATCH 11/14] [WPE] Auxiliary processes fail to launch if - ProcessProviderLibWPE when enabled - https://bugs.webkit.org/show_bug.cgi?id=280321 - -Reviewed by NOBODY (OOPS!). - -The ProcessProviderLibWPE is only used in the UIProcess, but -AuxiliaryProcessMainCommon::parseCommandLine attempts to check if -ProcessProviderLibWPE is enabled. Since ProcessProviderLibWPE is never -enabled for auxiliary processes, this causes a mismatch in the argument count -for auxiliary processes in runtimes where ProcessProviderLibWPE is used. -As a result, the auxiliary process never starts. - -* Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp: -(WebKit::AuxiliaryProcessMainCommon::parseCommandLine): ---- - .../Shared/unix/AuxiliaryProcessMain.cpp | 45 +++++++++---------- - 1 file changed, 20 insertions(+), 25 deletions(-) - -diff --git a/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp b/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp -index ce942ed6ce6b..e0f713a216ea 100644 ---- a/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp -+++ b/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp -@@ -38,10 +38,6 @@ - #include "unix/BreakpadExceptionHandler.h" - #endif - --#if USE(LIBWPE) && !ENABLE(BUBBLEWRAP_SANDBOX) && (!PLATFORM(PLAYSTATION) || USE(WPE_BACKEND_PLAYSTATION)) --#include "ProcessProviderLibWPE.h" --#endif -- - namespace WebKit { - - AuxiliaryProcessMainCommon::AuxiliaryProcessMainCommon() -@@ -54,26 +50,18 @@ AuxiliaryProcessMainCommon::AuxiliaryProcessMainCommon() - // The command line is constructed in ProcessLauncher::launchProcess. - bool AuxiliaryProcessMainCommon::parseCommandLine(int argc, char** argv) - { --#if USE(GLIB) && OS(LINUX) -- int minimumNumArgs = 4; --#else -- int minimumNumArgs = 3; --#endif -+ int argIndex = 1; // Start from argv[1], since argv[0] is the program name. - --#if USE(LIBWPE) && !ENABLE(BUBBLEWRAP_SANDBOX) && (!PLATFORM(PLAYSTATION) || USE(WPE_BACKEND_PLAYSTATION)) -- if (ProcessProviderLibWPE::singleton().isEnabled()) -- minimumNumArgs = 3; --#endif -- -- if (argc < minimumNumArgs) -+ // Ensure we have enough arguments for processIdentifier and connectionIdentifier -+ if (argc < argIndex + 2) - return false; - -- if (auto processIdentifier = parseInteger(span(argv[1]))) -+ if (auto processIdentifier = parseInteger(span(argv[argIndex++]))) - m_parameters.processIdentifier = LegacyNullableObjectIdentifier(*processIdentifier); - else - return false; - -- if (auto connectionIdentifier = parseInteger(span(argv[2]))) -+ if (auto connectionIdentifier = parseInteger(span(argv[argIndex++]))) - m_parameters.connectionIdentifier = IPC::Connection::Identifier { *connectionIdentifier }; - else - return false; -@@ -82,24 +70,31 @@ bool AuxiliaryProcessMainCommon::parseCommandLine(int argc, char** argv) - return false; - - #if USE(GLIB) && OS(LINUX) -- if (minimumNumArgs == 4) { -- auto pidSocket = parseInteger(span(argv[3])); -- if (!pidSocket || *pidSocket < 0) -+ // Parse pidSocket if available -+ if (argc > argIndex) { -+ auto pidSocket = parseInteger(span(argv[argIndex])); -+ if (pidSocket && *pidSocket >= 0) { -+ IPC::sendPIDToPeer(*pidSocket); -+ RELEASE_ASSERT(!close(*pidSocket)); -+ ++argIndex; -+ } else { - return false; -- -- IPC::sendPIDToPeer(*pidSocket); -- RELEASE_ASSERT(!close(*pidSocket)); -+ } - } - #endif - - #if ENABLE(DEVELOPER_MODE) -- if (argc > minimumNumArgs && argv[minimumNumArgs] && !strcmp(argv[minimumNumArgs], "--configure-jsc-for-testing")) -- JSC::Config::configureForTesting(); -+ // Check last remainnging options for JSC testing -+ for (; argIndex < argc; ++argIndex) { -+ if (argv[argIndex] && !strcmp(argv[argIndex], "--configure-jsc-for-testing")) -+ JSC::Config::configureForTesting(); -+ } - #endif - - return true; - } - -+ - void AuxiliaryProcess::platformInitialize(const AuxiliaryProcessInitializationParameters&) - { - struct sigaction signalAction; --- -2.43.0 - diff --git a/recipes/wpewebkit/0012-Add-Android-support-to-Skia-integration.patch b/recipes/wpewebkit/0012-Add-Android-support-to-Skia-integration.patch deleted file mode 100644 index 3c0f05ad7..000000000 --- a/recipes/wpewebkit/0012-Add-Android-support-to-Skia-integration.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 448728d4475f1235fb94a16a29e32a516a1c4241 Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Mon, 23 Sep 2024 16:28:50 +0300 -Subject: [PATCH 12/14] Add Android support to Skia integration - ---- - Source/ThirdParty/skia/CMakeLists.txt | 28 +++++++++++++++++-- - .../platform/graphics/skia/FontCacheSkia.cpp | 11 +++++++- - 2 files changed, 35 insertions(+), 4 deletions(-) - -diff --git a/Source/ThirdParty/skia/CMakeLists.txt b/Source/ThirdParty/skia/CMakeLists.txt -index 756a9a4532cc..efe77f7fb965 100644 ---- a/Source/ThirdParty/skia/CMakeLists.txt -+++ b/Source/ThirdParty/skia/CMakeLists.txt -@@ -1,10 +1,18 @@ - set_property(DIRECTORY . PROPERTY FOLDER "skia") - -+if (ANDROID) -+ set(is_android TRUE) -+endif () -+ - # Skia dependencies not used directly in WebKit. - find_package(Freetype 2.9.0 REQUIRED) - find_package(Fontconfig 2.13.0 REQUIRED) - find_package(WebP REQUIRED COMPONENTS mux) - -+if (is_android) -+find_package(Expat REQUIRED) -+endif () -+ - # - # SKIA_ROOT_DIR may point to a checkout from the upstream Skia repository, - # where a static build has been done under "out/Static" as follows: -@@ -871,13 +879,11 @@ add_library(Skia STATIC - src/opts/SkOpts_hsw.cpp - src/opts/SkOpts_skx.cpp - -- src/ports/SkDebug_stdio.cpp - src/ports/SkFontConfigInterface.cpp - src/ports/SkFontConfigInterface_direct.cpp - src/ports/SkFontConfigInterface_direct_factory.cpp - src/ports/SkFontHost_FreeType.cpp - src/ports/SkFontHost_FreeType_common.cpp -- src/ports/SkFontMgr_fontconfig.cpp - src/ports/SkGlobalInitialization_default.cpp - src/ports/SkImageGenerator_skia.cpp - src/ports/SkOSFile_posix.cpp -@@ -892,6 +898,23 @@ add_library(Skia STATIC - modules/skcms/src/skcms_TransformSkx.cc - ) - -+if (is_android) -+ target_sources(Skia PRIVATE src/ports/SkDebug_android.cpp) -+ target_sources(Skia PRIVATE src/ports/SkFontMgr_android.cpp) -+ target_sources(Skia PRIVATE src/ports/SkFontMgr_android_parser.cpp) -+ -+ target_link_libraries(Skia PRIVATE -+ expat::expat -+ ) -+else () -+ target_sources(Skia PRIVATE src/ports/SkDebug_stdio.cpp) -+ target_sources(Skia PRIVATE src/ports/SkFontMgr_fontconfig.cpp) -+ -+ target_link_libraries(Skia PRIVATE -+ Fontconfig::Fontconfig -+ ) -+endif () -+ - if (USE_SYSTEM_MALLOC) - target_sources(Skia PRIVATE src/ports/SkMemory_malloc.cpp) - else () -@@ -908,7 +931,6 @@ endif () - - target_link_libraries(Skia PRIVATE - Epoxy::Epoxy -- Fontconfig::Fontconfig - Freetype::Freetype - JPEG::JPEG - PNG::PNG -diff --git a/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp b/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp -index d49d11fed66e..95a15bb07c47 100644 ---- a/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp -+++ b/Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp -@@ -29,7 +29,11 @@ - #include "Font.h" - #include "FontDescription.h" - #include "StyleFontSizeFunctions.h" -+#if defined(ANDROID) -+#include -+#else - #include -+#endif - #include - #include - #include -@@ -47,8 +51,13 @@ void FontCache::platformInit() - - SkFontMgr& FontCache::fontManager() const - { -- if (!m_fontManager) -+ if (!m_fontManager) { -+#if defined(ANDROID) -+ m_fontManager = SkFontMgr_New_Android(nullptr); -+#else - m_fontManager = SkFontMgr_New_FontConfig(FcConfigReference(nullptr)); -+#endif -+ } - RELEASE_ASSERT(m_fontManager); - return *m_fontManager.get(); - } --- -2.43.0 - diff --git a/recipes/wpewebkit/0014-TextureMapper-Preserve-3d-layers-don-t-get-flattened.patch b/recipes/wpewebkit/0014-TextureMapper-Preserve-3d-layers-don-t-get-flattened.patch deleted file mode 100644 index 3b20ec3ed..000000000 --- a/recipes/wpewebkit/0014-TextureMapper-Preserve-3d-layers-don-t-get-flattened.patch +++ /dev/null @@ -1,390 +0,0 @@ -From dd3c5e35bd8ecc9af4790d490846d57eb5e5d5b5 Mon Sep 17 00:00:00 2001 -From: Jani Hautakangas -Date: Tue, 8 Oct 2024 23:57:25 +0300 -Subject: [PATCH 14/14] [TextureMapper] Preserve-3d layers don't get flattened - correctly https://bugs.webkit.org/show_bug.cgi?id=281079 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Reviewed by NOBODY (OOPS!). - -The TextureMapper incorrectly flattens layers to wrong 2D plane -in the 3D rendering context. Instead of accumulating 3D transformations -for each layer, it resets transformations to the page root layer's 2D plane -for leaf layers. This fix ensures that proper 3D transforms are applied -throughout the entire 3D context and leaf layers are flattened correctly. - -Expected Behavior (as per CSS spec): - -"The element establishing the 3D rendering context, along with other 3D transformed -elements participating in the context, should be rendered into its own plane. -This plane includes the element’s backgrounds, borders, box decorations, content, -and descendant elements—excluding descendants that have their own planes." - -* Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp: -(WebCore::TextureMapperFlattenedLayer::TextureMapperFlattenedLayer): -(WebCore::TextureMapperFlattenedLayer::bind): -(WebCore::TextureMapperFlattenedLayer::layerRect const): -(WebCore::TextureMapperFlattenedLayer::surface const): -(WebCore::TextureMapperFlattenedLayer::paintToTextureMapper): -(WebCore::TextureMapperLayer::preprocess): -(WebCore::TextureMapperLayer::collectLayersToFlattenRecursive): -(WebCore::TextureMapperLayer::flatten): -(WebCore::TextureMapperLayer::computeFlattenedRegion): -(WebCore::TextureMapperLayer::postprocess): -(WebCore::TextureMapperLayer::freeFlattenedLayersRecursive): -(WebCore::TextureMapperLayer::computeTransformsRecursive): -(WebCore::TextureMapperLayer::paint): -(WebCore::TextureMapperLayer::paintSelf): -(WebCore::TextureMapperLayer::paintSelfAndChildren): -(WebCore::TextureMapperLayer::flattensAsLeafOf3DSceneOr3DPerspective const): -(WebCore::TextureMapperLayer::has3DLocalTransform const): -(WebCore::TextureMapperLayer::accumulatesTransform const): -(WebCore::TextureMapperLayer::computeOverlapRegions): -(WebCore::TextureMapperLayer::paintRecursive): -* Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h: ---- - .../graphics/texmap/TextureMapperLayer.cpp | 202 ++++++++++++++++-- - .../graphics/texmap/TextureMapperLayer.h | 14 ++ - 2 files changed, 201 insertions(+), 15 deletions(-) - -diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp -index 786e23b53075..8c6d064c5860 100644 ---- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp -+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp -@@ -60,6 +60,40 @@ struct TextureMapperLayer::ComputeTransformData { - } - }; - -+class TextureMapperFlattenedLayer final { -+ WTF_MAKE_FAST_ALLOCATED; -+public: -+ explicit TextureMapperFlattenedLayer(const IntRect& rect) -+ : m_rect(rect) -+ { } -+ -+ void bind(TextureMapper& textureMapper) -+ { -+ if (!m_texture) -+ m_texture = textureMapper.acquireTextureFromPool(m_rect.size(), { BitmapTexture::Flags::SupportsAlpha }); -+ textureMapper.bindSurface(m_texture.get()); -+ } -+ -+ inline IntRect layerRect() const -+ { -+ return m_rect; -+ } -+ -+ RefPtr surface() const -+ { -+ return m_texture; -+ } -+ -+ void paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity) -+ { -+ textureMapper.drawTexture(*m_texture.get(), targetRect, modelViewMatrix, opacity); -+ } -+ -+private: -+ IntRect m_rect; -+ RefPtr m_texture; -+}; -+ - TextureMapperLayer::TextureMapperLayer(Damage::ShouldPropagate propagateDamage) - : m_propagateDamage(propagateDamage) - { -@@ -73,6 +107,92 @@ TextureMapperLayer::~TextureMapperLayer() - removeFromParent(); - } - -+void TextureMapperLayer::flattenDescendantLayersIfNecessary(TextureMapperPaintOptions& options) -+{ -+ // Preprocess is called as a first step before painting any layers -+ -+ // Traverse all children in depth first, post-order -+ for (auto* child : m_children) { -+ child->flattenDescendantLayersIfNecessary(options); -+ -+ if (child->flattensAsLeafOf3DSceneOr3DPerspective()) -+ child->flatten(options); -+ } -+} -+ -+void TextureMapperLayer::flatten(TextureMapperPaintOptions& options) -+{ -+ // Flattens descendant layers to into this planes z=0 2D root. -+ if (m_flattenedLayer) -+ m_flattenedLayer = nullptr; -+ -+ // Reset transformations as this layer is root 2D -+ SetForScope scopedLocalTransform(m_layerTransforms.localTransform, TransformationMatrix()); -+ m_layerTransforms.combined = { }; -+ m_layerTransforms.combinedForChildren = { }; -+#if USE(COORDINATED_GRAPHICS) -+ SetForScope scopedFutureLocalTransform(m_layerTransforms.futureLocalTransform, TransformationMatrix()); -+ m_layerTransforms.futureLocalTransform = { }; -+ m_layerTransforms.futureCombined = { }; -+ m_layerTransforms.futureCombinedForChildren = { }; -+#endif -+ ComputeTransformData data; -+ if (m_state.maskLayer) -+ m_state.maskLayer->computeTransformsRecursive(data); -+ if (m_state.replicaLayer) -+ m_state.replicaLayer->computeTransformsRecursive(data); -+ if (m_state.backdropLayer) -+ m_state.backdropLayer->computeTransformsRecursive(data); -+ for (auto* child : m_children) -+ child->computeTransformsRecursive(data); -+ -+ Region layerRegion; -+ computeFlattenedRegion(layerRegion); -+ -+ auto flattenedLayerRect = layerRegion.bounds(); -+ auto flattenedLayer = WTF::makeUnique(flattenedLayerRect); -+ -+ flattenedLayer->bind(options.textureMapper); -+ { -+ SetForScope scopedSurface(options.surface, flattenedLayer->surface()); -+ SetForScope scopedOffset(options.offset, -IntSize(flattenedLayerRect.x(), flattenedLayerRect.y())); -+ SetForScope scopedOpacity(options.opacity, 1); -+ -+ paintSelfAndChildren(options); -+ } -+ -+ m_flattenedLayer = WTFMove(flattenedLayer); -+ options.textureMapper.bindSurface(options.surface.get()); -+} -+ -+void TextureMapperLayer::computeFlattenedRegion(Region& region) -+{ -+ auto rect = isFlattened() ? m_flattenedLayer->layerRect() : layerRect(); -+ -+ bool shouldExpand = m_currentFilters.hasOutsets() && !m_state.masksToBounds && !m_state.maskLayer; -+ if (shouldExpand) { -+ auto outsets = m_currentFilters.outsets(); -+ rect.move(-outsets.left(), -outsets.top()); -+ rect.expand(outsets.left() + outsets.right(), outsets.top() + outsets.bottom()); -+ } -+ -+ region.unite(enclosingIntRect(m_layerTransforms.combined.mapRect(rect))); -+ -+ if (!m_state.masksToBounds && !m_state.maskLayer) { -+ for (auto* child : m_children) -+ child->computeFlattenedRegion(region); -+ } -+} -+ -+void TextureMapperLayer::freeFlattenedDescendantLayers() -+{ -+ if (m_flattenedLayer) -+ m_flattenedLayer = nullptr; -+ -+ for (auto* child : m_children) -+ child->freeFlattenedDescendantLayers(); -+} -+ - void TextureMapperLayer::computeTransformsRecursive(ComputeTransformData& data) - { - if (m_state.size.isEmpty() && m_state.masksToBounds) -@@ -100,8 +220,8 @@ void TextureMapperLayer::computeTransformsRecursive(ComputeTransformData& data) - if (m_isReplica) - m_layerTransforms.combined.translate(-m_state.pos.x(), -m_state.pos.y()); - -- if (!m_state.preserves3D) -- m_layerTransforms.combinedForChildren = m_layerTransforms.combinedForChildren.to2dTransform(); -+ if (!accumulatesTransformForChildren()) -+ m_layerTransforms.combinedForChildren.flatten(); - m_layerTransforms.combinedForChildren.multiply(m_state.childrenTransform); - m_layerTransforms.combinedForChildren.translate3d(-originX, -originY, -m_state.anchorPoint.z()); - -@@ -121,8 +241,8 @@ void TextureMapperLayer::computeTransformsRecursive(ComputeTransformData& data) - m_layerTransforms.futureCombinedForChildren = m_layerTransforms.futureCombined; - m_layerTransforms.futureCombined.translate3d(-originX, -originY, -m_state.anchorPoint.z()); - -- if (!m_state.preserves3D) -- m_layerTransforms.futureCombinedForChildren = m_layerTransforms.futureCombinedForChildren.to2dTransform(); -+ if (!accumulatesTransformForChildren()) -+ m_layerTransforms.futureCombinedForChildren.flatten(); - m_layerTransforms.futureCombinedForChildren.multiply(m_state.childrenTransform); - m_layerTransforms.futureCombinedForChildren.translate3d(-originX, -originY, -m_state.anchorPoint.z()); - #endif -@@ -144,13 +264,15 @@ void TextureMapperLayer::computeTransformsRecursive(ComputeTransformData& data) - return z / w; - }; - -- data.updateDepthRange(calculateZ(0, 0)); -- data.updateDepthRange(calculateZ(m_state.size.width(), 0)); -- data.updateDepthRange(calculateZ(0, m_state.size.height())); -- data.updateDepthRange(calculateZ(m_state.size.width(), m_state.size.height())); -+ auto rect = isFlattened() ? m_flattenedLayer->layerRect() : layerRect(); -+ -+ data.updateDepthRange(calculateZ(rect.x(), rect.y())); -+ data.updateDepthRange(calculateZ(rect.x() + rect.width(), rect.y())); -+ data.updateDepthRange(calculateZ(rect.x(), rect.y() + rect.height())); -+ data.updateDepthRange(calculateZ(rect.x() + rect.width(), rect.y() + rect.height())); - - if (m_parent && m_parent->m_state.preserves3D) -- m_centerZ = calculateZ(m_state.size.width() / 2, m_state.size.height() / 2); -+ m_centerZ = calculateZ(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); - - if (m_state.maskLayer) - m_state.maskLayer->computeTransformsRecursive(data); -@@ -175,13 +297,18 @@ void TextureMapperLayer::computeTransformsRecursive(ComputeTransformData& data) - - void TextureMapperLayer::paint(TextureMapper& textureMapper) - { -+ TextureMapperPaintOptions options(textureMapper); -+ options.surface = textureMapper.currentSurface(); -+ -+ flattenDescendantLayersIfNecessary(options); -+ - ComputeTransformData data; - computeTransformsRecursive(data); - textureMapper.setDepthRange(data.zNear, data.zFar); - -- TextureMapperPaintOptions options(textureMapper); -- options.surface = textureMapper.currentSurface(); - paintRecursive(options); -+ -+ freeFlattenedDescendantLayers(); - } - - void TextureMapperLayer::paintSelf(TextureMapperPaintOptions& options) -@@ -198,6 +325,14 @@ void TextureMapperLayer::paintSelf(TextureMapperPaintOptions& options) - transform.multiply(options.transform); - transform.multiply(m_layerTransforms.combined); - -+ if (isFlattened()) { -+ auto flattenedLayerRect = m_flattenedLayer->layerRect(); -+ transform.translate3d(flattenedLayerRect.x(), flattenedLayerRect.y(), 0); -+ IntRect drawRect(0, 0, flattenedLayerRect.width(), flattenedLayerRect.height()); -+ m_flattenedLayer->paintToTextureMapper(options.textureMapper, drawRect, transform, options.opacity); -+ return; -+ } -+ - TextureMapperSolidColorLayer solidColorLayer; - TextureMapperBackingStore* backingStore = m_backingStore; - if (m_state.backgroundColor.isValid()) { -@@ -340,8 +475,10 @@ void TextureMapperLayer::paintSelfAndChildren(TextureMapperPaintOptions& options - } - } - -- for (auto* child : m_children) -- child->paintRecursive(options); -+ if (!isFlattened()) { -+ for (auto* child : m_children) -+ child->paintRecursive(options); -+ } - - if (shouldClip) - options.textureMapper.endClip(); -@@ -355,6 +492,39 @@ bool TextureMapperLayer::shouldBlend() const - return m_currentOpacity < 1; - } - -+bool TextureMapperLayer::flattensAsLeafOf3DSceneOr3DPerspective() const -+{ -+ bool isLeafOf3DScene = !m_state.preserves3D && (m_parent && m_parent->preserves3D()); -+ bool hasPerspective = m_layerTransforms.localTransform.hasPerspective() && m_layerTransforms.localTransform.m34() != -1.f; -+ if ((isLeafOf3DScene || hasPerspective) && !m_children.isEmpty() && has3DLocalTransform()) -+ return true; -+ -+ return false; -+} -+ -+bool TextureMapperLayer::has3DLocalTransform() const -+{ -+ return !(!m_layerTransforms.localTransform.m13() && !m_layerTransforms.localTransform.m23() -+ && !m_layerTransforms.localTransform.m31() && !m_layerTransforms.localTransform.m32() -+ && m_layerTransforms.localTransform.m33() == 1 && !m_layerTransforms.localTransform.m34() -+ && !m_layerTransforms.localTransform.m43() && m_layerTransforms.localTransform.m44() == 1); -+} -+ -+bool TextureMapperLayer::accumulatesTransformForChildren() const -+{ -+ return preserves3D(); -+} -+ -+bool TextureMapperLayer::preserves3D() const -+{ -+ return m_state.preserves3D; -+} -+ -+bool TextureMapperLayer::isFlattened() const -+{ -+ return m_flattenedLayer != nullptr; -+} -+ - bool TextureMapperLayer::isVisible() const - { - if (m_state.size.isEmpty() && (m_state.masksToBounds || m_state.maskLayer || m_children.isEmpty())) -@@ -576,7 +746,9 @@ void TextureMapperLayer::computeOverlapRegions(ComputeOverlapRegionData& data, c - return; - - FloatRect localBoundingRect; -- if (m_backingStore || m_state.masksToBounds || m_state.maskLayer || hasFilters()) -+ if (isFlattened()) -+ localBoundingRect = m_flattenedLayer->layerRect(); -+ else if (m_backingStore || m_state.masksToBounds || m_state.maskLayer || hasFilters()) - localBoundingRect = layerRect(); - else if (m_contentsLayer || m_state.solidColor.isVisible()) - localBoundingRect = m_state.contentsRect; -@@ -802,7 +974,7 @@ void TextureMapperLayer::paintRecursive(TextureMapperPaintOptions& options) - - SetForScope scopedOpacity(options.opacity, options.opacity * m_currentOpacity); - -- if (m_state.preserves3D) -+ if (preserves3D()) - paintWith3DRenderingContext(options); - else if (shouldBlend()) - paintUsingOverlapRegions(options); -diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h -index 95f8a501a2ee..2c040ff9c316 100644 ---- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h -+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h -@@ -41,6 +41,7 @@ template<> struct IsDeprecatedWeakRefSmartPointerException(*this); - } - -+ void flattenDescendantLayersIfNecessary(TextureMapperPaintOptions&); -+ void flatten(TextureMapperPaintOptions&); -+ void computeFlattenedRegion(Region&); -+ void freeFlattenedDescendantLayers(); -+ - struct ComputeTransformData; - void computeTransformsRecursive(ComputeTransformData&); - -@@ -180,6 +186,13 @@ private: - - bool shouldBlend() const; - -+ bool flattensAsLeafOf3DScene() const; -+ bool flattensAsLeafOf3DSceneOr3DPerspective() const; -+ bool has3DLocalTransform() const; -+ bool accumulatesTransformForChildren() const; -+ bool preserves3D() const; -+ bool isFlattened() const; -+ - inline FloatRect layerRect() const - { - return FloatRect(FloatPoint::zero(), m_state.size); -@@ -190,6 +203,7 @@ private: - WeakPtr m_effectTarget; - TextureMapperBackingStore* m_backingStore { nullptr }; - TextureMapperPlatformLayer* m_contentsLayer { nullptr }; -+ std::unique_ptr m_flattenedLayer { nullptr }; - float m_currentOpacity { 1.0 }; - FilterOperations m_currentFilters; - float m_centerZ { 0 }; --- -2.43.0 -