mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Avoid some unnecessary intermediate utf8 strings in glue.rs.
MozReview-Commit-ID: 79qv87uPzjR
This commit is contained in:
parent
65f549094f
commit
f5dd50dcfd
1 changed files with 4 additions and 12 deletions
|
@ -705,14 +705,11 @@ pub extern "C" fn Servo_AnimationValue_Serialize(value: RawServoAnimationValueBo
|
||||||
buffer: *mut nsAString)
|
buffer: *mut nsAString)
|
||||||
{
|
{
|
||||||
let uncomputed_value = AnimationValue::as_arc(&value).uncompute();
|
let uncomputed_value = AnimationValue::as_arc(&value).uncompute();
|
||||||
let mut string = String::new();
|
let buffer = unsafe { buffer.as_mut().unwrap() };
|
||||||
let rv = PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal)
|
let rv = PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal)
|
||||||
.single_value_to_css(&get_property_id_from_nscsspropertyid!(property, ()), &mut string,
|
.single_value_to_css(&get_property_id_from_nscsspropertyid!(property, ()), buffer,
|
||||||
None, None /* No extra custom properties */);
|
None, None /* No extra custom properties */);
|
||||||
debug_assert!(rv.is_ok());
|
debug_assert!(rv.is_ok());
|
||||||
|
|
||||||
let buffer = unsafe { buffer.as_mut().unwrap() };
|
|
||||||
buffer.assign_utf8(&string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -2677,16 +2674,11 @@ pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
|
||||||
let guard = global_style_data.shared_lock.read();
|
let guard = global_style_data.shared_lock.read();
|
||||||
let decls = Locked::<PropertyDeclarationBlock>::as_arc(&declarations).read_with(&guard);
|
let decls = Locked::<PropertyDeclarationBlock>::as_arc(&declarations).read_with(&guard);
|
||||||
|
|
||||||
let mut string = String::new();
|
|
||||||
|
|
||||||
let custom_properties = Locked::<PropertyDeclarationBlock>::arc_from_borrowed(&custom_properties);
|
let custom_properties = Locked::<PropertyDeclarationBlock>::arc_from_borrowed(&custom_properties);
|
||||||
let custom_properties = custom_properties.map(|block| block.read_with(&guard));
|
let custom_properties = custom_properties.map(|block| block.read_with(&guard));
|
||||||
let rv = decls.single_value_to_css(
|
|
||||||
&property_id, &mut string, computed_values, custom_properties);
|
|
||||||
debug_assert!(rv.is_ok());
|
|
||||||
|
|
||||||
let buffer = unsafe { buffer.as_mut().unwrap() };
|
let buffer = unsafe { buffer.as_mut().unwrap() };
|
||||||
buffer.assign_utf8(&string);
|
let rv = decls.single_value_to_css(&property_id, buffer, computed_values, custom_properties);
|
||||||
|
debug_assert!(rv.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue