diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index e1b998ee55d..40957df9d3b 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -26,10 +26,9 @@ use properties::{LonghandId, ShorthandId}; use servo_arc::Arc; use smallvec::SmallVec; use std::{cmp, ptr}; -use std::fmt::{self, Write}; use std::mem::{self, ManuallyDrop}; #[cfg(feature = "gecko")] use hash::FnvHashMap; -use style_traits::{CssWriter, ParseError, ToCss}; +use style_traits::ParseError; use super::ComputedValues; use values::{CSSFloat, CustomIdent, Either}; use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; @@ -79,7 +78,7 @@ 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, Eq, Hash, MallocSizeOf, PartialEq)] +#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToCss)] pub enum TransitionProperty { /// A shorthand. Shorthand(ShorthandId), @@ -90,19 +89,6 @@ pub enum TransitionProperty { Unsupported(CustomIdent), } -impl ToCss for TransitionProperty { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: Write, - { - match *self { - TransitionProperty::Shorthand(ref id) => dest.write_str(id.name()), - TransitionProperty::Longhand(ref id) => dest.write_str(id.name()), - TransitionProperty::Unsupported(ref id) => id.to_css(dest), - } - } -} - trivial_to_computed_value!(TransitionProperty); impl TransitionProperty { diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index dd8cf933e2c..f8d13d33a82 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -800,6 +800,16 @@ pub enum LonghandId { % endfor } +impl ToCss for LonghandId { + #[inline] + fn to_css(&self, dest: &mut CssWriter) -> fmt::Result + where + W: Write, + { + dest.write_str(self.name()) + } +} + impl fmt::Debug for LonghandId { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str(self.name()) @@ -1130,7 +1140,7 @@ where } /// An identifier for a given shorthand property. -#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToCss)] +#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)] pub enum ShorthandId { % for property in data.shorthands: /// ${property.name} @@ -1138,6 +1148,16 @@ pub enum ShorthandId { % endfor } +impl ToCss for ShorthandId { + #[inline] + fn to_css(&self, dest: &mut CssWriter) -> fmt::Result + where + W: Write, + { + dest.write_str(self.name()) + } +} + impl ShorthandId { /// Get the name for this shorthand property. pub fn name(&self) -> &'static str {