style: Add a non-native-theme media query.

Differential Revision: https://phabricator.services.mozilla.com/D102457
This commit is contained in:
Emilio Cobos Álvarez 2021-01-21 06:14:16 +00:00
parent eec92977f7
commit f4a8acc558

View file

@ -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<bool>,
_: Option<RangeOrOperator>,
) -> 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<bool>,
@ -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")),