mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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
This commit is contained in:
parent
2184e3f2e5
commit
0406be7b68
1 changed files with 1 additions and 24 deletions
|
@ -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<W>(&self, dest: &mut CssWriter<W>) -> 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<Self, ParseError<'i>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue