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

@ -16,7 +16,7 @@ use canvas_traits::canvas::{CanvasId, CanvasMsg};
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::{
AnimationState, EmbedderMsg, FocusSequenceNumber, JSValue, JavaScriptEvaluationError,
JavaScriptEvaluationId, MediaSessionEvent, TouchEventResult, ViewportDetails,
JavaScriptEvaluationId, MediaSessionEvent, Theme, TouchEventResult, ViewportDetails,
WebDriverMessageId,
};
use euclid::default::Size2D as UntypedSize2D;
@ -417,6 +417,8 @@ pub struct IFrameLoadInfoWithData {
pub sandbox: IFrameSandboxState,
/// The initial viewport size for this iframe.
pub viewport_details: ViewportDetails,
/// The [`Theme`] to use within this iframe.
pub theme: Theme,
}
/// Resources required by workerglobalscopes

View file

@ -55,7 +55,7 @@ pub enum EmbedderToConstellationMessage {
/// Inform the Constellation that a `WebView`'s [`ViewportDetails`] have changed.
ChangeViewportDetails(WebViewId, ViewportDetails, WindowSizeType),
/// Inform the constellation of a theme change.
ThemeChange(Theme),
ThemeChange(WebViewId, Theme),
/// Requests that the constellation instruct script/layout to try to layout again and tick
/// animations.
TickAnimation(Vec<WebViewId>),