Serialize font longhands to -moz-use-system-font when using system font like what Gecko does.

This commit is contained in:
Xidorn Quan 2017-07-11 16:25:09 +10:00
parent 8fa2a262dc
commit 0e91f033cb
2 changed files with 22 additions and 36 deletions

View file

@ -493,8 +493,6 @@
%>
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
use properties::longhands::system_font::SystemFont;
use std::fmt;
use style_traits::ToCss;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
@ -517,21 +515,12 @@
${gecko_keyword_conversion(keyword, keyword.values_for(product), type="T", cast_to="i32")}
}
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
#[derive(Debug, Clone, PartialEq, Eq, Copy, ToCss)]
pub enum SpecifiedValue {
Keyword(computed_value::T),
System(SystemFont),
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
SpecifiedValue::Keyword(k) => k.to_css(dest),
SpecifiedValue::System(_) => Ok(())
}
}
}
pub fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<SpecifiedValue, ParseError<'i>> {
Ok(SpecifiedValue::Keyword(computed_value::T::parse(input)?))
}