diff options
author | Delan Azabani <dazabani@igalia.com> | 2025-01-25 16:17:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-25 08:17:50 +0000 |
commit | 2ce7709b8bd3568405be52f48db060cf9aec5af6 (patch) | |
tree | a73b0608cd9f1e126a01c9b7a5f91526c1636e3e /components/shared/embedder | |
parent | d5d7b0d34f12aec96be76b825851532ac0d33ecf (diff) | |
download | servo-2ce7709b8bd3568405be52f48db060cf9aec5af6.tar.gz servo-2ce7709b8bd3568405be52f48db060cf9aec5af6.zip |
libservo: Add an initial WebView data structure to the API (#35119)
This patch introduces a new handle-based webview API to libservo, with
two main design goals:
1. The lifetime of the handles controls the lifetime of the webview,
giving the embedder full control over exactly when webviews are
created and destroyed. This is consistent with how WebKitGTK’s
WebView works; the engine can only create webviews via a create
request, and can only destroy them via a close request.
2. All methods are infallible; if the constellation dies, the embedder
finds out when calling Servo::handle_events.
For the moment, the embedder is only responsible for creating the
WebView id, and not the internal TopLevelBrowsingContext data
structures. This is so that the ScriptThread is able to get a handle on
the new WebView's WindowProxy in the case that it's an auxiliary
browsing context. In the future, the embedder should also be responsible
for creating the TopLevelBrowsingContext and the ScriptThread should
have mechanism to associate the two views so that WebView creation is
always executed through the same code path in the embedding layer. For
now, it's enough that the embedder can get a handle to the new WebView
when it's creation is requested.
Once we replace EmbedderMsg with a webview delegate trait, we will pass
WebView handles to the embedder, rather than webview ids. We’ll also add
detailed docs, once the design settles.
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/embedder')
-rw-r--r-- | components/shared/embedder/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/components/shared/embedder/lib.rs b/components/shared/embedder/lib.rs index 286dc51bff7..1a3632713ab 100644 --- a/components/shared/embedder/lib.rs +++ b/components/shared/embedder/lib.rs @@ -181,7 +181,7 @@ pub enum EmbedderMsg { /// Whether or not to allow a pipeline to load a url. AllowNavigationRequest(PipelineId, ServoUrl), /// Whether or not to allow script to open a new tab/browser - AllowOpeningWebView(IpcSender<bool>), + AllowOpeningWebView(IpcSender<Option<WebViewId>>), /// A webview was created. WebViewOpened(TopLevelBrowsingContextId), /// A webview was destroyed. |