Add IsTransitionable FFI

This commit is contained in:
Brian Birtles 2017-06-15 10:20:46 +09:00
parent 479c3e4528
commit d249c61c0d
3 changed files with 22 additions and 0 deletions

View file

@ -2248,6 +2248,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool; pub fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool;
} }
extern "C" {
pub fn Servo_Property_IsTransitionable(property: nsCSSPropertyID) -> bool;
}
extern "C" { extern "C" {
pub fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) pub fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID)
-> bool; -> bool;

View file

@ -338,6 +338,19 @@ impl From<nsCSSPropertyID> 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 /// An animated property interpolation between two computed values for that
/// property. /// property.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]

View file

@ -702,6 +702,12 @@ pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool
animated_properties::nscsspropertyid_is_animatable(property) 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] #[no_mangle]
pub extern "C" fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool { pub extern "C" fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool {
match AnimatableLonghand::from_nscsspropertyid(property) { match AnimatableLonghand::from_nscsspropertyid(property) {