Bug 1335942 - Part 2: Support GetOpacity FFI. r=manishearth

This commit is contained in:
Boris Chiou 2017-02-08 11:31:58 +08:00
parent c7dc3e4008
commit 22d04e1a16
2 changed files with 17 additions and 0 deletions

View file

@ -1301,6 +1301,11 @@ extern "C" {
RawServoAnimationValueBorrowedListBorrowed)
-> RawServoDeclarationBlockStrong;
}
extern "C" {
pub fn Servo_AnimationValues_GetOpacity(value:
RawServoAnimationValueBorrowed)
-> f32;
}
extern "C" {
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal)
-> RawServoDeclarationBlockStrong;

View file

@ -205,6 +205,18 @@ pub extern "C" fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueB
})).into_strong()
}
#[no_mangle]
pub extern "C" fn Servo_AnimationValues_GetOpacity(value: RawServoAnimationValueBorrowed)
-> f32
{
let value = AnimationValue::as_arc(&value);
if let AnimationValue::Opacity(opacity) = **value {
opacity
} else {
panic!("The AnimationValue should be Opacity");
}
}
/// Takes a ServoAnimationValues and populates it with the animation values corresponding
/// to a given property declaration block
#[no_mangle]