mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Derive ToCss for Symbols
This commit is contained in:
parent
ba1d3d4b81
commit
a71b5d5e16
2 changed files with 4 additions and 17 deletions
|
@ -550,7 +550,8 @@ impl Parse for Fallback {
|
||||||
|
|
||||||
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
|
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
|
||||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
#[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>);
|
pub struct Symbols(pub Vec<Symbol>);
|
||||||
|
|
||||||
impl Parse for Symbols {
|
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>
|
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
|
||||||
#[derive(Clone, Debug, ToCss)]
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);
|
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);
|
||||||
|
|
|
@ -131,6 +131,8 @@ struct CssInputAttrs {
|
||||||
derive_debug: bool,
|
derive_debug: bool,
|
||||||
function: Option<Function>,
|
function: Option<Function>,
|
||||||
comma: bool,
|
comma: bool,
|
||||||
|
// Here because structs variants are also their whole type definition.
|
||||||
|
iterable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[darling(attributes(css), default)]
|
#[darling(attributes(css), default)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue