From 2867bbcacc0718d6fdac8afd8d881c88f35ada89 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Wed, 12 Apr 2017 16:27:59 +0800 Subject: [PATCH] Bug 1343753 - Add Servo_Animationvalues_IsInterpolable. MozReview-Commit-ID: gaj9lJ7NYV --- components/style/gecko_bindings/bindings.rs | 7 +++++++ ports/geckolib/glue.rs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index e0c8de4ac40..6c118e92bdc 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -1692,6 +1692,13 @@ extern "C" { progress: f64) -> RawServoAnimationValueStrong; } +extern "C" { + pub fn Servo_AnimationValues_IsInterpolable(from: + RawServoAnimationValueBorrowed, + to: + RawServoAnimationValueBorrowed) + -> bool; +} extern "C" { pub fn Servo_AnimationValue_Serialize(value: RawServoAnimationValueBorrowed, diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index c78be1a196c..bb7267cd175 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -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] pub extern "C" fn Servo_AnimationValueMap_Push(value_map: RawServoAnimationValueMapBorrowed, property: nsCSSPropertyID,