Derive ToCss for DeclaredValue

This commit is contained in:
Anthony Ramine 2018-03-04 15:21:11 +01:00
parent 1937f594ac
commit 886554dba5

View file

@ -1308,7 +1308,7 @@ impl ShorthandId {
/// Servo's representation of a declared value for a given `T`, which is the /// Servo's representation of a declared value for a given `T`, which is the
/// declared value for that property. /// declared value for that property.
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq, ToCss)]
pub enum DeclaredValue<'a, T: 'a> { pub enum DeclaredValue<'a, T: 'a> {
/// A known specified value from the stylesheet. /// A known specified value from the stylesheet.
Value(&'a T), Value(&'a T),
@ -1438,19 +1438,6 @@ impl UnparsedValue {
} }
} }
impl<'a, T: ToCss> ToCss for DeclaredValue<'a, T> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
match *self {
DeclaredValue::Value(ref inner) => inner.to_css(dest),
DeclaredValue::WithVariables(ref with_variables) => with_variables.to_css(dest),
DeclaredValue::CSSWideKeyword(ref keyword) => keyword.to_css(dest),
}
}
}
/// An identifier for a given property declaration, which can be either a /// An identifier for a given property declaration, which can be either a
/// longhand or a custom property. /// longhand or a custom property.
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]