From 34556f7769ddd7e9a215f44b1eb65e13881531e0 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Mon, 5 Jun 2017 12:03:38 +0900 Subject: [PATCH] Add FFI for getting the zero value of an animation value --- components/style/gecko/generated/bindings.rs | 5 +++++ ports/geckolib/glue.rs | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index f08d4b50f2d..015ee090d3b 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -2185,6 +2185,11 @@ extern "C" { RawServoAnimationValueBorrowed) -> bool; } +extern "C" { + pub fn Servo_AnimationValues_GetZeroValue(value_to_match: + RawServoAnimationValueBorrowed) + -> RawServoAnimationValueStrong; +} extern "C" { pub fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationValueBorrowed, diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 4ef66b422c1..6094a8cdd57 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -313,6 +313,19 @@ pub extern "C" fn Servo_AnimationValues_IsInterpolable(from: RawServoAnimationVa from_value.interpolate(to_value, 0.5).is_ok() } +#[no_mangle] +pub extern "C" fn Servo_AnimationValues_GetZeroValue( + value_to_match: RawServoAnimationValueBorrowed) + -> RawServoAnimationValueStrong +{ + let value_to_match = AnimationValue::as_arc(&value_to_match); + if let Some(zero_value) = value_to_match.get_zero_value() { + Arc::new(zero_value).into_strong() + } else { + RawServoAnimationValueStrong::null() + } +} + #[no_mangle] pub extern "C" fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationValueBorrowed, to: RawServoAnimationValueBorrowed)