mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
parent
4a98fa70bf
commit
260e05320c
11 changed files with 88 additions and 32 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue