Derive ToCss for font-weight descriptors

This commit is contained in:
Anthony Ramine 2017-07-11 14:59:17 +02:00
parent 3f27654d97
commit 7995a9ed51

View file

@ -75,7 +75,7 @@ add_impls_for_keyword_enum!(FontDisplay);
/// A font-weight value for a @font-face rule.
/// The font-weight CSS property specifies the weight or boldness of the font.
#[cfg(feature = "gecko")]
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]
pub enum FontWeight {
/// Numeric font weights for fonts that provide more than just normal and bold.
Weight(font_weight::T),
@ -85,17 +85,6 @@ pub enum FontWeight {
Bold,
}
#[cfg(feature = "gecko")]
impl ToCss for FontWeight {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
FontWeight::Normal => dest.write_str("normal"),
FontWeight::Bold => dest.write_str("bold"),
FontWeight::Weight(ref weight) => weight.to_css(dest),
}
}
}
#[cfg(feature = "gecko")]
impl Parse for FontWeight {
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>)