diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 8f2aa275c35..e1190c2ca15 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -1220,6 +1220,12 @@ extern "C" { ServoComputedValuesBorrowed) -> ServoComputedValuesStrong; } +extern "C" { + pub fn Servo_AnimationValues_Interpolate(from: RawServoAnimationValueBorrowed, + to: RawServoAnimationValueBorrowed, + progress: f64) + -> RawServoAnimationValueStrong; +} extern "C" { pub fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueBorrowedListBorrowed) -> RawServoDeclarationBlockStrong; diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 672f8f0ea91..ea850eee4db 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -40,6 +40,7 @@ use style::gecko_bindings::bindings::RawGeckoElementBorrowed; use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed; use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed; use style::gecko_bindings::bindings::RawServoAnimationValueBorrowedListBorrowed; +use style::gecko_bindings::bindings::RawServoAnimationValueStrong; use style::gecko_bindings::bindings::RawServoImportRuleBorrowed; use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull; use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t; @@ -59,7 +60,7 @@ use style::parser::{ParserContext, ParserContextExtraData}; use style::properties::{CascadeFlags, ComputedValues, Importance, PropertyDeclaration}; use style::properties::{PropertyDeclarationParseResult, PropertyDeclarationBlock, PropertyId}; use style::properties::{apply_declarations, parse_one_declaration}; -use style::properties::animated_properties::AnimationValue; +use style::properties::animated_properties::{AnimationValue, Interpolate}; use style::restyle_hints::RestyleHint; use style::selector_parser::PseudoElementCascadeType; use style::sequential; @@ -161,6 +162,21 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, behavior == structs::TraversalRootBehavior::UnstyledChildrenOnly); } +#[no_mangle] +pub extern "C" fn Servo_AnimationValues_Interpolate(from: RawServoAnimationValueBorrowed, + to: RawServoAnimationValueBorrowed, + progress: f64) + -> RawServoAnimationValueStrong +{ + let from_value = AnimationValue::as_arc(&from); + let to_value = AnimationValue::as_arc(&to); + if let Ok(value) = from_value.interpolate(to_value, progress) { + Arc::new(value).into_strong() + } else { + RawServoAnimationValueStrong::null() + } +} + #[no_mangle] pub extern "C" fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueBorrowedListBorrowed) -> RawServoDeclarationBlockStrong