mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Derive Animate for BackgroundSize<L>
This commit is contained in:
parent
318d8696e5
commit
b543b17cf0
2 changed files with 5 additions and 19 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
use properties::animated_properties::RepeatableListAnimatable;
|
||||
use properties::longhands::background_size::computed_value::T as BackgroundSizeList;
|
||||
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||
use values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||
use values::computed::length::LengthOrPercentageOrAuto;
|
||||
use values::generics::background::BackgroundSize as GenericBackgroundSize;
|
||||
|
||||
|
@ -15,23 +15,6 @@ pub type BackgroundSize = GenericBackgroundSize<LengthOrPercentageOrAuto>;
|
|||
|
||||
impl RepeatableListAnimatable for BackgroundSize {}
|
||||
|
||||
impl Animate for BackgroundSize {
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
match (self, other) {
|
||||
(
|
||||
&GenericBackgroundSize::Explicit { width: self_width, height: self_height },
|
||||
&GenericBackgroundSize::Explicit { width: other_width, height: other_height },
|
||||
) => {
|
||||
Ok(GenericBackgroundSize::Explicit {
|
||||
width: self_width.animate(&other_width, procedure)?,
|
||||
height: self_height.animate(&other_height, procedure)?,
|
||||
})
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedZero for BackgroundSize {
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue