Derive ToCss for TransitionProperty

This commit is contained in:
Anthony Ramine 2017-06-15 11:46:40 +02:00
parent 51a4481388
commit ad79a19587

View file

@ -31,8 +31,7 @@ use selectors::parser::SelectorParseError;
use smallvec::SmallVec;
use std::cmp;
#[cfg(feature = "gecko")] use std::collections::HashMap;
use std::fmt;
use style_traits::{ToCss, ParseError};
use style_traits::ParseError;
use super::ComputedValues;
use values::{Auto, CSSFloat, CustomIdent, Either};
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
@ -178,8 +177,8 @@ pub fn nscsspropertyid_is_animatable(property: nsCSSPropertyID) -> bool {
/// a shorthand with at least one transitionable longhand component, or an unsupported property.
// NB: This needs to be here because it needs all the longhands generated
// beforehand.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, Hash, PartialEq, ToCss)]
pub enum TransitionProperty {
/// All, any transitionable property changing should generate a transition.
All,
@ -278,22 +277,6 @@ impl TransitionProperty {
}
}
impl ToCss for TransitionProperty {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,
{
match *self {
TransitionProperty::All => dest.write_str("all"),
% for prop in data.longhands + data.shorthands_except_all():
% if prop.transitionable:
TransitionProperty::${prop.camel_case} => dest.write_str("${prop.name}"),
% endif
% endfor
TransitionProperty::Unsupported(ref ident) => ident.to_css(dest),
}
}
}
/// Convert to nsCSSPropertyID.
#[cfg(feature = "gecko")]
#[allow(non_upper_case_globals)]