Bug 1468269: Derive Animate for ComplexColorRatios. r?kamidphish
It'd generate the same implementation.
MozReview-Commit-ID: Afpv0sjeWdj
--- 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 {