Rewild Your Web
web
browser
dweb
1--- original
2+++ modified
3@@ -6,7 +6,7 @@
4 use std::rc::Rc;
5
6 use base::generic_channel::GenericSender;
7-use base::id::PipelineId;
8+use base::id::{BrowsingContextId, PipelineId, WebViewId};
9 use constellation_traits::EmbedderToConstellationMessage;
10 #[cfg(feature = "gamepad")]
11 use embedder_traits::GamepadHapticEffectType;
12@@ -917,6 +917,14 @@
13 ///
14 /// [`window.open`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/open
15 fn request_create_new(&self, _parent_webview: WebView, _: CreateNewWebViewRequest) {}
16+ /// This method is called when an iframe with the "embed" attribute requests to create
17+ /// an embedded webview. Unlike `request_create_new`, embedded webviews should NOT
18+ /// create new tabs in the UI - they are displayed within the iframe element itself.
19+ ///
20+ /// The embedder should create the webview using the SAME rendering context as the parent
21+ /// webview (so they share the same compositor). The webview content will be
22+ /// composited within the parent's rendering context at the iframe's position.
23+ fn request_create_embedded(&self, _parent_webview: WebView, _: CreateNewWebViewRequest) {}
24 /// Content in a [`WebView`] is requesting permission to access a feature requiring
25 /// permission from the user. The embedder should allow or deny the request, either by
26 /// reading a cached value or querying the user for permission via the user interface.
27@@ -991,6 +999,25 @@
28 _tree_update: accesskit::TreeUpdate,
29 ) {
30 }
31+
32+ /// Notifies the embedder that an embedded webview has opened a new embedded webview
33+ /// via `window.open()` or `target="_blank"` links.
34+ ///
35+ /// The constellation has already created the new webview and pipeline. The parent webview
36+ /// should create an `<iframe embed>` that adopts the pre-created webview using the provided IDs.
37+ /// The iframe should set:
38+ /// - `adopt-webview-id` attribute to the new_webview_id
39+ /// - `adopt-browsing-context-id` attribute to the new_browsing_context_id
40+ /// - `adopt-pipeline-id` attribute to the new_pipeline_id
41+ fn notify_embedded_webview_created(
42+ &self,
43+ _parent_webview: WebView,
44+ _new_webview_id: WebViewId,
45+ _new_browsing_context_id: BrowsingContextId,
46+ _new_pipeline_id: PipelineId,
47+ _url: Url,
48+ ) {
49+ }
50 }
51
52 pub(crate) struct DefaultWebViewDelegate;