Add Servo_AnimationValue_Transform which creates an AnimationValue of transform.

This commit is contained in:
Boris Chiou 2017-10-27 21:06:20 +02:00
parent f02bd01add
commit 1f5551c397
4 changed files with 46 additions and 12 deletions

View file

@ -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,

View file

@ -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 {

View file

@ -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')}