Repository navigation
Web views over WPE WebKit - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements AppRuntime's web view contracts (
WebContent,WebContentDelegate;WebKit.md) on Linux with WPE WebKit, and drawsWebViewnodes in the player. It follows Perry's approach (Sources/PerryUIKit/WPE.swift).Debian 13
Ubuntu 26.04 doesn't package WPE WebKit; Debian 13 has 2.48. The dev image and CI move to
swift:6.4.2-trixie:Scripts/build-sdl3.shbuilds SDL 3.4.20 from source (offscreen driver only) for both.libwpewebkit-2.0-1,libwpebackend-fdo-1.0-1,libwayland-server0), since the host loads it at run time.WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1. The host itself leaves the sandbox on..dockerignorekeeps the build context down to the SDL script.How
LinuxWebKit, a new host module.dlopens libwpe, WPEBackend-fdo, libwayland-server, WPE WebKit, GLib and GObject locally (RTLD_LOCAL); the host links no WebKit. Without WPE, a page fails each load saying so.wl_shmbuffer. Each is turned from premultiplied BGRA to RGBA for Cacao'sImage(pixels:). There's no GL.WebKitWebView.load-changed,load-failed,load-failed-with-tls-errors,decide-policy, andnotify::uri|title|estimated-load-progress.urichanges as soon as a load is asked for.WebError.Code.shouldNavigateis asked for every navigation and new window except the guest's own loads. New windows load in the same page.loadResourcestays inside the bundle'sresources/.jsc_value_to_json.network. Remote loads and remote navigations fail withnotPermitted, and everything else goes through a proxy on a.invalidhost, so remote subresources can't load.Sources/LinuxUI/HostWebView.swift):HostNodeViewsmoves to its own file and gains theWebViewcase.networkas a capability this host serves.Not yet
alert,confirmandprompt. WebKit's defaults apply, which show nothing.isMainFrameis always true.WebKit.mdnames.Tested
On Debian 13 in Docker, all suites pass:
LinuxWebKitTests, 13 tests in WPE:undefined, and exceptions;network;All WebKit calls run on one thread, which WebKit takes as its main thread.
The other suites: LinuxUI 43 (1 skipped, as before), Packager 21, Graphics 10, Host 12, Bluetooth 12.
End to end: AppRuntime's
ExampleWebwas built as alinux-arm64slice withnetworkand run inlinux-app-hostwithCACAO_SCREENSHOT_DELAY=10. That's the screenshot above: swift.org with the redirect followed, and the page title under it. A delayed screenshot of a page that had stopped changing never came, so I pushed a fix straight to Cacao'sdevelop(PureSwift/Cacao@ebcd57b): Cacao now draws a frame once the delay has passed.