mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +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
|
@ -178,7 +178,7 @@
|
|||
use parser::{ParserContext, ParserContextExtraData};
|
||||
use properties::{CSSWideKeyword, DeclaredValue, Shorthand};
|
||||
% endif
|
||||
#[allow(unused_imports)]
|
||||
use values::{Auto, Either, None_, Normal};
|
||||
use cascade_info::CascadeInfo;
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use parser::Parse;
|
||||
|
|
|
@ -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(()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1395,7 +1395,7 @@ ${helpers.single_keyword("transform-style",
|
|||
|
||||
${helpers.predefined_type("perspective",
|
||||
"LengthOrNone",
|
||||
"computed::LengthOrNone::None",
|
||||
"Either::Second(None_)",
|
||||
products="servo",
|
||||
animatable=True)}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use logical_geometry::WritingMode;
|
|||
use parser::{ParserContext, ParserContextExtraData};
|
||||
use style_traits::ToCss;
|
||||
use stylesheets::Origin;
|
||||
#[cfg(feature = "servo")] use values::Either;
|
||||
use values::{HasViewportPercentage, computed};
|
||||
use cascade_info::CascadeInfo;
|
||||
use rule_tree::StrongRuleNode;
|
||||
|
@ -1249,7 +1250,7 @@ impl ComputedValues {
|
|||
if effects.transform.0.is_some() {
|
||||
return transform_style::T::flat;
|
||||
}
|
||||
if effects.perspective != computed::LengthOrNone::None {
|
||||
if let Either::First(ref _length) = effects.perspective {
|
||||
return transform_style::T::flat;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue