Skip to content

Commit

Permalink
Added derive ToCss for Content and removed manual Impl
Browse files Browse the repository at this point in the history
  • Loading branch information
nupurbaghel committed Feb 11, 2018
1 parent 2f4362e commit 8116962
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
22 changes: 0 additions & 22 deletions components/style/values/computed/counters.rs
Expand Up @@ -146,28 +146,6 @@ impl Parse for Content {
}
}

impl ToCss for Content {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where W: Write,
{
match *self {
Content::Normal => dest.write_str("normal"),
Content::None => dest.write_str("none"),
#[cfg(feature = "gecko")]
Content::MozAltContent => dest.write_str("-moz-alt-content"),
Content::Items(ref content) => {
let mut iter = content.iter();
iter.next().unwrap().to_css(dest)?;
for c in iter {
dest.write_str(" ")?;
c.to_css(dest)?;
}
Ok(())
}
}
}
}

impl ToCss for ContentItem {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where W: Write,
Expand Down
3 changes: 2 additions & 1 deletion components/style/values/specified/counters.rs
Expand Up @@ -82,7 +82,7 @@ type CounterStyleType = CounterStyleOrNone;
/// The specified value for the `content` property.
///
/// https://drafts.csswg.org/css-content/#propdef-content
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum Content {
/// `normal` reserved keyword.
Normal,
Expand All @@ -92,6 +92,7 @@ pub enum Content {
#[cfg(feature = "gecko")]
MozAltContent,
/// Content items.
#[css(iterable)]
Items(Box<[ContentItem]>),
}

Expand Down

0 comments on commit 8116962

Please sign in to comment.