Replace LengthOrNone by a specific type for the perspective property

This was its only use, and it was bugged: AFAIK this didn't properly
clamp animated values below 0.
This commit is contained in:
Anthony Ramine 2018-02-26 15:46:41 +01:00
parent 4a98fa70bf
commit 260e05320c
11 changed files with 88 additions and 32 deletions

View file

@ -55,3 +55,21 @@ pub enum AnimationIterationCount<Number> {
/// The `infinite` keyword.
Infinite,
}
/// A generic value for the `perspective` property.
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
pub enum Perspective<NonNegativeLength> {
/// A non-negative length.
Length(NonNegativeLength),
/// The keyword `none`.
None,
}
impl<L> Perspective<L> {
/// Returns `none`.
#[inline]
pub fn none() -> Self {
Perspective::None
}
}