Auto merge of #20019 - paavininanda:deriveToCss, r=emilio

Added derive(ToCss) annotation : WIP

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
<!--
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).  -->

<!-- Either: -->
<!--
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
 -->

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20019)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-02-11 14:10:48 -05:00 committed by GitHub
commit 0653f3097c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 23 deletions

View file

@ -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,

View file

@ -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,
@ -92,6 +92,7 @@ pub enum Content {
#[cfg(feature = "gecko")]
MozAltContent,
/// Content items.
#[css(iterable)]
Items(Box<[ContentItem]>),
}