mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
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:
commit
0653f3097c
2 changed files with 2 additions and 23 deletions
|
@ -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 {
|
impl ToCss for ContentItem {
|
||||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||||
where W: Write,
|
where W: Write,
|
||||||
|
|
|
@ -82,7 +82,7 @@ type CounterStyleType = CounterStyleOrNone;
|
||||||
/// The specified value for the `content` property.
|
/// The specified value for the `content` property.
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-content/#propdef-content
|
/// 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 {
|
pub enum Content {
|
||||||
/// `normal` reserved keyword.
|
/// `normal` reserved keyword.
|
||||||
Normal,
|
Normal,
|
||||||
|
@ -92,6 +92,7 @@ pub enum Content {
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
MozAltContent,
|
MozAltContent,
|
||||||
/// Content items.
|
/// Content items.
|
||||||
|
#[css(iterable)]
|
||||||
Items(Box<[ContentItem]>),
|
Items(Box<[ContentItem]>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue