From 5e40a806ebd689385164958be48008a2dc638f78 Mon Sep 17 00:00:00 2001 From: Mantaroh Yoshinaga Date: Thu, 24 Aug 2017 10:25:44 +0900 Subject: [PATCH] Make Servo_AnimationValues_ComputeDistance return negative value instead of 0.0 when the function fails to distinguish its failure. We need to check whether the function fails or not in order to check whether we support the specified paced animation values. Current servo returns 0.0 when failed computing distance, so servo doesn't distinguish its failure. This patch makes Servo_AnimationValue_ComputeDistance return a negative value when the function fails. --- ports/geckolib/glue.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index eca3ba79d68..684a1992c8b 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -386,7 +386,9 @@ pub extern "C" fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationV -> f64 { let from_value = AnimationValue::as_arc(&from); let to_value = AnimationValue::as_arc(&to); - from_value.compute_squared_distance(to_value).map(|d| d.sqrt()).unwrap_or(0.0) + // If compute_squared_distance() failed, this function will return negative value + // in order to check whether we support the specified paced animation values. + from_value.compute_squared_distance(to_value).map(|d| d.sqrt()).unwrap_or(-1.0) } #[no_mangle]