Move specified and computed angles to submodules

This commit is contained in:
Anthony Ramine 2017-08-16 11:15:23 +02:00
parent 4d10d39e8f
commit 1bd12bf91a
5 changed files with 279 additions and 238 deletions

View file

@ -867,27 +867,6 @@ impl Animatable for i32 {
}
}
/// https://drafts.csswg.org/css-transitions/#animtype-number
impl Animatable for Angle {
#[inline]
fn add_weighted(&self, other: &Angle, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
match (*self, *other) {
% for angle_type in [ 'Degree', 'Gradian', 'Turn' ]:
(Angle::${angle_type}(val1), Angle::${angle_type}(val2)) => {
Ok(Angle::${angle_type}(
try!(val1.add_weighted(&val2, self_portion, other_portion))
))
}
% endfor
_ => {
self.radians()
.add_weighted(&other.radians(), self_portion, other_portion)
.map(Angle::from_radians)
}
}
}
}
/// https://drafts.csswg.org/css-transitions/#animtype-visibility
impl Animatable for Visibility {
#[inline]