/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/// https://drafts.csswg.org/mediaqueries-4/#scan fn eval_scan(_: &Context, _: Option<Scan>) -> bool { // Since Gecko doesn't support the 'tv' media type, the 'scan' feature never // matches. false
}
/// https://drafts.csswg.org/mediaqueries-4/#monochrome fn eval_monochrome(context: &Context) -> i32 { // For color devices we should return 0. unsafe { bindings::Gecko_MediaFeatures_GetMonochromeBitsPerPixel(context.device().document()) }
}
/// Values for the color-gamut media feature. /// This implements PartialOrd so that lower values will correctly match /// higher capabilities. #[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, PartialOrd, ToCss)] #[repr(u8)] pubenum ColorGamut { /// The sRGB gamut.
Srgb, /// The gamut specified by the Display P3 Color Space.
P3, /// The gamut specified by the ITU-R Recommendation BT.2020 Color Space.
Rec2020,
}
/// https://drafts.csswg.org/mediaqueries-4/#color-gamut fn eval_color_gamut(context: &Context, query_value: Option<ColorGamut>) -> bool { let query_value = match query_value {
Some(v) => v,
None => returnfalse,
}; let color_gamut = unsafe { bindings::Gecko_MediaFeatures_ColorGamut(context.device().document()) }; // Match if our color gamut is at least as wide as the query value
query_value <= color_gamut
}
/// Values for the dynamic-range and video-dynamic-range media features. /// https://drafts.csswg.org/mediaqueries-5/#dynamic-range /// This implements PartialOrd so that lower values will correctly match /// higher capabilities. #[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, PartialOrd, ToCss)] #[repr(u8)] #[allow(missing_docs)] pubenum DynamicRange {
Standard,
High,
}
/// Possible values for prefers-contrast media query. /// https://drafts.csswg.org/mediaqueries-5/#prefers-contrast #[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)] #[repr(u8)] pubenum PrefersContrast { /// More contrast is preferred.
More, /// Low contrast is preferred.
Less, /// Custom (not more, not less).
Custom, /// The default value if neither high or low contrast is enabled.
NoPreference,
}
/// Possible values for the inverted-colors media query. /// https://drafts.csswg.org/mediaqueries-5/#inverted #[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)] #[repr(u8)] enum InvertedColors { /// Colors are displayed normally.
None, /// All pixels within the displayed area have been inverted.
Inverted,
}
/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-block fn eval_overflow_block(context: &Context, query_value: Option<OverflowBlock>) -> bool { // For the time being, assume that printing (including previews) // is the only time when we paginate, and we are otherwise always // scrolling. This is true at the moment in Firefox, but may need // updating in the future (e.g., ebook readers built with Stylo, a // billboard mode that doesn't support overflow at all). // // If this ever changes, don't forget to change eval_overflow_inline too. let scrolling = context.device().media_type() != MediaType::print(); let query_value = match query_value {
Some(v) => v,
None => returntrue,
};
/// https://drafts.csswg.org/mediaqueries-4/#update fn eval_update(context: &Context, query_value: Option<Update>) -> bool { // This has similar caveats to those described in eval_overflow_block. // For now, we report that print (incl. print media simulation, // which can in fact update but is limited to the developer tools) // is `update: none` and that all other contexts are `update: fast`, // which may not be true for future platforms, like e-ink devices. let can_update = context.device().media_type() != MediaType::print(); let query_value = match query_value {
Some(v) => v,
None => return can_update,
};
/// Allows front-end CSS to discern platform via media queries. #[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)] #[repr(u8)] pubenum Platform { /// Matches any Android version.
Android, /// For our purposes here, "linux" is just "gtk" (so unix-but-not-mac). /// There's no need for our front-end code to differentiate between those /// platforms and they already use the "linux" string elsewhere (e.g., /// toolkit/themes/linux).
Linux, /// Matches any iOS version.
Ios, /// Matches any macOS version.
Macos, /// Matches any Windows version.
Windows,
}
/// Allows front-end CSS to discern gtk theme via media queries. #[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)] #[repr(u8)] pubenum GtkThemeFamily { /// Unknown theme family.
Unknown = 0, /// Adwaita, the default GTK theme.
Adwaita, /// Breeze, the default KDE theme.
Breeze, /// Yaru, the default Ubuntu theme.
Yaru,
}
fn eval_gtk_theme_family(_: &Context, query_value: Option<GtkThemeFamily>) -> bool { let family = unsafe { bindings::Gecko_MediaFeatures_GtkThemeFamily() }; match query_value {
Some(v) => v == family,
None => return family != GtkThemeFamily::Unknown,
}
}
/// Values for the scripting media feature. /// https://drafts.csswg.org/mediaqueries-5/#scripting #[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)] #[repr(u8)] pubenum Scripting { /// Scripting is not supported or not enabled
None, /// Scripting is supported and enabled, but only for initial page load /// We will never match this value as it is intended for non-browser user agents, /// but it is part of the spec so we should still parse it. /// See: https://github.com/w3c/csswg-drafts/issues/8621
InitialOnly, /// Scripting is supported and enabled
Enabled,
}
/// Adding new media features requires (1) adding the new feature to this /// array, with appropriate entries (and potentially any new code needed /// 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. pubstatic MEDIA_FEATURES: [QueryFeatureDescription; 60] = [
feature!(
atom!("width"),
AllowsRanges::Yes,
Evaluator::Length(eval_width),
FeatureFlags::VIEWPORT_DEPENDENT,
),
feature!(
atom!("height"),
AllowsRanges::Yes,
Evaluator::Length(eval_height),
FeatureFlags::VIEWPORT_DEPENDENT,
),
feature!(
atom!("aspect-ratio"),
AllowsRanges::Yes,
Evaluator::NumberRatio(eval_aspect_ratio),
FeatureFlags::VIEWPORT_DEPENDENT,
),
feature!(
atom!("orientation"),
AllowsRanges::No,
keyword_evaluator!(eval_orientation, Orientation),
FeatureFlags::VIEWPORT_DEPENDENT,
),
feature!(
atom!("device-width"),
AllowsRanges::Yes,
Evaluator::Length(eval_device_width),
FeatureFlags::empty(),
),
feature!(
atom!("device-height"),
AllowsRanges::Yes,
Evaluator::Length(eval_device_height),
FeatureFlags::empty(),
),
feature!(
atom!("device-aspect-ratio"),
AllowsRanges::Yes,
Evaluator::NumberRatio(eval_device_aspect_ratio),
FeatureFlags::empty(),
),
feature!(
atom!("-moz-device-orientation"),
AllowsRanges::No,
keyword_evaluator!(eval_device_orientation, Orientation),
FeatureFlags::empty(),
), // Webkit extensions that we support for de-facto web compatibility. // -webkit-{min|max}-device-pixel-ratio (controlled with its own pref):
feature!(
atom!("device-pixel-ratio"),
AllowsRanges::Yes,
Evaluator::Float(eval_device_pixel_ratio),
FeatureFlags::WEBKIT_PREFIX,
), // -webkit-transform-3d.
feature!(
atom!("transform-3d"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_transform_3d),
FeatureFlags::WEBKIT_PREFIX,
),
feature!(
atom!("-moz-device-pixel-ratio"),
AllowsRanges::Yes,
Evaluator::Float(eval_device_pixel_ratio),
FeatureFlags::empty(),
),
feature!(
atom!("resolution"),
AllowsRanges::Yes,
Evaluator::Resolution(eval_resolution),
FeatureFlags::empty(),
),
feature!(
atom!("display-mode"),
AllowsRanges::No,
keyword_evaluator!(eval_display_mode, DisplayMode),
FeatureFlags::empty(),
),
feature!(
atom!("grid"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_grid),
FeatureFlags::empty(),
),
feature!(
atom!("scan"),
AllowsRanges::No,
keyword_evaluator!(eval_scan, Scan),
FeatureFlags::empty(),
),
feature!(
atom!("color"),
AllowsRanges::Yes,
Evaluator::Integer(eval_color),
FeatureFlags::empty(),
),
feature!(
atom!("color-index"),
AllowsRanges::Yes,
Evaluator::Integer(eval_color_index),
FeatureFlags::empty(),
),
feature!(
atom!("monochrome"),
AllowsRanges::Yes,
Evaluator::Integer(eval_monochrome),
FeatureFlags::empty(),
),
feature!(
atom!("color-gamut"),
AllowsRanges::No,
keyword_evaluator!(eval_color_gamut, ColorGamut),
FeatureFlags::empty(),
),
feature!(
atom!("prefers-reduced-motion"),
AllowsRanges::No,
keyword_evaluator!(eval_prefers_reduced_motion, PrefersReducedMotion),
FeatureFlags::empty(),
),
feature!(
atom!("prefers-reduced-transparency"),
AllowsRanges::No,
keyword_evaluator!(
eval_prefers_reduced_transparency,
PrefersReducedTransparency
),
FeatureFlags::empty(),
),
feature!(
atom!("prefers-contrast"),
AllowsRanges::No,
keyword_evaluator!(eval_prefers_contrast, PrefersContrast),
FeatureFlags::empty(),
),
feature!(
atom!("forced-colors"),
AllowsRanges::No,
keyword_evaluator!(eval_forced_colors, ForcedColors),
FeatureFlags::empty(),
),
feature!(
atom!("inverted-colors"),
AllowsRanges::No,
keyword_evaluator!(eval_inverted_colors, InvertedColors),
FeatureFlags::empty(),
),
feature!(
atom!("overflow-block"),
AllowsRanges::No,
keyword_evaluator!(eval_overflow_block, OverflowBlock),
FeatureFlags::empty(),
),
feature!(
atom!("overflow-inline"),
AllowsRanges::No,
keyword_evaluator!(eval_overflow_inline, OverflowInline),
FeatureFlags::empty(),
),
feature!(
atom!("update"),
AllowsRanges::No,
keyword_evaluator!(eval_update, Update),
FeatureFlags::empty(),
),
feature!(
atom!("prefers-color-scheme"),
AllowsRanges::No,
keyword_evaluator!(eval_prefers_color_scheme, PrefersColorScheme),
FeatureFlags::empty(),
),
feature!(
atom!("dynamic-range"),
AllowsRanges::No,
keyword_evaluator!(eval_dynamic_range, DynamicRange),
FeatureFlags::empty(),
),
feature!(
atom!("video-dynamic-range"),
AllowsRanges::No,
keyword_evaluator!(eval_video_dynamic_range, DynamicRange),
FeatureFlags::empty(),
),
feature!(
atom!("scripting"),
AllowsRanges::No,
keyword_evaluator!(eval_scripting, Scripting),
FeatureFlags::empty(),
), // Evaluates to the preferred color scheme for content. Only useful in // chrome context, where the chrome color-scheme and the content // color-scheme might differ.
feature!(
atom!("-moz-content-prefers-color-scheme"),
AllowsRanges::No,
keyword_evaluator!(eval_content_prefers_color_scheme, PrefersColorScheme),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("pointer"),
AllowsRanges::No,
keyword_evaluator!(eval_pointer, Pointer),
FeatureFlags::empty(),
),
feature!(
atom!("any-pointer"),
AllowsRanges::No,
keyword_evaluator!(eval_any_pointer, Pointer),
FeatureFlags::empty(),
),
feature!(
atom!("hover"),
AllowsRanges::No,
keyword_evaluator!(eval_hover, Hover),
FeatureFlags::empty(),
),
feature!(
atom!("any-hover"),
AllowsRanges::No,
keyword_evaluator!(eval_any_hover, Hover),
FeatureFlags::empty(),
), // Internal -moz-is-glyph media feature: applies only inside SVG glyphs. // Internal because it is really only useful in the user agent anyway // and therefore not worth standardizing.
feature!(
atom!("-moz-is-glyph"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_is_glyph),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-in-android-pip-mode"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_in_android_pip_mode),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-is-resource-document"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_is_resource_document),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-platform"),
AllowsRanges::No,
keyword_evaluator!(eval_moz_platform, Platform),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-gtk-theme-family"),
AllowsRanges::No,
keyword_evaluator!(eval_gtk_theme_family, GtkThemeFamily),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-print-preview"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_print_preview),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-overlay-scrollbars"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_overlay_scrollbars),
FeatureFlags::CHROME_AND_UA_ONLY,
),
lnf_int_feature!(atom!("-moz-menubar-drag"), MenuBarDrag),
lnf_int_feature!(atom!("-moz-mac-big-sur-theme"), MacBigSurTheme),
lnf_int_feature!(atom!("-moz-mac-tahoe-theme"), MacTahoeTheme),
feature!(
atom!("-moz-mac-rtl"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_mac_rtl),
FeatureFlags::CHROME_AND_UA_ONLY,
),
feature!(
atom!("-moz-native-theme"),
AllowsRanges::No,
Evaluator::BoolInteger(eval_moz_native_theme),
FeatureFlags::CHROME_AND_UA_ONLY,
),
lnf_int_feature!(
atom!("-moz-windows-accent-color-in-titlebar"),
WindowsAccentColorInTitlebar
),
lnf_int_feature!(atom!("-moz-windows-mica"), WindowsMica),
lnf_int_feature!(atom!("-moz-windows-mica-popups"), WindowsMicaPopups),
lnf_int_feature!(atom!("-moz-swipe-animation-enabled"), SwipeAnimationEnabled),
lnf_int_feature!(atom!("-moz-gtk-csd-available"), GTKCSDAvailable),
lnf_int_feature!(
atom!("-moz-gtk-csd-transparency-available"),
GTKCSDTransparencyAvailable
),
lnf_int_feature!(atom!("-moz-gtk-csd-minimize-button"), GTKCSDMinimizeButton),
lnf_int_feature!(atom!("-moz-gtk-csd-maximize-button"), GTKCSDMaximizeButton),
lnf_int_feature!(atom!("-moz-gtk-csd-close-button"), GTKCSDCloseButton),
lnf_int_feature!(
atom!("-moz-gtk-csd-reversed-placement"),
GTKCSDReversedPlacement
),
lnf_int_feature!(atom!("-moz-system-dark-theme"), SystemUsesDarkTheme),
lnf_int_feature!(atom!("-moz-panel-animations"), PanelAnimations),
];
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.20Bemerkung:
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.