From f960b4c444eed62d2a579d31464906e7fdf529eb Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Sat, 14 Jan 2017 11:43:31 +0900 Subject: [PATCH] Bug 1330824 - Do not copy animation property over mAnimationXXCount. r=heycam MozReview-Commit-ID: GeSWnPQltHf --- components/style/properties/gecko.mako.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index fd4059ec983..6d5885473c4 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1021,8 +1021,13 @@ fn static_assert() { #[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}; } } @@ -1388,8 +1393,13 @@ fn static_assert() { } 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); } }