From 2aa5f68c92546ed36e6c7e1a31508d4ef4f92b23 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 5 Mar 2018 15:41:10 +0100 Subject: [PATCH] Derive ToCss for FontSize --- components/style/values/generics/font.rs | 4 +++- components/style/values/specified/font.rs | 17 +---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/components/style/values/generics/font.rs b/components/style/values/generics/font.rs index f052d7d2876..c498a3cfaef 100644 --- a/components/style/values/generics/font.rs +++ b/components/style/values/generics/font.rs @@ -162,14 +162,16 @@ impl Parse for FontTag { } #[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)] -#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero)] +#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToCss)] /// Additional information for keyword-derived font sizes. pub struct KeywordInfo { /// The keyword used pub kw: KeywordSize, /// A factor to be multiplied by the computed size of the keyword + #[css(skip)] pub factor: f32, /// An additional Au offset to add to the kw*factor in the case of calcs + #[css(skip)] pub offset: Length, } diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs index 7657962d313..8b2cf9737b9 100644 --- a/components/style/values/specified/font.rs +++ b/components/style/values/specified/font.rs @@ -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(&self, dest: &mut CssWriter) -> 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 for FontSize { fn from(other: LengthOrPercentage) -> Self { FontSize::Length(other)