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

@ -114,17 +114,15 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
<%helpers:longhand name="list-style-image" animation_value_type="none"
boxed="${product == 'gecko'}"
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image">
use std::fmt;
use values::computed::ComputedValueAsSpecified;
use values::specified::UrlOrNone;
pub use self::computed_value::T as SpecifiedValue;
use style_traits::ToCss;
pub mod computed_value {
use values::specified::UrlOrNone;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, Clone, PartialEq, ToCss)]
pub struct T(pub UrlOrNone);
}
@ -132,12 +130,6 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.0.to_css(dest)
}
}
#[inline]
pub fn get_initial_value() -> computed_value::T {
computed_value::T(Either::Second(None_))