mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add Servo_AnimationValue_Transform which creates an AnimationValue of transform.
This commit is contained in:
parent
f02bd01add
commit
1f5551c397
4 changed files with 46 additions and 12 deletions
|
@ -2628,6 +2628,10 @@ extern "C" {
|
|||
list:
|
||||
*mut RefPtr<nsCSSValueSharedList>);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValue_Transform(list: *const nsCSSValueSharedList)
|
||||
-> RawServoAnimationValueStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_AnimationValue_DeepEqual(arg1:
|
||||
RawServoAnimationValueBorrowed,
|
||||
|
|
|
@ -23,6 +23,12 @@ impl nsCSSValue {
|
|||
unsafe { mem::zeroed() }
|
||||
}
|
||||
|
||||
/// Returns true if this nsCSSValue is none.
|
||||
#[inline]
|
||||
pub fn is_none(&self) -> bool {
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_None
|
||||
}
|
||||
|
||||
/// Returns this nsCSSValue value as an integer, unchecked in release
|
||||
/// builds.
|
||||
pub fn integer_unchecked(&self) -> i32 {
|
||||
|
|
|
@ -3097,18 +3097,32 @@ fn static_assert() {
|
|||
}
|
||||
}
|
||||
pub fn clone_transform(&self) -> longhands::transform::computed_value::T {
|
||||
use properties::longhands::transform::computed_value;
|
||||
|
||||
if self.gecko.mSpecifiedTransform.mRawPtr.is_null() {
|
||||
return computed_value::T(None);
|
||||
return longhands::transform::computed_value::T(None);
|
||||
}
|
||||
let list = unsafe { (*self.gecko.mSpecifiedTransform.to_safe().get()).mHead.as_ref() };
|
||||
let result = list.map(|list| {
|
||||
list.into_iter()
|
||||
.map(|value| Self::clone_single_transform_function(value))
|
||||
.collect()
|
||||
});
|
||||
computed_value::T(result)
|
||||
Self::clone_transform_from_list(list)
|
||||
}
|
||||
pub fn clone_transform_from_list(list: Option< &structs::root::nsCSSValueList>)
|
||||
-> longhands::transform::computed_value::T {
|
||||
let result = match list {
|
||||
Some(list) => {
|
||||
let vec: Vec<_> = list
|
||||
.into_iter()
|
||||
.filter_map(|value| {
|
||||
// Handle none transform.
|
||||
if value.is_none() {
|
||||
None
|
||||
} else {
|
||||
Some(Self::clone_single_transform_function(value))
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
if !vec.is_empty() { Some(vec) } else { None }
|
||||
},
|
||||
_ => None,
|
||||
};
|
||||
longhands::transform::computed_value::T(result)
|
||||
}
|
||||
|
||||
${impl_transition_time_value('delay', 'Delay')}
|
||||
|
|
|
@ -653,9 +653,10 @@ pub extern "C" fn Servo_AnimationValue_Opacity(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValueBorrowed,
|
||||
list: *mut structs::RefPtr<nsCSSValueSharedList>)
|
||||
{
|
||||
pub extern "C" fn Servo_AnimationValue_GetTransform(
|
||||
value: RawServoAnimationValueBorrowed,
|
||||
list: *mut structs::RefPtr<nsCSSValueSharedList>
|
||||
) {
|
||||
let value = AnimationValue::as_arc(&value);
|
||||
if let AnimationValue::Transform(ref servo_list) = **value {
|
||||
let list = unsafe { &mut *list };
|
||||
|
@ -672,6 +673,15 @@ pub extern "C" fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValu
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_AnimationValue_Transform(
|
||||
list: *const nsCSSValueSharedList
|
||||
) -> RawServoAnimationValueStrong {
|
||||
let list = unsafe { (&*list).mHead.as_ref() };
|
||||
let transform = style_structs::Box::clone_transform_from_list(list);
|
||||
Arc::new(AnimationValue::Transform(transform)).into_strong()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_AnimationValue_DeepEqual(this: RawServoAnimationValueBorrowed,
|
||||
other: RawServoAnimationValueBorrowed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue