mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Bug 1332633 - Part 2: Implement the FFI for compute distance.
This FFI will be used by nsDOMWindowUtils::ComputeAnimationDistance, which will be implemented in another bug. MozReview-Commit-ID: 6KmMmRiYIew
This commit is contained in:
parent
57f87007f2
commit
f8ac48b78d
2 changed files with 17 additions and 1 deletions
|
@ -1753,6 +1753,13 @@ extern "C" {
|
|||
RawServoAnimationValueBorrowed)
|
||||
-> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValues_ComputeDistance(from:
|
||||
RawServoAnimationValueBorrowed,
|
||||
to:
|
||||
RawServoAnimationValueBorrowed)
|
||||
-> f64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValue_Serialize(value:
|
||||
RawServoAnimationValueBorrowed,
|
||||
|
|
|
@ -74,7 +74,7 @@ use style::parser::{LengthParsingMode, ParserContext};
|
|||
use style::properties::{CascadeFlags, ComputedValues, Importance, ParsedDeclaration};
|
||||
use style::properties::{PropertyDeclarationBlock, PropertyId};
|
||||
use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
use style::properties::animated_properties::{AnimationValue, Interpolate, TransitionProperty};
|
||||
use style::properties::animated_properties::{AnimationValue, ComputeDistance, Interpolate, TransitionProperty};
|
||||
use style::properties::parse_one_declaration;
|
||||
use style::restyle_hints::{self, RestyleHint};
|
||||
use style::rule_tree::StyleSource;
|
||||
|
@ -265,6 +265,15 @@ 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_ComputeDistance(from: RawServoAnimationValueBorrowed,
|
||||
to: RawServoAnimationValueBorrowed)
|
||||
-> f64 {
|
||||
let from_value = AnimationValue::as_arc(&from);
|
||||
let to_value = AnimationValue::as_arc(&to);
|
||||
from_value.compute_distance(to_value).unwrap_or(0.0)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_AnimationValueMap_Push(value_map: RawServoAnimationValueMapBorrowed,
|
||||
property: nsCSSPropertyID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue