From 0406be7b686a4d5ec9992f5bc8fdc82bc2402d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 1 Apr 2019 21:48:08 +0000 Subject: [PATCH] style: Make the fixed generic family a parse-time alias to monospace. As discussed on IRC, fixed is only used for prefs right now, and: * We already copy the fixed size to the monospace font. * We already serialize the fixed family as "monospace" in the style system. So it already works somewhat inconsistently. Making it an alias makes it work consistently. Differential Revision: https://phabricator.services.mozilla.com/D24288 --- components/style/values/computed/font.rs | 25 +----------------------- 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index c1d2f1b7425..d332cf4d873 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -303,39 +303,16 @@ pub enum GenericFontFamily { None, Serif, SansSerif, + #[parse(aliases = "-moz-fixed")] Monospace, Cursive, Fantasy, - /// This is basically monospace, but with different font prefs. We should - /// consider removing it in favor of just using the monospace.* prefs, since - /// in practice we don't override the monospace prefs at all. - #[cfg(feature = "gecko")] - MozFixed, /// An internal value for emoji font selection. #[css(skip)] #[cfg(feature = "gecko")] MozEmoji, } -// TODO(emilio): Derive this when we make -moz-fixed a parse alias of Monospace. -impl ToCss for GenericFontFamily { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: fmt::Write, - { - dest.write_str(match *self { - GenericFontFamily::MozEmoji | - GenericFontFamily::Default => return Ok(()), - GenericFontFamily::MozFixed | - GenericFontFamily::Monospace => "monospace", - GenericFontFamily::Serif => "serif", - GenericFontFamily::SansSerif => "sans-serif", - GenericFontFamily::Cursive => "cursive", - GenericFontFamily::Fantasy => "fantasy", - }) - } -} - impl SingleFontFamily { /// Parse a font-family value. pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result> {