mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Make use of Either<A, B> for LengthOrNone
This commit is contained in:
parent
5df250bc05
commit
c4fc49c559
10 changed files with 21 additions and 116 deletions
|
@ -22,6 +22,7 @@ use std::cmp;
|
|||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use super::ComputedValues;
|
||||
use values::Either;
|
||||
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use values::computed::{BorderRadiusSize, LengthOrNone};
|
||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage};
|
||||
|
@ -682,8 +683,8 @@ impl Interpolate for BoxShadow {
|
|||
impl Interpolate for LengthOrNone {
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
match (*self, *other) {
|
||||
(LengthOrNone::Length(ref len), LengthOrNone::Length(ref other)) =>
|
||||
len.interpolate(&other, progress).map(LengthOrNone::Length),
|
||||
(Either::First(ref length), Either::First(ref other)) =>
|
||||
length.interpolate(&other, progress).map(Either::First),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue