Bug 1354947 - Split off add_computed_property_value(). r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 02 May 2017 18:52:37 +0900
changeset 571303 452373d8a8a861a9aa94a7ff4a70df00852163dd
parent 571302 3524dc01871d6ba73a0a0912159cd2e4799f78b6
child 571304 3d353e54e00c12dbbea789206a7b233be5cfc1cc
push id56743
push userhikezoe@mozilla.com
push dateTue, 02 May 2017 10:26:16 +0000
reviewersbirtles
bugs1354947
milestone55.0a1
Bug 1354947 - Split off add_computed_property_value(). r?birtles This function will be used outside of keyframes iteration. MozReview-Commit-ID: EkoOV8Vg5uX
servo/ports/geckolib/glue.rs
--- 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 } => {