Bug 1343753 - Add Servo_Property_IsAnimatable.

MozReview-Commit-ID: 343Md43bpij
This commit is contained in:
Boris Chiou 2017-04-12 16:38:01 +08:00
parent 9a3905f834
commit 51ad646c96
3 changed files with 22 additions and 0 deletions

View file

@ -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;

View file

@ -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<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,

View file

@ -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();