mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Derive Animate for ShapeRadius<L>
This commit is contained in:
parent
af560a8fab
commit
e49dbc4dfa
1 changed files with 4 additions and 15 deletions
|
@ -94,10 +94,13 @@ pub struct Ellipse<H, V, LengthOrPercentage> {
|
||||||
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
/// https://drafts.csswg.org/css-shapes/#typedef-shape-radius
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
|
||||||
|
#[derive(ToComputedValue, ToCss)]
|
||||||
pub enum ShapeRadius<LengthOrPercentage> {
|
pub enum ShapeRadius<LengthOrPercentage> {
|
||||||
Length(LengthOrPercentage),
|
Length(LengthOrPercentage),
|
||||||
|
#[animation(error)]
|
||||||
ClosestSide,
|
ClosestSide,
|
||||||
|
#[animation(error)]
|
||||||
FarthestSide,
|
FarthestSide,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,20 +194,6 @@ impl<L> ToCss for InsetRect<L>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<L> Animate for ShapeRadius<L>
|
|
||||||
where
|
|
||||||
L: Animate,
|
|
||||||
{
|
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
|
||||||
match (self, other) {
|
|
||||||
(&ShapeRadius::Length(ref this), &ShapeRadius::Length(ref other)) => {
|
|
||||||
Ok(ShapeRadius::Length(this.animate(other, procedure)?))
|
|
||||||
},
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<L> Default for ShapeRadius<L> {
|
impl<L> Default for ShapeRadius<L> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn default() -> Self { ShapeRadius::ClosestSide }
|
fn default() -> Self { ShapeRadius::ClosestSide }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue