diff --git a/Cargo.lock b/Cargo.lock index 56535f82b68..0a10a8d6bac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1618,6 +1618,7 @@ version = "0.0.1" dependencies = [ "base", "bitflags 2.9.0", + "embedder_traits", "http 1.3.1", "ipc-channel", "malloc_size_of_derive", diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 147b22728dc..8c0eec13628 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -2063,6 +2063,14 @@ impl ScriptThread { DevtoolScriptControlMsg::GetCssDatabase(reply) => { devtools::handle_get_css_database(reply) }, + DevtoolScriptControlMsg::SimulateColorScheme(id, theme) => { + match documents.find_window(id) { + Some(window) => { + window.handle_theme_change(theme); + }, + None => warn!("Message sent to closed pipeline {}.", id), + } + }, } } diff --git a/components/shared/devtools/Cargo.toml b/components/shared/devtools/Cargo.toml index 5309d1cda67..e81e0709a00 100644 --- a/components/shared/devtools/Cargo.toml +++ b/components/shared/devtools/Cargo.toml @@ -22,3 +22,4 @@ net_traits = { workspace = true } serde = { workspace = true } servo_url = { path = "../../url" } uuid = { workspace = true, features = ["serde"] } +embedder_traits = { workspace = true } diff --git a/components/shared/devtools/lib.rs b/components/shared/devtools/lib.rs index 88a3649ac2a..cd934f5d5ff 100644 --- a/components/shared/devtools/lib.rs +++ b/components/shared/devtools/lib.rs @@ -18,6 +18,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use base::cross_process_instant::CrossProcessInstant; use base::id::{BrowsingContextId, PipelineId, WebViewId}; use bitflags::bitflags; +use embedder_traits::Theme; use http::{HeaderMap, Method}; use ipc_channel::ipc::IpcSender; use malloc_size_of_derive::MallocSizeOf; @@ -258,6 +259,8 @@ pub enum DevtoolScriptControlMsg { Reload(PipelineId), /// Gets the list of all allowed CSS rules and possible values. GetCssDatabase(IpcSender>), + /// Simulates a light or dark color scheme for the given pipeline + SimulateColorScheme(PipelineId, Theme), } #[derive(Clone, Debug, Deserialize, Serialize)]