diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 8a1251d9c6e..950c18baaab 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -405,8 +405,8 @@ ${helpers.single_keyword_system("font-variant-caps", no_viewport_percentage!(SpecifiedValue); - #[derive(Debug, Clone, PartialEq, Eq, Copy)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + #[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)] pub enum SpecifiedValue { Normal, Bold, @@ -416,19 +416,6 @@ ${helpers.single_keyword_system("font-variant-caps", System(SystemFont), } - impl ToCss for SpecifiedValue { - fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match *self { - SpecifiedValue::Normal => dest.write_str("normal"), - SpecifiedValue::Bold => dest.write_str("bold"), - SpecifiedValue::Bolder => dest.write_str("bolder"), - SpecifiedValue::Lighter => dest.write_str("lighter"), - SpecifiedValue::Weight(weight) => weight.to_css(dest), - SpecifiedValue::System(sys) => sys.to_css(dest), - } - } - } - /// normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { @@ -1008,7 +995,7 @@ ${helpers.single_keyword_system("font-variant-caps", no_viewport_percentage!(SpecifiedValue); - #[derive(Copy, Clone, Debug, PartialEq)] + #[derive(Clone, Copy, Debug, PartialEq, ToCss)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { None, @@ -1016,18 +1003,6 @@ ${helpers.single_keyword_system("font-variant-caps", System(SystemFont), } - impl ToCss for SpecifiedValue { - fn to_css(&self, dest: &mut W) -> fmt::Result - where W: fmt::Write, - { - match *self { - SpecifiedValue::None => dest.write_str("none"), - SpecifiedValue::Number(number) => number.to_css(dest), - SpecifiedValue::System(sys) => sys.to_css(dest), - } - } - } - impl ToComputedValue for SpecifiedValue { type ComputedValue = computed_value::T; diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index f6b17d0865c..a7b30aafa5e 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -27,8 +27,8 @@ String(Box), } - #[derive(PartialEq, Eq, Clone, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + #[derive(Clone, Debug, Eq, PartialEq, ToCss)] pub struct SpecifiedValue { pub first: Side, pub second: Option @@ -130,17 +130,6 @@ } } } - - impl ToCss for SpecifiedValue { - fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - self.first.to_css(dest)?; - if let Some(ref second) = self.second { - dest.write_str(" ")?; - second.to_css(dest)?; - } - Ok(()) - } - } ${helpers.single_keyword("unicode-bidi", diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs index cb6230be633..a560f564940 100644 --- a/components/style/values/generics/text.rs +++ b/components/style/values/generics/text.rs @@ -13,7 +13,7 @@ use style_traits::{ToCss, ParseError}; /// A generic value for the `initial-letter` property. #[cfg_attr(feature = "servo", derive(HeapSizeOf))] -#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)] +#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)] pub enum InitialLetter { /// `normal` Normal, @@ -29,29 +29,6 @@ impl InitialLetter { } } -impl ToCss for InitialLetter -where - N: ToCss, - I: ToCss, -{ - fn to_css(&self, dest: &mut W) -> fmt::Result - where - W: fmt::Write, - { - match *self { - InitialLetter::Normal => dest.write_str("normal"), - InitialLetter::Specified(ref size, ref sink) => { - size.to_css(dest)?; - if let Some(ref sink) = *sink { - dest.write_str(" ")?; - sink.to_css(dest)?; - } - Ok(()) - }, - } - } -} - /// A generic spacing value for the `letter-spacing` and `word-spacing` properties. #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)] diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index f4aa6cda1c9..46539ed10fb 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -299,7 +299,7 @@ impl ToComputedValue for Color { /// Specified color value, but resolved to just RGBA for computed value /// with value from color property at the same context. -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, Debug, PartialEq, ToCss)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct RGBAColor(pub Color); @@ -311,12 +311,6 @@ impl Parse for RGBAColor { } } -impl ToCss for RGBAColor { - fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - self.0.to_css(dest) - } -} - impl ToComputedValue for RGBAColor { type ComputedValue = RGBA;