style: Move the animation code of transform into a different file.

Basically, most of the animation code of transform don't need mako, so
we could move them into values/animated/transform.rs.

However, we still use mako to generate some code to make the methods of
Matrix3D simpler, so I still leave them in animated_properties.mako.rs.

Differential Revision: https://phabricator.services.mozilla.com/D11934
This commit is contained in:
Boris Chiou 2018-11-16 18:58:39 +00:00 committed by Emilio Cobos Álvarez
parent 8e47e7f134
commit e83f5629ff
4 changed files with 1619 additions and 1583 deletions

View file

@ -14,12 +14,14 @@ use crate::values::computed::length::CalcLengthOrPercentage;
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::Angle as ComputedAngle;
use crate::values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
use crate::values::CSSFloat;
use euclid::{Point2D, Size2D};
use smallvec::SmallVec;
use std::cmp;
pub mod color;
pub mod effects;
pub mod transform;
mod font;
mod length;
mod svg;
@ -86,6 +88,15 @@ pub fn compare_property_priority(a: &PropertyId, b: &PropertyId) -> cmp::Orderin
.then_with(|| a.idl_name_sort_order().cmp(&b.idl_name_sort_order()))
}
/// A helper function to animate two multiplicative factor.
pub fn animate_multiplicative_factor(
this: CSSFloat,
other: CSSFloat,
procedure: Procedure,
) -> Result<CSSFloat, ()> {
Ok((this - 1.).animate(&(other - 1.), procedure)? + 1.)
}
/// Animate from one value to another.
///
/// This trait is derivable with `#[derive(Animate)]`. The derived