mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Kill AnimatedValueAsComputed
This commit is contained in:
parent
57daf06c71
commit
a90e660eac
2 changed files with 23 additions and 27 deletions
|
@ -68,8 +68,8 @@ macro_rules! try_match_ident_ignore_ascii_case {
|
||||||
macro_rules! define_keyword_type {
|
macro_rules! define_keyword_type {
|
||||||
($name: ident, $css: expr) => {
|
($name: ident, $css: expr) => {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf)]
|
||||||
#[derive(ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
|
||||||
pub struct $name;
|
pub struct $name;
|
||||||
|
|
||||||
impl fmt::Debug for $name {
|
impl fmt::Debug for $name {
|
||||||
|
@ -86,8 +86,6 @@ macro_rules! define_keyword_type {
|
||||||
input.expect_ident_matching($css).map(|_| $name).map_err(|e| e.into())
|
input.expect_ident_matching($css).map(|_| $name).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl $crate::values::animated::AnimatedValueAsComputed for $name {}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,6 @@ pub trait ToAnimatedValue {
|
||||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self;
|
fn from_animated_value(animated: Self::AnimatedValue) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marker trait for computed values with the same representation during animations.
|
|
||||||
pub trait AnimatedValueAsComputed {}
|
|
||||||
|
|
||||||
/// Returns a value similar to `self` that represents zero.
|
/// Returns a value similar to `self` that represents zero.
|
||||||
///
|
///
|
||||||
/// This trait is derivable with `#[derive(ToAnimatedValue)]`. If a field is
|
/// This trait is derivable with `#[derive(ToAnimatedValue)]`. If a field is
|
||||||
|
@ -243,31 +240,32 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnimatedValueAsComputed for Au {}
|
macro_rules! trivial_to_animated_value {
|
||||||
impl AnimatedValueAsComputed for ComputedAngle {}
|
($ty:ty) => {
|
||||||
impl AnimatedValueAsComputed for SpecifiedUrl {}
|
impl $crate::values::animated::ToAnimatedValue for $ty {
|
||||||
#[cfg(feature = "servo")]
|
type AnimatedValue = Self;
|
||||||
impl AnimatedValueAsComputed for ComputedUrl {}
|
|
||||||
impl AnimatedValueAsComputed for bool {}
|
|
||||||
impl AnimatedValueAsComputed for f32 {}
|
|
||||||
|
|
||||||
impl<T> ToAnimatedValue for T
|
#[inline]
|
||||||
where
|
fn to_animated_value(self) -> Self {
|
||||||
T: AnimatedValueAsComputed,
|
self
|
||||||
{
|
}
|
||||||
type AnimatedValue = Self;
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_animated_value(self) -> Self {
|
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||||
self
|
animated
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#[inline]
|
|
||||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
|
||||||
animated
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trivial_to_animated_value!(Au);
|
||||||
|
trivial_to_animated_value!(ComputedAngle);
|
||||||
|
trivial_to_animated_value!(SpecifiedUrl);
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
trivial_to_animated_value!(ComputedUrl);
|
||||||
|
trivial_to_animated_value!(bool);
|
||||||
|
trivial_to_animated_value!(f32);
|
||||||
|
|
||||||
impl ToAnimatedValue for ComputedNonNegativeNumber {
|
impl ToAnimatedValue for ComputedNonNegativeNumber {
|
||||||
type AnimatedValue = Self;
|
type AnimatedValue = Self;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue