Skip to content

Commit

Permalink
Remove impl_animatable_for_option_tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Aug 12, 2017
1 parent 4ddf6db commit b14e68f
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions components/style/properties/helpers.mako.rs
Expand Up @@ -956,63 +956,6 @@
%>
</%def>

/// Macro for defining Animatable trait for tuple struct which has Option<T>,
/// e.g. struct T(pub Option<Au>).
<%def name="impl_animatable_for_option_tuple(value_for_none)">
impl Animatable for T {
#[inline]
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64)
-> Result<Self, ()> {
match (self, other) {
(&T(Some(ref this)), &T(Some(ref other))) => {
Ok(T(this.add_weighted(other, self_portion, other_portion).ok()))
},
(&T(Some(ref this)), &T(None)) => {
Ok(T(this.add_weighted(&${value_for_none}, self_portion, other_portion).ok()))
},
(&T(None), &T(Some(ref other))) => {
Ok(T(${value_for_none}.add_weighted(other, self_portion, other_portion).ok()))
},
(&T(None), &T(None)) => {
Ok(T(None))
},
}
}

#[inline]
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
match (self, other) {
(&T(Some(ref this)), &T(Some(ref other))) => {
this.compute_distance(other)
},
(&T(Some(ref value)), &T(None)) |
(&T(None), &T(Some(ref value)))=> {
value.compute_distance(&${value_for_none})
},
(&T(None), &T(None)) => {
Ok(0.0)
},
}
}

#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
match (self, other) {
(&T(Some(ref this)), &T(Some(ref other))) => {
this.compute_squared_distance(other)
},
(&T(Some(ref value)), &T(None)) |
(&T(None), &T(Some(ref value))) => {
value.compute_squared_distance(&${value_for_none})
},
(&T(None), &T(None)) => {
Ok(0.0)
},
}
}
}
</%def>

// Define property that supports prefixed intrinsic size keyword values for gecko.
// E.g. -moz-max-content, -moz-min-content, etc.
<%def name="gecko_size_type(name, length_type, initial_value, logical, **kwargs)">
Expand Down

0 comments on commit b14e68f

Please sign in to comment.