Bug 1330824 - Do not copy animation property over mAnimationXXCount. r?heycam
MozReview-Commit-ID: GeSWnPQltHf
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -267,17 +267,16 @@ skip-if = toolkit == 'android' #bug 7752
[test_text_decoration_shorthands.html]
[test_transitions_and_reframes.html]
[test_transitions_and_restyles.html]
[test_transitions_and_zoom.html]
skip-if = stylo # timeout bug 1328499
[test_transitions_cancel_near_end.html]
skip-if = stylo # timeout bug 1328499
[test_transitions_computed_values.html]
-skip-if = stylo # bug 1330825
[test_transitions_computed_value_combinations.html]
[test_transitions_events.html]
skip-if = stylo # timeout bug 1328499
[test_transitions.html]
skip-if = (android_version == '18' && debug) # bug 1159532
[test_transitions_bug537151.html]
skip-if = stylo # timeout bug 1328499
[test_transitions_dynamic_changes.html]
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1016,18 +1016,23 @@ fn static_assert() {
}
</%self:impl_trait>
<%def name="impl_copy_animation_value(ident, gecko_ffi_name)">
#[allow(non_snake_case)]
pub fn copy_animation_${ident}_from(&mut self, other: &Self) {
unsafe { self.gecko.mAnimations.ensure_len(other.gecko.mAnimations.len()) };
- self.gecko.mAnimation${gecko_ffi_name}Count = other.gecko.mAnimation${gecko_ffi_name}Count;
- for (index, animation) in self.gecko.mAnimations.iter_mut().enumerate() {
+
+ let count = other.gecko.mAnimation${gecko_ffi_name}Count;
+ self.gecko.mAnimation${gecko_ffi_name}Count = count;
+
+ // The length of mAnimations is often greater than mAnimationXXCount,
+ // don't copy values over the count.
+ for (index, animation) in self.gecko.mAnimations.iter_mut().enumerate().take(count as usize) {
animation.m${gecko_ffi_name} = other.gecko.mAnimations[index].m${gecko_ffi_name};
}
}
</%def>
<%def name="impl_animation_count(ident, gecko_ffi_name)">
#[allow(non_snake_case)]
pub fn animation_${ident}_count(&self) -> usize {
@@ -1383,18 +1388,23 @@ fn static_assert() {
-> longhands::animation_name::computed_value::SingleComputedValue {
use Atom;
use properties::longhands::animation_name::single_value::SpecifiedValue as AnimationName;
// XXX: Is there any effective ways?
AnimationName(Atom::from(String::from_utf16_lossy(&self.gecko.mAnimations[index].mName[..])))
}
pub fn copy_animation_name_from(&mut self, other: &Self) {
unsafe { self.gecko.mAnimations.ensure_len(other.gecko.mAnimations.len()) };
- self.gecko.mAnimationNameCount = other.gecko.mAnimationNameCount;
- for (index, animation) in self.gecko.mAnimations.iter_mut().enumerate() {
+
+ let count = other.gecko.mAnimationNameCount;
+ self.gecko.mAnimationNameCount = count;
+
+ // The length of mAnimations is often greater than mAnimationXXCount,
+ // don't copy values over the count.
+ for (index, animation) in self.gecko.mAnimations.iter_mut().enumerate().take(count as usize) {
animation.mName.assign(&other.gecko.mAnimations[index].mName);
}
}
${impl_animation_count('name', 'Name')}
${impl_animation_time_value('delay', 'Delay')}
${impl_animation_time_value('duration', 'Duration')}