From a71b5d5e167b445f3b80972f298b1b25652f6a36 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 2 Mar 2018 20:22:03 +0100 Subject: [PATCH] Derive ToCss for Symbols --- components/style/counter_style/mod.rs | 19 ++----------------- components/style_derive/to_css.rs | 2 ++ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index 1ad385c4bfd..65f570ffa9d 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -550,7 +550,8 @@ impl Parse for Fallback { /// #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] -#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)] +#[css(iterable)] +#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)] pub struct Symbols(pub Vec); impl Parse for Symbols { @@ -570,22 +571,6 @@ impl Parse for Symbols { } } -impl ToCss for Symbols { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: Write, - { - let mut iter = self.0.iter(); - let first = iter.next().expect("expected at least one symbol"); - first.to_css(dest)?; - for item in iter { - dest.write_char(' ')?; - item.to_css(dest)?; - } - Ok(()) - } -} - /// #[derive(Clone, Debug, ToCss)] pub struct AdditiveSymbols(pub Vec); diff --git a/components/style_derive/to_css.rs b/components/style_derive/to_css.rs index f86418b2361..bd70aebf3ea 100644 --- a/components/style_derive/to_css.rs +++ b/components/style_derive/to_css.rs @@ -131,6 +131,8 @@ struct CssInputAttrs { derive_debug: bool, function: Option, comma: bool, + // Here because structs variants are also their whole type definition. + iterable: bool, } #[darling(attributes(css), default)]