Skip to content

Commit

Permalink
Move Animatable::get_zero_value to ToAnimatedZero::to_animated_zero
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jul 19, 2017
1 parent 99592cc commit 98bf832
Show file tree
Hide file tree
Showing 13 changed files with 293 additions and 127 deletions.
5 changes: 5 additions & 0 deletions components/style/macros.rs
Expand Up @@ -112,5 +112,10 @@ macro_rules! define_keyword_type {
impl $crate::values::computed::ComputedValueAsSpecified for $name {}
impl $crate::values::animated::AnimatedValueAsComputed for $name {}
no_viewport_percentage!($name);

impl $crate::values::animated::ToAnimatedZero for $name {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> { Ok($name) }
}
};
}
7 changes: 7 additions & 0 deletions components/style/properties/helpers.mako.rs
Expand Up @@ -129,6 +129,8 @@

% if animation_value_type == "ComputedValue":
use properties::animated_properties::Animatable;
use values::animated::ToAnimatedZero;

impl Animatable for T {
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64)
-> Result<Self, ()> {
Expand All @@ -149,6 +151,11 @@
self.0.compute_squared_distance(&other.0)
}
}

impl ToAnimatedZero for T {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
}
% endif

pub type Iter<'a, 'cx, 'cx_a> = ComputedVecIter<'a, 'cx, 'cx_a, super::single_value::SpecifiedValue>;
Expand Down

0 comments on commit 98bf832

Please sign in to comment.