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

@ -1074,8 +1074,6 @@
predefined_type=length_type,
logical=logical,
**kwargs)">
use std::fmt;
use style_traits::ToCss;
% if not logical:
use values::specified::AllowQuirks;
% endif
@ -1085,8 +1083,8 @@
pub type T = ::values::computed::${length_type};
}
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
pub struct SpecifiedValue(pub ${length_type});
% if length_type == "MozLength":
@ -1131,12 +1129,6 @@
ret.map(SpecifiedValue)
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.0.to_css(dest)
}
}
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
#[inline]