mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add FFI for getting the zero value of an animation value
This commit is contained in:
parent
e48f94cbda
commit
34556f7769
2 changed files with 18 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue