···11--- original
22+++ modified
33-@@ -9,7 +9,7 @@
44- use std::rc::Rc;
55- use std::time::{SystemTime, UNIX_EPOCH};
66-77--use base::generic_channel::{self, GenericSender, RoutedReceiver};
88-+use base::generic_channel::{self, GenericCallback, GenericSender, RoutedReceiver};
99- use base::id::{PainterId, PipelineId, WebViewId};
1010- use bitflags::bitflags;
1111- use canvas_traits::webgl::{WebGLContextId, WebGLThreads};
1212-@@ -17,7 +17,8 @@
33+@@ -15,7 +15,8 @@
134 use crossbeam_channel::Sender;
145 use dpi::PhysicalSize;
156 use embedder_traits::{
···1910 Scroll, ShutdownState, ViewportDetails, WebViewPoint, WebViewRect,
2011 };
2112 use euclid::{Scale, Size2D};
1313+@@ -32,7 +33,7 @@
1414+ };
1515+ use profile_traits::path;
1616+ use profile_traits::time::{self as profile_time};
1717+-use servo_base::generic_channel::{self, GenericSender, RoutedReceiver};
1818++use servo_base::generic_channel::{self, GenericCallback, GenericSender, RoutedReceiver};
1919+ use servo_base::id::{PainterId, PipelineId, WebViewId};
2020+ use servo_config::pref;
2121+ use servo_geometry::DeviceIndependentPixel;
2222@@ -44,7 +45,7 @@
2323 #[cfg(feature = "webgpu")]
2424 use webgpu::canvas_context::WebGpuExternalImageMap;
···294294 /// Handle messages sent to `Paint` during the shutdown process. In general,
295295 /// the things `Paint` can do in this state are limited. It's very important to
296296 /// answer any synchronous messages though as other threads might be waiting on the
297297-@@ -747,10 +986,37 @@
297297+@@ -747,8 +986,35 @@
298298 #[cfg(feature = "webxr")]
299299 self.webxr_main_thread.borrow_mut().run_one_frame();
300300···304304- painter.borrow_mut().perform_updates();
305305+ let unconsumed = painter.borrow_mut().perform_updates();
306306+ all_unconsumed_scrolls.extend(unconsumed);
307307- }
308308-307307++ }
308308++
309309+ // Forward unconsumed scroll events to parent webviews.
310310+ for (embedded_webview_id, scroll_event) in all_unconsumed_scrolls {
311311+ // Find the parent webview for this embedded webview
···328328+ painter.try_scroll_any_and_send_to_webrender(parent_id, scroll_event.scroll);
329329+ }
330330+ }
331331-+ }
332332-+
331331+ }
332332+333333 self.shutdown_state() != ShutdownState::FinishedShuttingDown
334334- }
335335-336336-@@ -790,6 +1056,10 @@
337337- if self.shutdown_state() != ShutdownState::NotShuttingDown {
338338- return;
339339- }
340340-+
341341-+ // Always send the event to the parent webview. DOM hit testing in the script
342342-+ // thread will determine if the event should be forwarded to an embedded webview.
343343-+ // This respects the parent document's stacking context and z-index rules.
344344- self.painter_mut(webview_id.into())
345345- .notify_input_event(webview_id, event);
346346- }
347347-@@ -798,6 +1068,53 @@
334334+@@ -800,6 +1066,53 @@
348335 if self.shutdown_state() != ShutdownState::NotShuttingDown {
349336 return;
350337 }
···11--- original
22+++ modified
33-@@ -31,7 +31,7 @@
44- // should be exported at the root. See <https://github.com/servo/servo/issues/18475>.
55- pub use accesskit;
66- pub use base::generic_channel::GenericSender;
77--pub use base::id::WebViewId;
88-+pub use base::id::{BrowsingContextId, PipelineId, WebViewId};
99- pub use embedder_traits::user_contents::UserScript;
1010- pub use embedder_traits::*;
1111- pub use image::RgbaImage;
1212-@@ -51,9 +51,12 @@
1313- // This should be replaced with an API on ServoBuilder.
33+@@ -50,10 +50,13 @@
144 // See <https://github.com/servo/servo/issues/40950>.
155 pub use resources;
66+ pub use servo_base::generic_channel::GenericSender;
77+-pub use servo_base::id::WebViewId;
88++pub use servo_base::id::{BrowsingContextId, PipelineId, WebViewId};
169+pub use servo_config::embedder_prefs::PrefsPersistError;
1710 pub use servo_config::opts::{DiagnosticsLogging, Opts, OutputOptions};
1811 pub use servo_config::prefs::{PrefValue, Preferences, UserAgentPlatform};
+7-7
patches/components/servo/servo.rs.patch
···11--- original
22+++ modified
33@@ -63,7 +63,7 @@
44- use script::{JSEngineSetup, ServiceWorkerManager};
44+ use servo_bluetooth_traits::BluetoothRequest;
55 use servo_config::opts::Opts;
66 use servo_config::prefs::{PrefValue, Preferences};
77-use servo_config::{opts, pref, prefs};
···99 use servo_geometry::{
1010 DeviceIndependentIntRect, convert_rect_to_css_pixel, convert_size_to_css_pixel,
1111 };
1212-@@ -199,9 +199,7 @@
1212+@@ -229,9 +229,7 @@
1313 }
14141515 if self.constellation_proxy.disconnected() {
···2020 }
21212222 self.paint.borrow_mut().perform_updates();
2323-@@ -253,10 +251,39 @@
2323+@@ -283,10 +281,39 @@
24242525 fn handle_delegate_errors(&self) {
2626 while let Some(error) = self.servo_errors.try_recv() {
···6161 fn clean_up_destroyed_webview_handles(&self) {
6262 // Remove any webview handles that have been destroyed and would not be upgradable.
6363 // Note that `retain` is O(capacity) because it visits empty buckets, so it may be worth
6464-@@ -414,6 +441,11 @@
6464+@@ -444,6 +471,11 @@
6565 webview.request_create_new(response_sender);
6666 }
6767 },
···7373 EmbedderMsg::WebViewClosed(webview_id) => {
7474 if let Some(webview) = self.get_webview_handle(webview_id) {
7575 webview.delegate().notify_closed(webview);
7676-@@ -567,10 +599,7 @@
7676+@@ -597,10 +629,7 @@
7777 .delegate
7878 .borrow()
7979 .notify_devtools_server_started(port, token),
···8585 },
8686 EmbedderMsg::RequestDevtoolsConnection(response_sender) => {
8787 self.delegate
8888-@@ -695,6 +724,47 @@
8888+@@ -725,6 +754,47 @@
8989 .notify_accessibility_tree_update(webview, tree_update);
9090 }
9191 },
···133133 }
134134 }
135135 }
136136-@@ -927,6 +997,14 @@
136136+@@ -959,6 +1029,14 @@
137137 self.0.site_data_manager.borrow()
138138 }
139139
+6-5
patches/components/servo/servo_delegate.rs.patch
···11--- original
22+++ modified
33-@@ -3,6 +3,7 @@
33+@@ -3,6 +3,8 @@
44 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
55- use base::generic_channel;
65 use embedder_traits::{ConsoleLogLevel, Notification};
66+ use servo_base::generic_channel;
77++use servo_base::id::WebViewId;
78+use url::Url;
89910 use crate::webview_delegate::{AllowOrDenyRequest, WebResourceLoad};
10111111-@@ -42,6 +43,24 @@
1212+@@ -42,6 +44,24 @@
1213 /// A console message was logged by content not associated with a specific [`WebView`].
1314 /// <https://developer.mozilla.org/en-US/docs/Web/API/Console_API>
1415 fn show_console_message(&self, _level: ConsoleLogLevel, _message: String) {}
···2526+
2627+ /// Request the embedder to start a window drag operation.
2728+ /// The `webview_id` can be used to identify which window to drag.
2828-+ fn request_start_window_drag(&self, _webview_id: base::id::WebViewId) {}
2929++ fn request_start_window_drag(&self, _webview_id: WebViewId) {}
2930+
3031+ /// Request the embedder to start a window resize operation.
3132+ /// The `webview_id` can be used to identify which window to resize.
3232-+ fn request_start_window_resize(&self, _webview_id: base::id::WebViewId) {}
3333++ fn request_start_window_resize(&self, _webview_id: WebViewId) {}
3334 }
34353536 pub(crate) struct DefaultServoDelegate;
+3-3
patches/components/servo/webview.rs.patch
···11--- original
22+++ modified
33-@@ -227,6 +227,18 @@
33+@@ -228,6 +228,18 @@
44 self.delegate().request_create_new(self.clone(), request);
55 }
66···1919 pub(crate) fn viewport_details(&self) -> ViewportDetails {
2020 // The division by 1 represents the page's default zoom of 100%,
2121 // and gives us the appropriate CSSPixel type for the viewport.
2222-@@ -236,6 +248,7 @@
2222+@@ -237,6 +249,7 @@
2323 ViewportDetails {
2424 size: scaled_viewport_size / Scale::new(1.0),
2525 hidpi_scale_factor: Scale::new(inner.hidpi_scale_factor.0),
···2727 }
2828 }
29293030-@@ -758,6 +771,11 @@
3030+@@ -761,6 +774,11 @@
3131 EmbedderControlRequest::FilePicker { .. } => {
3232 unreachable!("This message should be routed through the FileManagerThread")
3333 },
···6677-use crate::{InputMethodType, RgbColor};
88+use crate::{AllowOrDeny, InputMethodType, PermissionFeature, RgbColor};
99- #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
1010- pub struct EmbedderControlId {
1111- pub webview_id: WebViewId,
1212-@@ -24,7 +24,7 @@
1313- pub index: Epoch,
99+1010+ /// The id of a user interface control that the engine requests that the
1111+ /// embedder show.
1212+@@ -31,7 +31,7 @@
1413 }
15141515+ /// A request from the engine to the embedder to display a user interface control.
1616-#[derive(Debug, Deserialize, Serialize)]
1717+#[derive(Clone, Debug, Deserialize, Serialize)]
1818 pub enum EmbedderControlRequest {
1919 /// Indicates that the user has activated a `<select>` element.
2020 SelectElement(Vec<SelectElementOptionOrOptgroup>, Option<usize>),
2121-@@ -37,6 +37,8 @@
2121+@@ -44,6 +44,8 @@
2222 InputMethod(InputMethodRequest),
2323 /// Indicates that the the user has triggered the display of a context menu.
2424 ContextMenu(ContextMenuRequest),
···2727 }
28282929 #[derive(Clone, Debug, Deserialize, Serialize)]
3030-@@ -61,7 +63,7 @@
3030+@@ -68,7 +70,7 @@
31313232 /// Request to present a context menu to the user. This is triggered by things like
3333 /// right-clicking on web content.
···3636 pub struct ContextMenuRequest {
3737 pub element_info: ContextMenuElementInformation,
3838 pub items: Vec<ContextMenuItem>,
3939-@@ -130,7 +132,7 @@
3939+@@ -137,7 +139,7 @@
4040 /// Request to present an IME to the user when an editable element is focused. If `type` is
4141 /// [`InputMethodType::Text`], then the `text` parameter specifies the pre-existing text content and
4242 /// `insertion_point` the zero-based index into the string of the insertion point.
···4545 pub struct InputMethodRequest {
4646 pub input_method_type: InputMethodType,
4747 pub text: String,
4848-@@ -144,7 +146,7 @@
4848+@@ -151,7 +153,7 @@
4949 #[derive(Clone, Debug, Deserialize, Serialize)]
5050 pub struct FilterPattern(pub String);
5151···5454 pub struct FilePickerRequest {
5555 pub origin: ImmutableOrigin,
5656 pub current_paths: Vec<PathBuf>,
5757-@@ -153,6 +155,16 @@
5757+@@ -160,6 +162,16 @@
5858 pub accept_current_paths_for_testing: bool,
5959 }
6060···6868+ pub response_sender: GenericSender<AllowOrDeny>,
6969+}
7070+
7171+ /// Response from the embedder to an [`EmbedderControlRequest`].
7172 #[derive(Debug, Deserialize, Serialize)]
7273 pub enum EmbedderControlResponse {
7373- SelectElement(Option<usize>),
7474-@@ -159,6 +171,7 @@
7474+@@ -167,6 +179,7 @@
7575 ColorPicker(Option<RgbColor>),
7676 FilePicker(Option<Vec<SelectedFile>>),
7777 ContextMenu(Option<ContextMenuAction>),
···7979 }
80808181 /// Response to file selection request
8282-@@ -172,7 +185,7 @@
8383- pub type_string: String,
8282+@@ -181,7 +194,7 @@
8483 }
85848585+ /// Request from Servo to the embedder with the details of the simple dialog to be displayed.
8686-#[derive(Deserialize, Serialize)]
8787+#[derive(Clone, Debug, Deserialize, Serialize)]
8888 pub enum SimpleDialogRequest {
···11--- original
22+++ modified
33-@@ -22,7 +22,7 @@
44- use std::sync::Arc;
55-66- use base::generic_channel::{GenericCallback, GenericSender, GenericSharedMemory, SendResult};
77--use base::id::{PipelineId, WebViewId};
88-+use base::id::{BrowsingContextId, PipelineId, WebViewId};
99- use crossbeam_channel::Sender;
1010- use euclid::{Box2D, Point2D, Scale, Size2D, Vector2D};
1111- use http::{HeaderMap, Method, StatusCode};
1212-@@ -31,6 +31,7 @@
1313- use malloc_size_of_derive::MallocSizeOf;
1414- use pixels::SharedRasterImage;
1515- use serde::{Deserialize, Deserializer, Serialize, Serializer};
33+@@ -32,7 +32,8 @@
44+ use servo_base::generic_channel::{
55+ GenericCallback, GenericSender, GenericSharedMemory, SendResult,
66+ };
77+-use servo_base::id::{PipelineId, WebViewId};
88++use servo_base::id::{BrowsingContextId, PipelineId, WebViewId};
169+use servo_config::pref_util::PrefValue;
1710 use servo_geometry::{DeviceIndependentIntRect, DeviceIndependentIntSize};
1811 use servo_url::ServoUrl;
1912 use strum::{EnumMessage, IntoStaticStr};
2020-@@ -65,6 +66,31 @@
1313+@@ -67,6 +68,31 @@
2114 Self::Page(point) => *point * scale,
2215 }
2316 }
···4942 }
50435144 impl From<DevicePoint> for WebViewPoint {
5252-@@ -317,9 +343,16 @@
4545+@@ -319,9 +345,16 @@
5346 /// The size of the layout viewport.
5447 pub size: Size2D<f32, CSSPixel>,
5548···6861 }
69627063 impl ViewportDetails {
7171-@@ -339,7 +372,7 @@
6464+@@ -341,7 +374,7 @@
7265 }
73667467 /// An opaque identifier for a single history traversal operation.
···7770 pub struct TraversalId(String);
78717972 impl TraversalId {
8080-@@ -349,6 +382,12 @@
7373+@@ -351,6 +384,12 @@
8174 }
8275 }
8376···9083 #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize, MallocSizeOf)]
9184 pub enum PixelFormat {
9285 /// Luminance channel only
9393-@@ -422,6 +461,12 @@
8686+@@ -424,6 +463,12 @@
9487 }
9588 }
9689···10396 /// Messages towards the embedder.
10497 #[derive(Deserialize, IntoStaticStr, Serialize)]
10598 pub enum EmbedderMsg {
106106-@@ -447,6 +492,21 @@
9999+@@ -449,6 +494,21 @@
107100 ),
108101 /// Whether or not to allow script to open a new tab/browser
109102 AllowOpeningWebView(WebViewId, GenericSender<Option<NewWebViewDetails>>),
···125118 /// A webview was destroyed.
126119 WebViewClosed(WebViewId),
127120 /// A webview potentially gained focus for keyboard events.
128128-@@ -528,6 +588,24 @@
121121+@@ -530,6 +590,24 @@
129122 InputEventsHandled(WebViewId, Vec<InputEventOutcome>),
130123 /// Send the embedder an accessibility tree update.
131124 AccessibilityTreeUpdate(WebViewId, accesskit::TreeUpdate),
···150143 }
151144152145 impl Debug for EmbedderMsg {
153153-@@ -1084,6 +1162,54 @@
146146+@@ -1086,6 +1164,54 @@
154147 WebViewDoesNotExist,
155148 }
156149···205198 #[derive(Clone, Copy, Debug, Deserialize, Serialize)]
206199 pub struct RgbColor {
207200 pub red: u8,
208208-@@ -1130,3 +1256,26 @@
201201+@@ -1132,3 +1258,26 @@
209202 pub viewport_details: ViewportDetails,
210203 pub user_content_manager_id: Option<UserContentManagerId>,
211204 }
+10
patches/components/shared/layout/lib.rs.patch
···11+--- original
22++++ modified
33+@@ -56,6 +56,7 @@
44+ use style::str::char_is_whitespace;
55+ use style::stylesheets::{DocumentStyleSheet, Stylesheet};
66+ use style::stylist::Stylist;
77++#[cfg(debug_assertions)]
88+ use style::thread_state::{self, ThreadState};
99+ use style::values::computed::Overflow;
1010+ use style_traits::CSSPixel;
+5-5
patches/components/shared/paint/lib.rs.patch
···11--- original
22+++ modified
33-@@ -10,7 +10,7 @@
44- use base::Epoch;
55- use base::id::{PainterId, PipelineId, WebViewId};
33+@@ -8,7 +8,7 @@
44+ use std::fmt::{Debug, Error, Formatter};
55+66 use crossbeam_channel::Sender;
77-use embedder_traits::{AnimationState, EventLoopWaker};
88+use embedder_traits::{AnimationState, EventLoopWaker, InputEventAndId};
···1010 use log::warn;
1111 use malloc_size_of_derive::MallocSizeOf;
1212@@ -39,7 +39,7 @@
1313- use profile_traits::mem::{OpaqueSender, ReportsChan};
1414- use serde::{Deserialize, Serialize};
1313+ self, GenericCallback, GenericReceiver, GenericSender, GenericSharedMemory,
1414+ };
1515 pub use webrender_api::ExternalImageSource;
1616-use webrender_api::units::{DevicePixel, LayoutVector2D, TexelRect};
1717+use webrender_api::units::{DevicePixel, DeviceRect, LayoutVector2D, TexelRect};
+3-3
patches/components/shared/script/lib.rs.patch
···11--- original
22+++ modified
33-@@ -21,8 +21,8 @@
44- use bluetooth_traits::BluetoothRequest;
33+@@ -13,8 +13,8 @@
44+55 use canvas_traits::webgl::WebGLPipeline;
66 use constellation_traits::{
77- KeyboardScroll, LoadData, NavigationHistoryBehavior, ScriptToConstellationSender,
···1111 };
1212 use crossbeam_channel::RecvTimeoutError;
1313 use devtools_traits::ScriptToDevtoolsControlMsg;
1414-@@ -30,7 +30,7 @@
1414+@@ -22,7 +22,7 @@
1515 use embedder_traits::{
1616 EmbedderControlId, EmbedderControlResponse, FocusSequenceNumber, InputEventAndId,
1717 JavaScriptEvaluationId, MediaSessionActionType, PaintHitTestResult, ScriptToEmbedderChan,