Bug 1354947 - Rename add_computed_property_value to append_computed_property_value. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 02 May 2017 19:22:10 +0900
changeset 571308 55f8e11bf28e9037e7d06d4014d599b7c55641f2
parent 571307 4a7dc4da41422ef5de3e60a4503d6d4419004994
child 626722 30280645a5e309e04bb05493457554dedcbac681
push id56743
push userhikezoe@mozilla.com
push dateTue, 02 May 2017 10:26:16 +0000
reviewersbirtles
bugs1354947
milestone55.0a1
Bug 1354947 - Rename add_computed_property_value to append_computed_property_value. r?birtles We don't need to pass index to the function any more. MozReview-Commit-ID: GQ6hFH68N35
servo/ports/geckolib/glue.rs
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -2080,23 +2080,23 @@ 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) {
+fn append_computed_property_value(keyframe: *mut structs::Keyframe,
+                                  style: &ComputedValues,
+                                  property: &TransitionProperty,
+                                  shared_lock: &SharedRwLock) {
     let block = style.to_declaration_block(property.clone().into());
     unsafe {
+        let index = (*keyframe).mPropertyValues.len();
         (*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)));
     }
 }
@@ -2126,25 +2126,22 @@ fn fill_in_missing_keyframe_values(all_p
         },
         1. => unsafe {
             Gecko_GetOrCreateFinalKeyframe(keyframes, timing_function)
         },
         _ => unreachable!("offset should be 0. or 1."),
     };
 
     // Append properties that have not been set at this offset.
-    let mut index = unsafe { (*keyframe).mPropertyValues.len() };
     for ref property in all_properties.iter() {
         if !properties_set_at_offset.has_transition_property_bit(property) {
-            add_computed_property_value(keyframe,
-                                        index,
-                                        style,
-                                        property,
-                                        shared_lock);
-            index += 1;
+            append_computed_property_value(keyframe,
+                                           style,
+                                           property,
+                                           shared_lock);
         }
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetBorrowed,
                                                      name: *const nsACString,
                                                      inherited_timing_function: nsTimingFunctionBorrowed,
@@ -2197,19 +2194,21 @@ pub extern "C" fn Servo_StyleSet_GetKeyf
 
         match step.value {
             KeyframesStepValue::ComputedValues => {
                 // In KeyframesAnimation::from_keyframes if there is no 0% or
                 // 100% keyframe at all, we will create a 'ComputedValues' step
                 // to represent that all properties animated by the keyframes
                 // animation should be set to the underlying computed value for
                 // that keyframe.
-                for (index, property) in animation.properties_changed.iter().enumerate() {
-                    add_computed_property_value(
-                        keyframe, index, style, property, &global_style_data.shared_lock);
+                for property in animation.properties_changed.iter() {
+                    append_computed_property_value(keyframe,
+                                                   style,
+                                                   property,
+                                                   &global_style_data.shared_lock);
                 }
                 if current_offset == 0.0 {
                     has_complete_initial_keyframe = true;
                 } else if current_offset == 1.0 {
                     has_complete_final_keyframe = true;
                 }
             },
             KeyframesStepValue::Declarations { ref block } => {