Skip to content

Commit

Permalink
Handle None transform properly.
Browse files Browse the repository at this point in the history
If the transform is None, we should return a valid None transform.
  • Loading branch information
BorisChiou committed May 20, 2017
1 parent 63dc436 commit 013b4a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions components/style/gecko/generated/bindings.rs
Expand Up @@ -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;
Expand Down
11 changes: 10 additions & 1 deletion ports/geckolib/glue.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 013b4a7

Please sign in to comment.