Derive the most trivial ToCss implementations 🌋

For now, all variants get serialised as the space-separated serialisations
of their fields. Unit variants are not supported.
This commit is contained in:
Anthony Ramine 2017-06-04 15:45:09 +02:00
parent 6d6f03974d
commit c4f1d647a0
18 changed files with 113 additions and 263 deletions

View file

@ -222,8 +222,8 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
pub mod computed_value {
pub use super::RepeatKeyword;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, Clone, PartialEq, ToCss)]
pub struct T(pub RepeatKeyword, pub RepeatKeyword);
}
@ -238,14 +238,6 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
"round" => Round,
"space" => Space);
impl ToCss for computed_value::T {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(self.0.to_css(dest));
try!(dest.write_str(" "));
self.1.to_css(dest)
}
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(self.0.to_css(dest));