mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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.
This commit is contained in:
parent
8fc7d28758
commit
5e40a806eb
1 changed files with 3 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue