mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Support #[animation(constant)] when deriving ToAnimatedZero
This commit is contained in:
parent
405e34aa74
commit
8101887d31
4 changed files with 23 additions and 31 deletions
|
@ -152,17 +152,6 @@ impl ComputeSquaredDistance for BoxShadow {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedZero for BoxShadow {
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
Ok(BoxShadow {
|
||||
base: self.base.to_animated_zero()?,
|
||||
spread: self.spread.to_animated_zero()?,
|
||||
inset: self.inset,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedValue for ComputedFilterList {
|
||||
type AnimatedValue = FilterList;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use style_traits::ToCss;
|
|||
use style_traits::values::specified::AllowedLengthType;
|
||||
use super::{Number, ToComputedValue, Context, Percentage};
|
||||
use values::{Auto, CSSFloat, Either, ExtremumLength, None_, Normal, specified};
|
||||
use values::animated::ToAnimatedZero;
|
||||
use values::computed::{NonNegativeAu, NonNegativeNumber};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::NonNegative;
|
||||
|
@ -64,26 +63,16 @@ impl ToComputedValue for specified::Length {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedZero)]
|
||||
pub struct CalcLengthOrPercentage {
|
||||
#[animation(constant)]
|
||||
pub clamping_mode: AllowedLengthType,
|
||||
length: Au,
|
||||
pub percentage: Option<Percentage>,
|
||||
}
|
||||
|
||||
impl ToAnimatedZero for CalcLengthOrPercentage {
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
Ok(CalcLengthOrPercentage {
|
||||
clamping_mode: self.clamping_mode,
|
||||
length: self.length.to_animated_zero()?,
|
||||
percentage: self.percentage.to_animated_zero()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputeSquaredDistance for CalcLengthOrPercentage {
|
||||
#[inline]
|
||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
|
|
|
@ -11,7 +11,8 @@ use values::specified::url::SpecifiedUrl;
|
|||
|
||||
/// A generic value for a single `box-shadow`.
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Animate, Clone, Debug, HasViewportPercentage, PartialEq, ToAnimatedValue)]
|
||||
#[derive(Animate, Clone, Debug, HasViewportPercentage, PartialEq)]
|
||||
#[derive(ToAnimatedValue, ToAnimatedZero)]
|
||||
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
||||
/// The base shadow.
|
||||
pub base: SimpleShadow<Color, SizeLength, BlurShapeLength>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue