From 11313368ac99de65bb357aa13ba5a124e690b252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 1 Dec 2022 09:23:19 +0000 Subject: [PATCH] style: Remove non-standard and unused system font values And hide internal but used values. System fonts are not exposed in the computed style so this should be fine. If we need the old values for some obscure reason, it's trivial to alias them to e.g., menu or so. Differential Revision: https://phabricator.services.mozilla.com/D163269 --- .../style/properties/shorthands/font.mako.rs | 2 +- components/style/values/specified/font.rs | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/components/style/properties/shorthands/font.mako.rs b/components/style/properties/shorthands/font.mako.rs index bdedf348af7..d7e425164eb 100644 --- a/components/style/properties/shorthands/font.mako.rs +++ b/components/style/properties/shorthands/font.mako.rs @@ -71,7 +71,7 @@ let mut stretch = None; let size; % if engine == "gecko": - if let Ok(sys) = input.try_parse(SystemFont::parse) { + if let Ok(sys) = input.try_parse(|i| SystemFont::parse(context, i)) { return Ok(expanded! { % for name in SYSTEM_FONT_LONGHANDS: ${name}: ${name}::SpecifiedValue::system_font(sys), diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index 845dbd8b407..d2e47bf7dfc 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -72,21 +72,29 @@ macro_rules! system_font_methods { #[allow(missing_docs)] #[cfg(feature = "gecko")] pub enum SystemFont { + /// https://drafts.csswg.org/css-fonts/#valdef-font-caption Caption, + /// https://drafts.csswg.org/css-fonts/#valdef-font-icon Icon, + /// https://drafts.csswg.org/css-fonts/#valdef-font-menu Menu, + /// https://drafts.csswg.org/css-fonts/#valdef-font-message-box MessageBox, + /// https://drafts.csswg.org/css-fonts/#valdef-font-small-caption SmallCaption, + /// https://drafts.csswg.org/css-fonts/#valdef-font-status-bar StatusBar, - MozWindow, - MozDocument, - MozWorkspace, - MozDesktop, - MozInfo, - MozDialog, - MozButton, + /// Internal system font, used by the ``s on macOS. + #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] MozPullDownMenu, + /// Internal system font, used for `