diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index 96f71df09e7..8ccd98dd2cc 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -2248,6 +2248,9 @@ extern "C" { extern "C" { pub fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool; } +extern "C" { + pub fn Servo_Property_IsTransitionable(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 f8695e000fc..dfc55107435 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -338,6 +338,19 @@ 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: + ${helpers.to_nscsspropertyid(prop.ident)} => true, + % endif + % endfor + _ => false + } +} + /// An animated property interpolation between two computed values for that /// property. #[derive(Clone, Debug, PartialEq)] diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 4f997459cf2..50cb50f81ed 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -702,6 +702,12 @@ pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool animated_properties::nscsspropertyid_is_animatable(property) } +#[no_mangle] +pub extern "C" fn Servo_Property_IsTransitionable(property: nsCSSPropertyID) -> bool { + use style::properties::animated_properties; + animated_properties::nscsspropertyid_is_transitionable(property) +} + #[no_mangle] pub extern "C" fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool { match AnimatableLonghand::from_nscsspropertyid(property) {