Bug 1343753 - Add Servo_Property_IsDiscreteAnimatable.

MozReview-Commit-ID: 5pMw7Wynv2q
This commit is contained in:
Boris Chiou 2017-04-12 16:32:11 +08:00
parent 2867bbcacc
commit 28db6788b1
3 changed files with 22 additions and 0 deletions

View file

@ -1684,6 +1684,10 @@ extern "C" {
nsCSSPropertyID) nsCSSPropertyID)
-> RawServoAnimationValueStrong; -> RawServoAnimationValueStrong;
} }
extern "C" {
pub fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID)
-> bool;
}
extern "C" { extern "C" {
pub fn Servo_AnimationValues_Interpolate(from: pub fn Servo_AnimationValues_Interpolate(from:
RawServoAnimationValueBorrowed, RawServoAnimationValueBorrowed,

View file

@ -104,6 +104,18 @@ impl TransitionProperty {
_ => None, _ => None,
} }
} }
/// Returns true if this TransitionProperty is one of the discrete animatable properties.
pub fn is_discrete(&self) -> bool {
match *self {
% for prop in data.longhands:
% if prop.animation_type == "discrete":
TransitionProperty::${prop.camel_case} => true,
% endif
% endfor
_ => false
}
}
} }
impl ToCss for TransitionProperty { impl ToCss for TransitionProperty {

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() Arc::new(AnimationValue::from_computed_values(&property_id.into(), computed_values)).into_strong()
} }
#[no_mangle]
pub extern "C" fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool {
let property: TransitionProperty = property.into();
property.is_discrete()
}
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_StyleWorkerThreadCount() -> u32 { pub extern "C" fn Servo_StyleWorkerThreadCount() -> u32 {
GLOBAL_STYLE_DATA.num_threads as u32 GLOBAL_STYLE_DATA.num_threads as u32