Derive ToCss for FontSize

This commit is contained in:
Anthony Ramine 2018-03-05 15:41:10 +01:00
parent ca45695db1
commit 2aa5f68c92
2 changed files with 4 additions and 17 deletions

View file

@ -118,7 +118,7 @@ impl ToComputedValue for FontWeight {
}
}
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
/// A specified font-size value
pub enum FontSize {
/// A length; e.g. 10px.
@ -142,21 +142,6 @@ pub enum FontSize {
System(SystemFont)
}
impl ToCss for FontSize {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
match *self {
FontSize::Length(ref lop) => lop.to_css(dest),
FontSize::Keyword(info) => info.kw.to_css(dest),
FontSize::Smaller => dest.write_str("smaller"),
FontSize::Larger => dest.write_str("larger"),
FontSize::System(sys) => sys.to_css(dest),
}
}
}
impl From<LengthOrPercentage> for FontSize {
fn from(other: LengthOrPercentage) -> Self {
FontSize::Length(other)