Bug 1343753 - Add Servo_Animationvalues_IsInterpolable.

MozReview-Commit-ID: gaj9lJ7NYV
This commit is contained in:
Boris Chiou 2017-04-12 16:27:59 +08:00
parent 4a1b812ee4
commit 2867bbcacc
2 changed files with 16 additions and 0 deletions

View file

@ -1692,6 +1692,13 @@ extern "C" {
progress: f64) progress: f64)
-> RawServoAnimationValueStrong; -> RawServoAnimationValueStrong;
} }
extern "C" {
pub fn Servo_AnimationValues_IsInterpolable(from:
RawServoAnimationValueBorrowed,
to:
RawServoAnimationValueBorrowed)
-> bool;
}
extern "C" { extern "C" {
pub fn Servo_AnimationValue_Serialize(value: pub fn Servo_AnimationValue_Serialize(value:
RawServoAnimationValueBorrowed, RawServoAnimationValueBorrowed,

View file

@ -256,6 +256,15 @@ pub extern "C" fn Servo_AnimationValues_Interpolate(from: RawServoAnimationValue
} }
} }
#[no_mangle]
pub extern "C" fn Servo_AnimationValues_IsInterpolable(from: RawServoAnimationValueBorrowed,
to: RawServoAnimationValueBorrowed)
-> bool {
let from_value = AnimationValue::as_arc(&from);
let to_value = AnimationValue::as_arc(&to);
from_value.interpolate(to_value, 0.5).is_ok()
}
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AnimationValueMap_Push(value_map: RawServoAnimationValueMapBorrowed, pub extern "C" fn Servo_AnimationValueMap_Push(value_map: RawServoAnimationValueMapBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,