From 974458cafc3a17b08e992c71a1f8189b2ed434de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 21 Dec 2017 05:31:26 +0100 Subject: [PATCH] style: Fix inheritance of animation and transition properties of mismatched length. At least when the animation-name length is bigger than the animation properties, we mess up inheritance and only set properly the specified counts, then don't cycle it. The nicer fix for this is making these vectors properly, and move the cycling logic at used-value time (bug 1420928). Same for transitions. Bug: 1426246 Reviewed-by: hiro MozReview-Commit-ID: 3cguzIvfMFU --- components/style/properties/gecko.mako.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 45fe22f3b6c..06f315ff0f5 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2951,10 +2951,12 @@ fn static_assert() { let count = other.gecko.m${type.capitalize()}${gecko_ffi_name}Count; self.gecko.m${type.capitalize()}${gecko_ffi_name}Count = count; - // The length of mTransitions or mAnimations is often greater than m{Transition|Animation}XXCount, - // don't copy values over the count. - for (index, gecko) in self.gecko.m${type.capitalize()}s.iter_mut().enumerate().take(count as usize) { - gecko.m${gecko_ffi_name} = other.gecko.m${type.capitalize()}s[index].m${gecko_ffi_name}; + let iter = self.gecko.m${type.capitalize()}s.iter_mut().zip( + other.gecko.m${type.capitalize()}s.iter().take(count as usize).cycle() + ); + + for (ours, others) in iter { + ours.m${gecko_ffi_name} = others.m${gecko_ffi_name}; } } @@ -3734,6 +3736,7 @@ fn static_assert() { count as usize, LayerType::${shorthand.title()}); } + // FIXME(emilio): This may be bogus in the same way as bug 1426246. for (layer, other) in self.gecko.${layers_field_name}.mLayers.iter_mut() .zip(other.gecko.${layers_field_name}.mLayers.iter()) .take(count as usize) {