Derive ToCss for Symbols

This commit is contained in:
Anthony Ramine 2018-03-02 20:22:03 +01:00
parent ba1d3d4b81
commit a71b5d5e16
2 changed files with 4 additions and 17 deletions

View file

@ -550,7 +550,8 @@ impl Parse for Fallback {
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
#[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<Symbol>);
impl Parse for Symbols {
@ -570,22 +571,6 @@ impl Parse for Symbols {
}
}
impl ToCss for Symbols {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> 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(())
}
}
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
#[derive(Clone, Debug, ToCss)]
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);

View file

@ -131,6 +131,8 @@ struct CssInputAttrs {
derive_debug: bool,
function: Option<Function>,
comma: bool,
// Here because structs variants are also their whole type definition.
iterable: bool,
}
#[darling(attributes(css), default)]