mirror of
https://github.com/servo/servo.git
synced 2025-07-09 00:13:41 +01:00
Bug 1337313 - Add Servo_AnimationValue_Serialize. r=manishearth
This commit is contained in:
parent
e985ad5422
commit
fe1c2af406
2 changed files with 37 additions and 16 deletions
|
@ -1303,13 +1303,18 @@ extern "C" {
|
||||||
-> RawServoDeclarationBlockStrong;
|
-> RawServoDeclarationBlockStrong;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_AnimationValues_GetOpacity(value:
|
pub fn Servo_AnimationValue_Serialize(value:
|
||||||
RawServoAnimationValueBorrowed)
|
RawServoAnimationValueBorrowed,
|
||||||
|
property: nsCSSPropertyID,
|
||||||
|
buffer: *mut nsAString_internal);
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueBorrowed)
|
||||||
-> f32;
|
-> f32;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_AnimationValues_GetTransform(value: RawServoAnimationValueBorrowed,
|
pub fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValueBorrowed,
|
||||||
list: &mut RefPtr<nsCSSValueSharedList>);
|
list: &mut RefPtr<nsCSSValueSharedList>);
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal)
|
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal)
|
||||||
|
|
|
@ -207,8 +207,33 @@ pub extern "C" fn Servo_AnimationValues_Uncompute(value: RawServoAnimationValueB
|
||||||
})).into_strong()
|
})).into_strong()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! get_property_id_from_nscsspropertyid {
|
||||||
|
($property_id: ident, $ret: expr) => {{
|
||||||
|
match PropertyId::from_nscsspropertyid($property_id) {
|
||||||
|
Ok(property_id) => property_id,
|
||||||
|
Err(()) => { return $ret; }
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_AnimationValues_GetOpacity(value: RawServoAnimationValueBorrowed)
|
pub extern "C" fn Servo_AnimationValue_Serialize(value: RawServoAnimationValueBorrowed,
|
||||||
|
property: nsCSSPropertyID,
|
||||||
|
buffer: *mut nsAString)
|
||||||
|
{
|
||||||
|
let uncomputed_value = AnimationValue::as_arc(&value).uncompute();
|
||||||
|
let mut string = String::new();
|
||||||
|
let rv = PropertyDeclarationBlock {
|
||||||
|
declarations: vec![(uncomputed_value, Importance::Normal)],
|
||||||
|
important_count: 0
|
||||||
|
}.single_value_to_css(&get_property_id_from_nscsspropertyid!(property, ()), &mut string);
|
||||||
|
debug_assert!(rv.is_ok());
|
||||||
|
|
||||||
|
write!(unsafe { &mut *buffer }, "{}", string).expect("Failed to copy string");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueBorrowed)
|
||||||
-> f32
|
-> f32
|
||||||
{
|
{
|
||||||
let value = AnimationValue::as_arc(&value);
|
let value = AnimationValue::as_arc(&value);
|
||||||
|
@ -220,8 +245,8 @@ pub extern "C" fn Servo_AnimationValues_GetOpacity(value: RawServoAnimationValue
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_AnimationValues_GetTransform(value: RawServoAnimationValueBorrowed,
|
pub extern "C" fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValueBorrowed,
|
||||||
list: &mut structs::RefPtr<nsCSSValueSharedList>)
|
list: &mut structs::RefPtr<nsCSSValueSharedList>)
|
||||||
{
|
{
|
||||||
let value = AnimationValue::as_arc(&value);
|
let value = AnimationValue::as_arc(&value);
|
||||||
if let AnimationValue::Transform(ref servo_list) = **value {
|
if let AnimationValue::Transform(ref servo_list) = **value {
|
||||||
|
@ -844,15 +869,6 @@ pub extern "C" fn Servo_DeclarationBlock_GetCssText(declarations: RawServoDeclar
|
||||||
declarations.read().to_css(unsafe { result.as_mut().unwrap() }).unwrap();
|
declarations.read().to_css(unsafe { result.as_mut().unwrap() }).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! get_property_id_from_nscsspropertyid {
|
|
||||||
($property_id: ident, $ret: expr) => {{
|
|
||||||
match PropertyId::from_nscsspropertyid($property_id) {
|
|
||||||
Ok(property_id) => property_id,
|
|
||||||
Err(()) => { return $ret; }
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
|
pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
|
||||||
declarations: RawServoDeclarationBlockBorrowed,
|
declarations: RawServoDeclarationBlockBorrowed,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue