diff --git a/Cargo.lock b/Cargo.lock index fa690cd9df0..b5b5d5161ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1467,7 +1467,6 @@ dependencies = [ "servo_config", "servo_rand", "servo_url", - "stylo_traits", "tracing", "webgpu", "webgpu_traits", diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index 634166d1050..9092a0eab1e 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -47,7 +47,6 @@ serde = { workspace = true } servo_config = { path = "../config" } servo_rand = { path = "../rand" } servo_url = { path = "../url" } -stylo_traits = { workspace = true } tracing = { workspace = true, optional = true } webgpu = { path = "../webgpu" } webgpu_traits = { workspace = true } diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index a82f70991b0..ea22e68d993 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -133,7 +133,7 @@ use embedder_traits::{ FocusSequenceNumber, InputEvent, JSValue, JavaScriptEvaluationError, JavaScriptEvaluationId, KeyboardEvent, MediaSessionActionType, MediaSessionEvent, MediaSessionPlaybackState, MouseButton, MouseButtonAction, MouseButtonEvent, Theme, ViewportDetails, WebDriverCommandMsg, - WebDriverCommandResponse, WebDriverLoadStatus, + WebDriverCommandResponse, }; use euclid::Size2D; use euclid::default::Size2D as UntypedSize2D; @@ -159,7 +159,6 @@ use serde::{Deserialize, Serialize}; use servo_config::{opts, pref}; use servo_rand::{Rng, ServoRng, SliceRandom, random}; use servo_url::{Host, ImmutableOrigin, ServoUrl}; -use style_traits::CSSPixel; #[cfg(feature = "webgpu")] use webgpu::swapchain::WGPUImageMap; #[cfg(feature = "webgpu")] @@ -397,8 +396,8 @@ pub struct Constellation { /// and the namespaces are allocated by the constellation. next_pipeline_namespace_id: PipelineNamespaceId, - /// Bits of state used to interact with the webdriver implementation - webdriver: WebDriverData, + /// An [`IpcSender`] to forward responses from the `ScriptThread` to the WebDriver server. + webdriver_input_command_reponse_sender: Option>, /// Document states for loaded pipelines (used only when writing screenshots). document_states: HashMap, @@ -506,24 +505,6 @@ pub struct InitialConstellationState { pub user_content_manager: UserContentManager, } -/// Data needed for webdriver -struct WebDriverData { - load_channel: Option<(PipelineId, IpcSender)>, - resize_channel: Option>>, - // Forward responses from the script thread to the webdriver server. - input_command_response_sender: Option>, -} - -impl WebDriverData { - fn new() -> WebDriverData { - WebDriverData { - load_channel: None, - resize_channel: None, - input_command_response_sender: None, - } - } -} - /// When we are running reftests, we save an image to compare against a reference. /// This enum gives the possible states of preparing such an image. #[derive(Debug, PartialEq)] @@ -685,7 +666,7 @@ where time_profiler_chan: state.time_profiler_chan, mem_profiler_chan: state.mem_profiler_chan.clone(), phantom: PhantomData, - webdriver: WebDriverData::new(), + webdriver_input_command_reponse_sender: None, document_states: HashMap::new(), #[cfg(feature = "webgpu")] webrender_wgpu, @@ -1352,7 +1333,7 @@ where // Create a new top level browsing context. Will use response_chan to return // the browsing context id. EmbedderToConstellationMessage::NewWebView(url, webview_id, viewport_details) => { - self.handle_new_top_level_browsing_context(url, webview_id, viewport_details, None); + self.handle_new_top_level_browsing_context(url, webview_id, viewport_details); }, // Close a top level browsing context. EmbedderToConstellationMessage::CloseWebView(webview_id) => { @@ -1473,7 +1454,7 @@ where } }, EmbedderToConstellationMessage::SetWebDriverResponseSender(sender) => { - self.webdriver.input_command_response_sender = Some(sender); + self.webdriver_input_command_reponse_sender = Some(sender); }, } } @@ -1874,14 +1855,14 @@ where self.handle_finish_javascript_evaluation(evaluation_id, result) }, ScriptToConstellationMessage::WebDriverInputComplete(msg_id) => { - if let Some(ref reply_sender) = self.webdriver.input_command_response_sender { + if let Some(ref reply_sender) = self.webdriver_input_command_reponse_sender { reply_sender .send(WebDriverCommandResponse { id: msg_id }) .unwrap_or_else(|_| { warn!("Failed to send WebDriverInputComplete {:?}", msg_id); }); } else { - warn!("No WebDriver input_command_response_sender"); + warn!("No webdriver_input_command_reponse_sender"); } }, } @@ -2945,7 +2926,6 @@ where url: ServoUrl, webview_id: WebViewId, viewport_details: ViewportDetails, - response_sender: Option>, ) { let pipeline_id = PipelineId::new(); let browsing_context_id = BrowsingContextId::from(webview_id); @@ -3002,10 +2982,6 @@ where }), viewport_details, }); - - if let Some(response_sender) = response_sender { - self.webdriver.load_channel = Some((pipeline_id, response_sender)); - } } #[servo_tracing::instrument(skip_all)] @@ -3628,18 +3604,6 @@ where #[servo_tracing::instrument(skip_all)] fn handle_load_complete_msg(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) { - let mut webdriver_reset = false; - if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel { - if expected_pipeline_id == pipeline_id { - debug!("Sending load for {:?} to WebDriver", expected_pipeline_id); - let _ = reply_chan.send(WebDriverLoadStatus::Complete); - webdriver_reset = true; - } - } - if webdriver_reset { - self.webdriver.load_channel = None; - } - if let Some(pipeline) = self.pipelines.get_mut(&pipeline_id) { debug!("{}: Marking as loaded", pipeline_id); pipeline.completely_loaded = true; @@ -4930,10 +4894,6 @@ where let browsing_context_id = BrowsingContextId::from(webview_id); self.resize_browsing_context(new_viewport_details, size_type, browsing_context_id); - - if let Some(response_sender) = self.webdriver.resize_channel.take() { - let _ = response_sender.send(new_viewport_details.size); - } } /// Called when the window exits from fullscreen mode diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index c2cb65f6aa0..b00ad60cb8a 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -1103,8 +1103,10 @@ fn handle_send_keys_file( Ok(false) } -/// Implementing step 5 - 8 of Element Send Keys. This function will send a boolean -/// back to webdriver_server, indicating whether the dispatching of the key and +/// Implementing step 5 - 7, plus part of step 8 of "Element Send Keys" +/// where element is input element in the file upload state. +/// This function will send a boolean back to webdriver_server, +/// indicating whether the dispatching of the key and /// composition event is still needed or not. pub(crate) fn handle_will_send_keys( documents: &DocumentCollection, diff --git a/components/shared/embedder/webdriver.rs b/components/shared/embedder/webdriver.rs index f1e5646bc11..f9b041459aa 100644 --- a/components/shared/embedder/webdriver.rs +++ b/components/shared/embedder/webdriver.rs @@ -243,7 +243,7 @@ pub enum WebDriverScriptCommand { IsEnabled(String, IpcSender>), IsSelected(String, IpcSender>), GetTitle(IpcSender), - /// Match the element type before sending the event for webdriver `element send keys`. + /// Deal with the case of input element for Element Send Keys, which does not send keys. WillSendKeys(String, String, bool, IpcSender>), IsDocumentReadyStateComplete(IpcSender), }