From f4a8acc5582cb777229291b22b5a8522058ed522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 21 Jan 2021 06:14:16 +0000 Subject: [PATCH] style: Add a non-native-theme media query. Differential Revision: https://phabricator.services.mozilla.com/D102457 --- components/style/gecko/media_features.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index d8a7f67157e..03fea6e51e4 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -537,6 +537,16 @@ fn eval_moz_print_preview( query_value.map_or(is_print_preview, |v| v == is_print_preview) } +fn eval_moz_non_native_content_theme( + device: &Device, + query_value: Option, + _: Option, +) -> bool { + let non_native_theme = + unsafe { bindings::Gecko_MediaFeatures_ShouldAvoidNativeTheme(device.document()) }; + query_value.map_or(non_native_theme, |v| v == non_native_theme) +} + fn eval_moz_is_resource_document( device: &Device, query_value: Option, @@ -604,7 +614,7 @@ macro_rules! system_metric_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; 55] = [ +pub static MEDIA_FEATURES: [MediaFeatureDescription; 56] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -808,6 +818,12 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 55] = [ Evaluator::BoolInteger(eval_moz_print_preview), ParsingRequirements::CHROME_AND_UA_ONLY, ), + feature!( + atom!("-moz-non-native-content-theme"), + AllowsRanges::No, + Evaluator::BoolInteger(eval_moz_non_native_content_theme), + ParsingRequirements::CHROME_AND_UA_ONLY, + ), system_metric_feature!(atom!("-moz-scrollbar-start-backward")), system_metric_feature!(atom!("-moz-scrollbar-start-forward")), system_metric_feature!(atom!("-moz-scrollbar-end-backward")),