mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Derive Animate and ComputeSquaredDistance for computed font-size-adjust
This commit is contained in:
parent
4a4bf89575
commit
318d8696e5
1 changed files with 3 additions and 24 deletions
|
@ -1116,12 +1116,12 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
|
||||
pub mod computed_value {
|
||||
use values::CSSFloat;
|
||||
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToCss)]
|
||||
pub enum T {
|
||||
#[animation(error)]
|
||||
None,
|
||||
Number(CSSFloat),
|
||||
}
|
||||
|
@ -1136,27 +1136,6 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
}
|
||||
}
|
||||
|
||||
impl Animate for T {
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
match (self, other) {
|
||||
(&T::Number(ref number), &T::Number(ref other)) => {
|
||||
Ok(T::Number(number.animate(other, procedure)?))
|
||||
},
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputeSquaredDistance for T {
|
||||
#[inline]
|
||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
match (self, other) {
|
||||
(&T::Number(ref this), &T::Number(ref other)) => this.compute_squared_distance(other),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedZero for T {
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue