Handle None transform properly.

If the transform is None, we should return a valid None transform.
This commit is contained in:
Boris Chiou 2017-05-19 16:08:08 +08:00
parent 63dc43648e
commit 013b4a7fd0
2 changed files with 13 additions and 1 deletions

View file

@ -1187,6 +1187,9 @@ extern "C" {
extern "C" {
pub fn Gecko_NewCSSValueSharedList(len: u32) -> *mut nsCSSValueSharedList;
}
extern "C" {
pub fn Gecko_NewNoneTransform() -> *mut nsCSSValueSharedList;
}
extern "C" {
pub fn Gecko_CSSValue_GetArrayItem(css_value: nsCSSValueBorrowedMut,
index: i32) -> nsCSSValueBorrowedMut;

View file

@ -45,6 +45,7 @@ use style::gecko_bindings::bindings::Gecko_AddPropertyToSet;
use style::gecko_bindings::bindings::Gecko_GetOrCreateFinalKeyframe;
use style::gecko_bindings::bindings::Gecko_GetOrCreateInitialKeyframe;
use style::gecko_bindings::bindings::Gecko_GetOrCreateKeyframeAtStart;
use style::gecko_bindings::bindings::Gecko_NewNoneTransform;
use style::gecko_bindings::bindings::RawGeckoAnimationPropertySegmentBorrowed;
use style::gecko_bindings::bindings::RawGeckoCSSPropertyIDListBorrowed;
use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut;
@ -451,7 +452,15 @@ pub extern "C" fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValu
{
let value = AnimationValue::as_arc(&value);
if let AnimationValue::Transform(ref servo_list) = **value {
style_structs::Box::convert_transform(servo_list.0.clone().unwrap(), unsafe { &mut *list });
let list = unsafe { &mut *list };
match servo_list.0 {
Some(ref servo_list) => {
style_structs::Box::convert_transform(servo_list.clone(), list);
},
None => unsafe {
list.set_move(RefPtr::from_addrefed(Gecko_NewNoneTransform()));
}
}
} else {
panic!("The AnimationValue should be transform");
}