diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 38b5273db26..5b07f9c326a 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -432,6 +432,8 @@ class Alias(object): self.original = original self.enabled_in = original.enabled_in self.servo_pref = original.servo_pref + self.animatable = original.animatable + self.transitionable = original.transitionable self.gecko_pref = gecko_pref self.allowed_in_page_rule = original.allowed_in_page_rule self.allowed_in_keyframe_block = original.allowed_in_keyframe_block diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 0e39495afcf..1936bacc3c4 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -50,20 +50,6 @@ use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint} use values::generics::svg::{SVGPaintKind, SVGStrokeDashArray, SVGOpacity}; use void::{self, Void}; - -/// Returns true if this nsCSSPropertyID is one of the animatable properties. -#[cfg(feature = "gecko")] -pub fn nscsspropertyid_is_animatable(property: nsCSSPropertyID) -> bool { - match property { - % for prop in data.longhands + data.shorthands_except_all(): - % if prop.animatable: - ${prop.nscsspropertyid()} => true, - % endif - % endfor - _ => false - } -} - /// Convert nsCSSPropertyID to TransitionProperty #[cfg(feature = "gecko")] #[allow(non_upper_case_globals)] @@ -90,19 +76,6 @@ impl From for TransitionProperty { } } -/// Returns true if this nsCSSPropertyID is one of the transitionable properties. -#[cfg(feature = "gecko")] -pub fn nscsspropertyid_is_transitionable(property: nsCSSPropertyID) -> bool { - match property { - % for prop in data.longhands + data.shorthands_except_all(): - % if prop.transitionable: - ${prop.nscsspropertyid()} => true, - % endif - % endfor - _ => false - } -} - /// An animated property interpolation between two computed values for that /// property. #[derive(Clone, Debug, PartialEq)] diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 6676e956e38..33220ebfd60 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -471,6 +471,20 @@ impl NonCustomPropertyId { MAP[self.0] } + /// Returns whether this property is transitionable. + #[inline] + pub fn is_transitionable(self) -> bool { + ${static_non_custom_property_id_set("TRANSITIONABLE", lambda p: p.transitionable)} + TRANSITIONABLE.contains(self) + } + + /// Returns whether this property is animatable. + #[inline] + pub fn is_animatable(self) -> bool { + ${static_non_custom_property_id_set("ANIMATABLE", lambda p: p.animatable)} + ANIMATABLE.contains(self) + } + #[inline] fn enabled_for_all_content(self) -> bool { ${static_non_custom_property_id_set(