mirror of
https://github.com/servo/servo.git
synced 2025-06-18 22:34:30 +01:00
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:
parent
c96de69e80
commit
d3e57a513c
19 changed files with 201 additions and 74 deletions
|
@ -34,6 +34,7 @@ use pixels::Image;
|
|||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use servo_url::ServoUrl;
|
||||
use strum_macros::IntoStaticStr;
|
||||
use style::queries::values::PrefersColorScheme;
|
||||
use style_traits::CSSPixel;
|
||||
use url::Url;
|
||||
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
||||
|
@ -598,6 +599,16 @@ pub enum Theme {
|
|||
/// Dark theme.
|
||||
Dark,
|
||||
}
|
||||
|
||||
impl From<Theme> for PrefersColorScheme {
|
||||
fn from(value: Theme) -> Self {
|
||||
match value {
|
||||
Theme::Light => PrefersColorScheme::Light,
|
||||
Theme::Dark => PrefersColorScheme::Dark,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The type of MediaSession action.
|
||||
/// <https://w3c.github.io/mediasession/#enumdef-mediasessionaction>
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue