Bug 1354947 - Split off add_computed_property_value(). r?birtles
This function will be used outside of keyframes iteration.
MozReview-Commit-ID: EkoOV8Vg5uX
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -2078,23 +2078,38 @@ pub extern "C" fn Servo_AssertTreeIsClea
assert_subtree_is_clean(child);
}
}
}
assert_subtree_is_clean(root);
}
+fn add_computed_property_value(keyframe: *mut structs::Keyframe,
+ index: usize,
+ style: &ComputedValues,
+ property: &TransitionProperty,
+ shared_lock: &SharedRwLock) {
+ let block = style.to_declaration_block(property.clone().into());
+ unsafe {
+ (*keyframe).mPropertyValues.set_len((index + 1) as u32);
+ (*keyframe).mPropertyValues[index].mProperty = property.into();
+ // FIXME. Bug 1360398: Do not set computed values once we handles
+ // missing keyframes with additive composition.
+ (*keyframe).mPropertyValues[index].mServoDeclarationBlock.set_arc_leaky(
+ Arc::new(shared_lock.wrap(block)));
+ }
+}
+
#[no_mangle]
pub extern "C" fn Servo_StyleSet_FillKeyframesForName(raw_data: RawServoStyleSetBorrowed,
name: *const nsACString,
timing_function: nsTimingFunctionBorrowed,
style: ServoComputedValuesBorrowed,
keyframes: RawGeckoKeyframeListBorrowedMut) -> bool {
- use style::gecko_bindings::structs::Keyframe;
use style::properties::LonghandIdSet;
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
let name = unsafe { Atom::from(name.as_ref().unwrap().as_str_unchecked()) };
let animation = match data.stylist.animations().get(&name) {
Some(animation) => animation,
None => return false,
@@ -2124,32 +2139,16 @@ pub extern "C" fn Servo_StyleSet_FillKey
// function or else add a new keyframe at the beginning of the keyframe
// array.
let keyframe = unsafe {
Gecko_GetOrCreateKeyframeAtStart(keyframes,
step.start_percentage.0 as f32,
&timing_function)
};
- fn add_computed_property_value(keyframe: *mut Keyframe,
- index: usize,
- style: &ComputedValues,
- property: &TransitionProperty,
- shared_lock: &SharedRwLock) {
- let block = style.to_declaration_block(property.clone().into());
- unsafe {
- (*keyframe).mPropertyValues.set_len((index + 1) as u32);
- (*keyframe).mPropertyValues[index].mProperty = property.into();
- // FIXME. Do not set computed values once we handles missing keyframes
- // with additive composition.
- (*keyframe).mPropertyValues[index].mServoDeclarationBlock.set_arc_leaky(
- Arc::new(shared_lock.wrap(block)));
- }
- }
-
match step.value {
KeyframesStepValue::ComputedValues => {
for (index, property) in animation.properties_changed.iter().enumerate() {
add_computed_property_value(
keyframe, index, style, property, &global_style_data.shared_lock);
}
},
KeyframesStepValue::Declarations { ref block } => {