commit 4e67436c44ad073c265d105fa94beb78dfd23f47
parent 35c60591f20f937f126231d231992ea28426e797
Author: Oriol Brufau <obrufau@igalia.com>
Date: Tue, 7 Oct 2025 12:23:19 +0000
Bug 1992880 - Restrict `font-family: math` to Gecko. r=firefox-style-system-reviewers,emilio
This is a fixup for https://phabricator.services.mozilla.com/D256978
Differential Revision: https://phabricator.services.mozilla.com/D267695
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/servo/components/style/values/computed/font.rs b/servo/components/style/values/computed/font.rs
@@ -420,6 +420,7 @@ impl FontFamily {
generic_font_family!(MONOSPACE, Monospace);
generic_font_family!(CURSIVE, Cursive);
generic_font_family!(FANTASY, Fantasy);
+ #[cfg(feature = "gecko")]
generic_font_family!(MATH, Math);
#[cfg(feature = "gecko")]
generic_font_family!(MOZ_EMOJI, MozEmoji);
@@ -435,6 +436,7 @@ impl FontFamily {
GenericFontFamily::Monospace => &*MONOSPACE,
GenericFontFamily::Cursive => &*CURSIVE,
GenericFontFamily::Fantasy => &*FANTASY,
+ #[cfg(feature = "gecko")]
GenericFontFamily::Math => &*MATH,
#[cfg(feature = "gecko")]
GenericFontFamily::MozEmoji => &*MOZ_EMOJI,
@@ -577,6 +579,7 @@ fn system_ui_enabled(_: &ParserContext) -> bool {
static_prefs::pref!("layout.css.system-ui.enabled")
}
+#[cfg(feature = "gecko")]
fn math_enabled(context: &ParserContext) -> bool {
context.chrome_rules_enabled() || static_prefs::pref!("mathml.font_family_math.enabled")
}
@@ -619,6 +622,7 @@ pub enum GenericFontFamily {
Monospace,
Cursive,
Fantasy,
+ #[cfg(feature = "gecko")]
#[parse(condition = "math_enabled")]
Math,
#[parse(condition = "system_ui_enabled")]
@@ -635,9 +639,9 @@ impl GenericFontFamily {
/// the user. See bug 789788 and bug 1730098.
pub(crate) fn valid_for_user_font_prioritization(self) -> bool {
match self {
- Self::None | Self::Cursive | Self::Fantasy | Self::Math | Self::SystemUi => false,
+ Self::None | Self::Cursive | Self::Fantasy | Self::SystemUi => false,
#[cfg(feature = "gecko")]
- Self::MozEmoji => false,
+ Self::Math | Self::MozEmoji => false,
Self::Serif | Self::SansSerif | Self::Monospace => true,
}
}