From 9c3c954aa2aaf895b1c2eacea1c3b634cd11c310 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 15 Jun 2017 10:13:04 +0900 Subject: [PATCH] Introduce AnimatableLonghand type This type, which we will use in the next patch in this series, can represent only longhands whose animation type is not "none". By introducing this type, we can later restrict the meaning of TransitionProperty to only cover properties whose animation type is not "none" OR "discrete" (since currently CSS transitions should not animate properties whose animation type is discrete). Doing so will also mean that CSS transitions ignore the 'display' property by default. Furthermore, introducing this type will allow the animation code to clearly document when a property is allowed to be a shorthand or unanimatable property and when it is expected to be an animatable longhand. This, in turn, will allow us to remove a few no-longer-necessary checks and simplify the code. --- .../properties/helpers/animated_properties.mako.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 136d787532d..723c9301573 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -46,6 +46,20 @@ use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius; use values::generics::position as generic_position; +/// A longhand property whose animation type is not "none". +/// +/// NOTE: This includes the 'display' property since it is animatable from SMIL even though it is +/// not animatable from CSS animations or Web Animations. CSS transitions also does not allow +/// animating 'display', but for CSS transitions we have the separate TransitionProperty type. +pub enum AnimatableLonghand { + % for prop in data.longhands: + % if prop.animatable: + /// ${prop.name} + ${prop.camel_case}, + % endif + % endfor +} + /// A given transition property, that is either `All`, an animatable longhand property, /// a shorthand with at least one animatable longhand component, or an unsupported property. // NB: This needs to be here because it needs all the longhands generated