diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 978a1ef8250..74c78ef7efc 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -1686,6 +1686,9 @@ extern "C" { nsCSSPropertyID) -> RawServoAnimationValueStrong; } +extern "C" { + pub fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool; +} extern "C" { pub fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool; diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index b38cd04db72..ff11c9d5930 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -118,6 +118,19 @@ impl TransitionProperty { } } +/// 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: + % if prop.animatable: + ${helpers.to_nscsspropertyid(prop.ident)} => true, + % endif + % endfor + _ => false + } +} + impl ToCss for TransitionProperty { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write, diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index d1205a0f574..06b6d9bc6b2 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -461,6 +461,12 @@ pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(computed_values: Se Arc::new(AnimationValue::from_computed_values(&property_id.into(), computed_values)).into_strong() } +#[no_mangle] +pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool { + use style::properties::animated_properties; + animated_properties::nscsspropertyid_is_animatable(property) +} + #[no_mangle] pub extern "C" fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool { let property: TransitionProperty = property.into();