Bug 1468269: Derive Animate for ComplexColorRatios. r=kamidphish
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 11 Jun 2018 16:54:27 -0700
changeset 479077 7b9b1d841e94b76777dae38be334a3a131792c38
parent 479076 4987f0a3414ad47d3dc172a22b279f81d38e55fc
child 479078 8998d3e2621d8a2aaee6a2cddda373e63d760755
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish
bugs1468269
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1468269: Derive Animate for ComplexColorRatios. r=kamidphish It'd generate the same implementation. MozReview-Commit-ID: Afpv0sjeWdj
servo/components/style/values/animated/color.rs
servo/components/style/values/generics/color.rs
--- a/servo/components/style/values/animated/color.rs
+++ b/servo/components/style/values/animated/color.rs
@@ -87,26 +87,16 @@ impl ComputeSquaredDistance for RGBA {
         start
             .iter()
             .zip(&end)
             .map(|(this, other)| this.compute_squared_distance(other))
             .sum()
     }
 }
 
-impl Animate for ComplexColorRatios {
-    #[inline]
-    fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
-        let bg = self.bg.animate(&other.bg, procedure)?;
-        let fg = self.fg.animate(&other.fg, procedure)?;
-
-        Ok(ComplexColorRatios { bg, fg })
-    }
-}
-
 /// An animated value for `<color>`.
 pub type Color = GenericColor<RGBA>;
 
 impl Color {
     fn effective_intermediate_rgba(&self) -> RGBA {
         match *self {
             GenericColor::Numeric(color) => color,
             GenericColor::Foreground => RGBA::transparent(),
--- a/servo/components/style/values/generics/color.rs
+++ b/servo/components/style/values/generics/color.rs
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Generic types for color properties.
 
 /// Ratios representing the contribution of color and currentcolor to
 /// the final color value.
-#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)]
+#[derive(Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)]
 pub struct ComplexColorRatios {
     /// Numeric color contribution.
     pub bg: f32,
     /// Foreground color, aka currentcolor, contribution.
     pub fg: f32,
 }
 
 impl ComplexColorRatios {