diff options
author | Delan Azabani <dazabani@igalia.com> | 2025-01-30 19:15:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-30 11:15:35 +0000 |
commit | 5e9de2cb61fbfd82b27343bf03439838458b9848 (patch) | |
tree | 64574624cda94237bbfc443a29b792229fde0ee2 /components/script/dom/htmlinputelement.rs | |
parent | 9eeb602f7afca502753bb8211ab646c952951761 (diff) | |
download | servo-5e9de2cb61fbfd82b27343bf03439838458b9848.tar.gz servo-5e9de2cb61fbfd82b27343bf03439838458b9848.zip |
Include `WebViewId` into EmbedderMsg variants where possible (#35211)
`EmbedderMsg` was previously paired with an implicit
`Option<WebViewId>`, even though almost all variants were either always
`Some` or always `None`, depending on whether there was a `WebView
involved.
This patch adds the `WebViewId` to as many `EmbedderMsg` variants as
possible, so we can call their associated `WebView` delegate methods
without needing to check and unwrap the `Option`. In many cases, this
required more changes to plumb through the `WebViewId`.
Notably, all `Request`s now explicitly need a `WebView` or not, in order
to ensure that it is passed when appropriate.
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom/htmlinputelement.rs')
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index e8844084c68..e5c3270f27e 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -24,7 +24,6 @@ use net_traits::blob_url_store::get_blob_origin; use net_traits::filemanager_thread::FileManagerThreadMsg; use net_traits::{CoreResourceMsg, IpcSend}; use profile_traits::ipc; -use script_traits::ScriptToConstellationChan; use servo_atoms::Atom; use style::attr::AttrValue; use style::str::{split_commas, str_join}; @@ -34,6 +33,7 @@ use unicode_bidi::{bidi_class, BidiClass}; use url::Url; use super::bindings::str::{FromInputValueString, ToInputValueString}; +use crate::clipboard_provider::EmbedderClipboardProvider; use crate::dom::activation::Activatable; use crate::dom::attr::Attr; use crate::dom::bindings::cell::DomRefCell; @@ -299,7 +299,7 @@ pub(crate) struct HTMLInputElement { minlength: Cell<i32>, #[ignore_malloc_size_of = "TextInput contains an IPCSender which cannot be measured"] #[no_trace] - textinput: DomRefCell<TextInput<ScriptToConstellationChan>>, + textinput: DomRefCell<TextInput<EmbedderClipboardProvider>>, // https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag value_dirty: Cell<bool>, // not specified explicitly, but implied by the fact that sanitization can't @@ -334,7 +334,7 @@ impl HTMLInputElement { prefix: Option<Prefix>, document: &Document, ) -> HTMLInputElement { - let chan = document + let constellation_sender = document .window() .as_global_scope() .script_to_constellation_chan() @@ -355,7 +355,10 @@ impl HTMLInputElement { textinput: DomRefCell::new(TextInput::new( Single, DOMString::new(), - chan, + EmbedderClipboardProvider { + constellation_sender, + webview_id: document.webview_id(), + }, None, None, SelectionDirection::None, @@ -1897,6 +1900,7 @@ impl HTMLInputElement { let mut files: Vec<DomRoot<File>> = vec![]; let mut error = None; + let webview_id = window.webview_id(); let filter = filter_from_accept(&self.Accept()); let target = self.upcast::<EventTarget>(); @@ -1906,7 +1910,8 @@ impl HTMLInputElement { let (chan, recv) = ipc::channel(self.global().time_profiler_chan().clone()) .expect("Error initializing channel"); - let msg = FileManagerThreadMsg::SelectFiles(filter, chan, origin, opt_test_paths); + let msg = + FileManagerThreadMsg::SelectFiles(webview_id, filter, chan, origin, opt_test_paths); resource_threads .send(CoreResourceMsg::ToFileManager(msg)) .unwrap(); @@ -1933,7 +1938,8 @@ impl HTMLInputElement { let (chan, recv) = ipc::channel(self.global().time_profiler_chan().clone()) .expect("Error initializing channel"); - let msg = FileManagerThreadMsg::SelectFile(filter, chan, origin, opt_test_path); + let msg = + FileManagerThreadMsg::SelectFile(webview_id, filter, chan, origin, opt_test_path); resource_threads .send(CoreResourceMsg::ToFileManager(msg)) .unwrap(); |