mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Remove impl_animatable_for_option_tuple
This commit is contained in:
parent
4ddf6dbd15
commit
b14e68f915
1 changed files with 0 additions and 57 deletions
|
@ -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)">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue