mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Move MozLength and MaxLength into generics.
Move MozLength and MaxLength into generics, and drop the manual implementation of ToComputedValue. Differential Revision: https://phabricator.services.mozilla.com/D8291
This commit is contained in:
parent
53eb6cd667
commit
c9d39b2b19
7 changed files with 89 additions and 118 deletions
|
@ -292,8 +292,9 @@ impl ToAnimatedValue for ComputedMaxLength {
|
|||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
use values::computed::{Length, LengthOrPercentageOrNone, Percentage};
|
||||
use values::generics::length::MaxLength as GenericMaxLength;
|
||||
match animated {
|
||||
ComputedMaxLength::LengthOrPercentageOrNone(lopn) => {
|
||||
GenericMaxLength::LengthOrPercentageOrNone(lopn) => {
|
||||
let result = match lopn {
|
||||
LengthOrPercentageOrNone::Length(px) => {
|
||||
LengthOrPercentageOrNone::Length(Length::new(px.px().max(0.)))
|
||||
|
@ -303,7 +304,7 @@ impl ToAnimatedValue for ComputedMaxLength {
|
|||
},
|
||||
_ => lopn,
|
||||
};
|
||||
ComputedMaxLength::LengthOrPercentageOrNone(result)
|
||||
GenericMaxLength::LengthOrPercentageOrNone(result)
|
||||
},
|
||||
_ => animated,
|
||||
}
|
||||
|
@ -321,8 +322,9 @@ impl ToAnimatedValue for ComputedMozLength {
|
|||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
use values::computed::{Length, LengthOrPercentageOrAuto, Percentage};
|
||||
use values::generics::length::MozLength as GenericMozLength;
|
||||
match animated {
|
||||
ComputedMozLength::LengthOrPercentageOrAuto(lopa) => {
|
||||
GenericMozLength::LengthOrPercentageOrAuto(lopa) => {
|
||||
let result = match lopa {
|
||||
LengthOrPercentageOrAuto::Length(px) => {
|
||||
LengthOrPercentageOrAuto::Length(Length::new(px.px().max(0.)))
|
||||
|
@ -332,7 +334,7 @@ impl ToAnimatedValue for ComputedMozLength {
|
|||
},
|
||||
_ => lopa,
|
||||
};
|
||||
ComputedMozLength::LengthOrPercentageOrAuto(result)
|
||||
GenericMozLength::LengthOrPercentageOrAuto(result)
|
||||
},
|
||||
_ => animated,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue