mirror of
https://github.com/servo/servo.git
synced 2025-08-24 22:58:21 +01:00
stylo: Store servo computed values for animation properties
MozReview-Commit-ID: IoQLN5tdIBw
This commit is contained in:
parent
f6940f686c
commit
d87b710fdd
7 changed files with 275 additions and 22 deletions
|
@ -6,6 +6,8 @@ type nsAString_internal = nsAString;
|
|||
use gecko_bindings::structs::RawGeckoDocument;
|
||||
use gecko_bindings::structs::RawGeckoElement;
|
||||
use gecko_bindings::structs::RawGeckoNode;
|
||||
use gecko_bindings::structs::RawGeckoAnimationValueList;
|
||||
use gecko_bindings::structs::RawServoAnimationValue;
|
||||
use gecko_bindings::structs::RawGeckoPresContext;
|
||||
use gecko_bindings::structs::ThreadSafeURIHolder;
|
||||
use gecko_bindings::structs::ThreadSafePrincipalHolder;
|
||||
|
@ -177,6 +179,9 @@ pub type RawServoImportRuleBorrowed<'a> = &'a RawServoImportRule;
|
|||
pub type RawServoImportRuleBorrowedOrNull<'a> = Option<&'a RawServoImportRule>;
|
||||
enum RawServoImportRuleVoid { }
|
||||
pub struct RawServoImportRule(RawServoImportRuleVoid);
|
||||
pub type RawServoAnimationValueStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoAnimationValue>;
|
||||
pub type RawServoAnimationValueBorrowed<'a> = &'a RawServoAnimationValue;
|
||||
pub type RawServoAnimationValueBorrowedOrNull<'a> = Option<&'a RawServoAnimationValue>;
|
||||
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
|
||||
pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
|
||||
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
|
||||
|
@ -213,7 +218,19 @@ pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue;
|
|||
pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>;
|
||||
pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue;
|
||||
pub type nsCSSValueBorrowedMutOrNull<'a> = Option<&'a mut nsCSSValue>;
|
||||
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>;
|
||||
|
||||
extern "C" {
|
||||
pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void,
|
||||
aCapacity: usize, aElementSize: usize);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ClearPODTArray(aArray: *mut ::std::os::raw::c_void,
|
||||
aElementSize: usize, aElementAlign: usize);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_CssRules_AddRef(ptr: ServoCssRulesBorrowed);
|
||||
}
|
||||
|
@ -252,17 +269,15 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_ImportRule_Release(ptr: RawServoImportRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValue_AddRef(ptr: RawServoAnimationValueBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValue_Release(ptr: RawServoAnimationValueBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void,
|
||||
aCapacity: usize, aElementSize: usize);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ClearPODTArray(aArray: *mut ::std::os::raw::c_void,
|
||||
aElementSize: usize, aElementAlign: usize);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_AddRefPrincipalArbitraryThread(aPtr:
|
||||
*mut ThreadSafePrincipalHolder);
|
||||
|
@ -1194,6 +1209,16 @@ extern "C" {
|
|||
ServoComputedValuesBorrowed)
|
||||
-> ServoComputedValuesStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValues_Populate(arg1:
|
||||
RawGeckoAnimationValueListBorrowedMut,
|
||||
arg2:
|
||||
RawServoDeclarationBlockBorrowed,
|
||||
arg3: ServoComputedValuesBorrowed,
|
||||
arg4:
|
||||
ServoComputedValuesBorrowedOrNull,
|
||||
arg5: RawGeckoPresContextBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal)
|
||||
-> RawServoDeclarationBlockStrong;
|
||||
|
|
|
@ -3047,6 +3047,20 @@ pub mod root {
|
|||
impl Clone for StyleComplexColor {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PropertyStyleAnimationValuePair {
|
||||
pub mProperty: root::nsCSSPropertyID,
|
||||
pub mValue: [u64; 2usize],
|
||||
pub mServoValue: root::RefPtr<root::RawServoAnimationValue>,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_PropertyStyleAnimationValuePair() {
|
||||
assert_eq!(::std::mem::size_of::<PropertyStyleAnimationValuePair>()
|
||||
, 32usize);
|
||||
assert_eq!(::std::mem::align_of::<PropertyStyleAnimationValuePair>()
|
||||
, 8usize);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_template_1() {
|
||||
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete<root::RawServoStyleSet>>()
|
||||
|
@ -11596,6 +11610,24 @@ pub mod root {
|
|||
assert_eq!(::std::mem::size_of::<nsCSSValueFloatColor>() , 32usize);
|
||||
assert_eq!(::std::mem::align_of::<nsCSSValueFloatColor>() , 8usize);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_template_8_TEMPORARY() {
|
||||
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsCSSValueList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValueList>>>()
|
||||
, 8usize);
|
||||
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsCSSValueList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValueList>>>()
|
||||
, 8usize);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_template_9_TEMPORARY() {
|
||||
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsCSSValuePairList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValuePairList>>>()
|
||||
, 8usize);
|
||||
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsCSSValuePairList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValuePairList>>>()
|
||||
, 8usize);
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct nsCSSValue {
|
||||
|
@ -11669,6 +11701,14 @@ pub mod root {
|
|||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct RawServoAnimationValue {
|
||||
pub _address: u8,
|
||||
}
|
||||
impl Clone for RawServoAnimationValue {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct RawServoStyleSet {
|
||||
pub _address: u8,
|
||||
}
|
||||
|
@ -11679,6 +11719,8 @@ pub mod root {
|
|||
pub type RawGeckoElement = root::mozilla::dom::Element;
|
||||
pub type RawGeckoDocument = root::nsIDocument;
|
||||
pub type RawGeckoPresContext = [u64; 162usize];
|
||||
pub type RawGeckoAnimationValueList =
|
||||
root::nsTArray<root::mozilla::PropertyStyleAnimationValuePair>;
|
||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
||||
|
@ -11686,6 +11728,8 @@ pub mod root {
|
|||
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoPresContextBorrowed = *const [u64; 162usize];
|
||||
pub type RawGeckoAnimationValueListBorrowedMut =
|
||||
*mut root::RawGeckoAnimationValueList;
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum nsCSSTokenSerializationType {
|
||||
|
|
|
@ -3029,6 +3029,20 @@ pub mod root {
|
|||
impl Clone for StyleComplexColor {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct PropertyStyleAnimationValuePair {
|
||||
pub mProperty: root::nsCSSPropertyID,
|
||||
pub mValue: [u64; 2usize],
|
||||
pub mServoValue: root::RefPtr<root::RawServoAnimationValue>,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_PropertyStyleAnimationValuePair() {
|
||||
assert_eq!(::std::mem::size_of::<PropertyStyleAnimationValuePair>()
|
||||
, 32usize);
|
||||
assert_eq!(::std::mem::align_of::<PropertyStyleAnimationValuePair>()
|
||||
, 8usize);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_template_1() {
|
||||
assert_eq!(::std::mem::size_of::<root::mozilla::DefaultDelete<root::RawServoStyleSet>>()
|
||||
|
@ -11523,6 +11537,24 @@ pub mod root {
|
|||
assert_eq!(::std::mem::size_of::<nsCSSValueFloatColor>() , 24usize);
|
||||
assert_eq!(::std::mem::align_of::<nsCSSValueFloatColor>() , 8usize);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_template_8_TEMPORARY() {
|
||||
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsCSSValueList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValueList>>>()
|
||||
, 8usize);
|
||||
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsCSSValueList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValueList>>>()
|
||||
, 8usize);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_template_9_TEMPORARY() {
|
||||
assert_eq!(::std::mem::size_of::<root::mozilla::UniquePtr<root::nsCSSValuePairList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValuePairList>>>()
|
||||
, 8usize);
|
||||
assert_eq!(::std::mem::align_of::<root::mozilla::UniquePtr<root::nsCSSValuePairList,
|
||||
root::mozilla::DefaultDelete<root::nsCSSValuePairList>>>()
|
||||
, 8usize);
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct nsCSSValue {
|
||||
|
@ -11596,6 +11628,14 @@ pub mod root {
|
|||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct RawServoAnimationValue {
|
||||
pub _address: u8,
|
||||
}
|
||||
impl Clone for RawServoAnimationValue {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct RawServoStyleSet {
|
||||
pub _address: u8,
|
||||
}
|
||||
|
@ -11606,6 +11646,8 @@ pub mod root {
|
|||
pub type RawGeckoElement = root::mozilla::dom::Element;
|
||||
pub type RawGeckoDocument = root::nsIDocument;
|
||||
pub type RawGeckoPresContext = [u64; 158usize];
|
||||
pub type RawGeckoAnimationValueList =
|
||||
root::nsTArray<root::mozilla::PropertyStyleAnimationValuePair>;
|
||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
||||
|
@ -11613,6 +11655,8 @@ pub mod root {
|
|||
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoPresContextBorrowed = *const [u64; 158usize];
|
||||
pub type RawGeckoAnimationValueListBorrowedMut =
|
||||
*mut root::RawGeckoAnimationValueList;
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum nsCSSTokenSerializationType {
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
//! A rust helper to ease the use of Gecko's refcounted types.
|
||||
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::sugar::ownership::HasArcFFI;
|
||||
use heapsize::HeapSizeOf;
|
||||
use std::{mem, ptr};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Trait for all objects that have Addref() and Release
|
||||
/// methods and can be placed inside RefPtr<T>
|
||||
|
@ -196,6 +198,14 @@ impl<T: RefCounted> structs::RefPtr<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> structs::RefPtr<T> {
|
||||
/// Sets the contents to an Arc<T>
|
||||
/// will leak existing contents
|
||||
pub fn set_arc_leaky<U>(&mut self, other: Arc<U>) where U: HasArcFFI<FFIType = T> {
|
||||
*self = unsafe { mem::transmute(other) }; // Arc::into_raw is unstable :(
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: RefCounted> Drop for RefPtr<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { self.release() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue