mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Derive ComputeSquaredDistance
This commit is contained in:
parent
51b740033b
commit
277351da35
22 changed files with 162 additions and 391 deletions
|
@ -119,8 +119,11 @@
|
|||
use values::computed::ComputedVecIter;
|
||||
|
||||
/// The computed value, effectively a list of single values.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
% if need_animatable or animation_value_type == "ComputedValue":
|
||||
#[derive(ComputeSquaredDistance)]
|
||||
% endif
|
||||
pub struct T(
|
||||
% if allow_empty and allow_empty != "NotInitial":
|
||||
pub Vec<single_value::T>,
|
||||
|
@ -132,7 +135,6 @@
|
|||
% if need_animatable or animation_value_type == "ComputedValue":
|
||||
use properties::animated_properties::Animatable;
|
||||
use values::animated::ToAnimatedZero;
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
|
||||
impl Animatable for T {
|
||||
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64)
|
||||
|
@ -145,13 +147,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
impl ComputeSquaredDistance for T {
|
||||
#[inline]
|
||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
self.0.compute_squared_distance(&other.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedZero for T {
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue