constellation: Pass system theme to new Pipelines (#37132)

Previously, when the theme was set it was only set on currently active
`Window`s. This change makes setting the `Theme` stateful. Now the
`Constellation` tracks what theme is applied to a `WebView` and properly
passes that value to new `Pipeline`s when they are constructed. In
addition, the value is passed to layout when that is constructed as
well.

Testing: this change adds a unit test.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-05-26 14:05:38 +02:00 committed by GitHub
parent c96de69e80
commit d3e57a513c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 201 additions and 74 deletions

View file

@ -12,7 +12,7 @@ use base::cross_process_instant::CrossProcessInstant;
use base::id::{BrowsingContextId, PipelineId, WebViewId};
use constellation_traits::LoadData;
use crossbeam_channel::Sender;
use embedder_traits::ViewportDetails;
use embedder_traits::{Theme, ViewportDetails};
use http::header;
use net_traits::request::{
CredentialsMode, InsecureRequestsPolicy, RedirectMode, RequestBuilder, RequestMode,
@ -159,6 +159,9 @@ pub(crate) struct InProgressLoad {
/// this load.
#[no_trace]
pub(crate) url_list: Vec<ServoUrl>,
/// The [`Theme`] to use for this page, once it loads.
#[no_trace]
pub(crate) theme: Theme,
}
impl InProgressLoad {
@ -171,6 +174,7 @@ impl InProgressLoad {
parent_info: Option<PipelineId>,
opener: Option<BrowsingContextId>,
viewport_details: ViewportDetails,
theme: Theme,
origin: MutableOrigin,
load_data: LoadData,
) -> InProgressLoad {
@ -189,6 +193,7 @@ impl InProgressLoad {
canceller: Default::default(),
load_data,
url_list: vec![url],
theme,
}
}