Derive ToCss for specified values of background-repeat

This commit is contained in:
Anthony Ramine 2017-07-11 14:58:04 +02:00
parent 118291ca91
commit 3f27654d97

View file

@ -46,8 +46,8 @@ ${helpers.predefined_type("background-image", "ImageLayer",
"round" => Round,
"no-repeat" => NoRepeat);
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
pub enum SpecifiedValue {
RepeatX,
RepeatY,
@ -80,22 +80,6 @@ ${helpers.predefined_type("background-image", "ImageLayer",
}
}
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
SpecifiedValue::RepeatX => dest.write_str("repeat-x"),
SpecifiedValue::RepeatY => dest.write_str("repeat-y"),
SpecifiedValue::Other(horizontal, vertical) => {
horizontal.to_css(dest)?;
if let Some(vertical) = vertical {
dest.write_str(" ")?;
vertical.to_css(dest)?;
}
Ok(())
}
}
}
}
#[inline]
pub fn get_initial_value() -> computed_value::T {