diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index ee986f3ab9d..52a80a19752 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -501,6 +501,7 @@ mod bindings { "RawGeckoNode", "RawGeckoAnimationValueList", "RawServoAnimationValue", + "RawServoAnimationValueList", "RawGeckoPresContext", "RawGeckoPresContextOwned", "ThreadSafeURIHolder", @@ -603,6 +604,7 @@ mod bindings { let servo_borrow_types = [ "nsCSSValue", "RawGeckoAnimationValueList", + "RawServoAnimationValueList", ]; for &ty in structs_types.iter() { builder = builder.hide_type(ty) diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 16bfaf40fff..8f2aa275c35 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -8,6 +8,7 @@ use gecko_bindings::structs::RawGeckoElement; use gecko_bindings::structs::RawGeckoNode; use gecko_bindings::structs::RawGeckoAnimationValueList; use gecko_bindings::structs::RawServoAnimationValue; +use gecko_bindings::structs::RawServoAnimationValueBorrowedList; use gecko_bindings::structs::RawGeckoPresContext; use gecko_bindings::structs::RawGeckoPresContextOwned; use gecko_bindings::structs::ThreadSafeURIHolder; @@ -224,6 +225,8 @@ pub type RawGeckoAnimationValueListBorrowed<'a> = &'a RawGeckoAnimationValueList pub type RawGeckoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoAnimationValueList>; pub type RawGeckoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoAnimationValueList; pub type RawGeckoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoAnimationValueList>; +pub type RawServoAnimationValueBorrowedListBorrowed<'a> = &'a RawServoAnimationValueBorrowedList; +pub type RawServoAnimationValueBorrowedListBorrowedOrNull<'a> = Option<&'a RawServoAnimationValueBorrowedList>; extern "C" { pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void, @@ -1217,6 +1220,10 @@ extern "C" { ServoComputedValuesBorrowed) -> ServoComputedValuesStrong; } +extern "C" { + pub fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueBorrowedListBorrowed) + -> RawServoDeclarationBlockStrong; +} extern "C" { pub fn Servo_AnimationValues_Populate(arg1: RawGeckoAnimationValueListBorrowedMut, diff --git a/components/style/gecko_bindings/structs_debug.rs b/components/style/gecko_bindings/structs_debug.rs index a9f87d0299e..6204b548e33 100644 --- a/components/style/gecko_bindings/structs_debug.rs +++ b/components/style/gecko_bindings/structs_debug.rs @@ -13810,6 +13810,10 @@ pub mod root { pub type RawGeckoPresContextBorrowedMut = *mut root::RawGeckoPresContext; pub type RawGeckoAnimationValueListBorrowedMut = *mut root::RawGeckoAnimationValueList; + pub type RawServoAnimationValueBorrowedList = + root::nsTArray<*const root::RawServoAnimationValue>; + pub type RawServoAnimationValueBorrowedListBorrowed = + *const root::RawServoAnimationValueBorrowedList; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum nsCSSTokenSerializationType { diff --git a/components/style/gecko_bindings/structs_release.rs b/components/style/gecko_bindings/structs_release.rs index 1c2bc868a04..34fa11b9a31 100644 --- a/components/style/gecko_bindings/structs_release.rs +++ b/components/style/gecko_bindings/structs_release.rs @@ -13725,6 +13725,10 @@ pub mod root { pub type RawGeckoPresContextBorrowedMut = *mut root::RawGeckoPresContext; pub type RawGeckoAnimationValueListBorrowedMut = *mut root::RawGeckoAnimationValueList; + pub type RawServoAnimationValueBorrowedList = + root::nsTArray<*const root::RawServoAnimationValue>; + pub type RawServoAnimationValueBorrowedListBorrowed = + *const root::RawServoAnimationValueBorrowedList; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum nsCSSTokenSerializationType { diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 5e2550793e8..672f8f0ea91 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -39,6 +39,7 @@ use style::gecko_bindings::bindings::RawGeckoAnimationValueListBorrowedMut; 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::RawServoImportRuleBorrowed; use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull; use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t; @@ -160,6 +161,24 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, behavior == structs::TraversalRootBehavior::UnstyledChildrenOnly); } +#[no_mangle] +pub extern "C" fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueBorrowedListBorrowed) + -> RawServoDeclarationBlockStrong +{ + let uncomputed_values = value.into_iter() + .map(|v| { + let raw_anim = unsafe { v.as_ref().unwrap() }; + let anim = AnimationValue::as_arc(&raw_anim); + (anim.uncompute(), Importance::Normal) + }) + .collect(); + + Arc::new(RwLock::new(PropertyDeclarationBlock { + declarations: uncomputed_values, + important_count: 0, + })).into_strong() +} + /// Takes a ServoAnimationValues and populates it with the animation values corresponding /// to a given property declaration block #[no_mangle]