diff options
Diffstat (limited to 'components/style/values/generics/mod.rs')
-rw-r--r-- | components/style/values/generics/mod.rs | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs index ef88d7c342c..40d3f4e46df 100644 --- a/components/style/values/generics/mod.rs +++ b/components/style/values/generics/mod.rs @@ -182,8 +182,8 @@ impl<T: Parse> Parse for FontSettingTag<T> { /// A font settings value for font-variation-settings or font-feature-settings -#[derive(Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] +#[derive(Clone, Debug, Eq, PartialEq, ToCss)] pub enum FontSettings<T> { /// No settings (default) Normal, @@ -191,15 +191,6 @@ pub enum FontSettings<T> { Tag(Vec<FontSettingTag<T>>) } -impl<T: ToCss> ToCss for FontSettings<T> { - fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match *self { - FontSettings::Normal => dest.write_str("normal"), - FontSettings::Tag(ref ftvs) => ftvs.to_css(dest) - } - } -} - impl<T: Parse> Parse for FontSettings<T> { /// https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> { @@ -290,8 +281,8 @@ pub struct SVGPaint<ColorType> { /// Whereas the spec only allows PaintServer /// to have a fallback, Gecko lets the context /// properties have a fallback as well. -#[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] +#[derive(Clone, Debug, PartialEq, ToCss)] pub enum SVGPaintKind<ColorType> { /// `none` None, @@ -378,18 +369,6 @@ impl<ColorType: Parse> Parse for SVGPaint<ColorType> { } } -impl<ColorType: ToCss> ToCss for SVGPaintKind<ColorType> { - fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match *self { - SVGPaintKind::None => dest.write_str("none"), - SVGPaintKind::ContextStroke => dest.write_str("context-stroke"), - SVGPaintKind::ContextFill => dest.write_str("context-fill"), - SVGPaintKind::Color(ref color) => color.to_css(dest), - SVGPaintKind::PaintServer(ref server) => server.to_css(dest), - } - } -} - impl<ColorType: ToCss> ToCss for SVGPaint<ColorType> { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { self.kind.to_css(dest)?; |