diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index 287ab6a1797..f6703bc9b3f 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -406,6 +406,21 @@ fn eval_prefers_color_scheme(device: &Device, query_value: Option) -> bool { + let prefers_color_scheme = if static_prefs::pref!("browser.theme.dark-toolbar-theme") { + PrefersColorScheme::Dark + } else { + PrefersColorScheme::Light + }; + + match query_value { + Some(v) => prefers_color_scheme == v, + None => true, + } +} + bitflags! { /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction struct PointerCapabilities: u8 { @@ -624,7 +639,7 @@ macro_rules! bool_pref_feature { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. -pub static MEDIA_FEATURES: [MediaFeatureDescription; 61] = [ +pub static MEDIA_FEATURES: [MediaFeatureDescription; 62] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -834,6 +849,12 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 61] = [ Evaluator::BoolInteger(eval_moz_non_native_content_theme), ParsingRequirements::CHROME_AND_UA_ONLY, ), + feature!( + atom!("-moz-toolbar-prefers-color-scheme"), + AllowsRanges::No, + keyword_evaluator!(eval_toolbar_prefers_color_scheme, PrefersColorScheme), + ParsingRequirements::CHROME_AND_UA_ONLY, + ), lnf_int_feature!(atom!("-moz-scrollbar-start-backward"), ScrollArrowStyle, get_scrollbar_start_backward), lnf_int_feature!(atom!("-moz-scrollbar-start-forward"), ScrollArrowStyle, get_scrollbar_start_forward),