Skip to content

Commit

Permalink
Change LengthOrPercentageOrAutoOrContent to use NoCalcLength
Browse files Browse the repository at this point in the history
  • Loading branch information
wafflespeanut committed Jan 28, 2017
1 parent 39ae0bb commit 8d09d64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/style/properties/shorthand/position.mako.rs
Expand Up @@ -57,7 +57,7 @@
<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis" extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-flexbox/#flex-property">
use parser::Parse;
use values::specified::{Number, Length, LengthOrPercentageOrAutoOrContent};
use values::specified::{Number, NoCalcLength, LengthOrPercentageOrAutoOrContent};

pub fn parse_flexibility(input: &mut Parser)
-> Result<(Number, Option<Number>),()> {
Expand Down Expand Up @@ -101,7 +101,7 @@
Ok(Longhands {
flex_grow: grow.or(Some(Number(1.0))),
flex_shrink: shrink.or(Some(Number(1.0))),
flex_basis: basis.or(Some(LengthOrPercentageOrAutoOrContent::Length(Length::zero())))
flex_basis: basis.or(Some(LengthOrPercentageOrAutoOrContent::Length(NoCalcLength::zero())))
})
}

Expand Down
6 changes: 3 additions & 3 deletions components/style/values/specified/length.rs
Expand Up @@ -1134,7 +1134,7 @@ pub type LengthOrAuto = Either<Length, Auto>;
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrAutoOrContent {
/// A `<length>`.
Length(Length),
Length(NoCalcLength),
/// A percentage.
Percentage(Percentage),
/// A `calc` node.
Expand Down Expand Up @@ -1172,11 +1172,11 @@ impl Parse for LengthOrPercentageOrAutoOrContent {
let context = AllowedNumericType::NonNegative;
match try!(input.next()) {
Token::Dimension(ref value, ref unit) if context.is_ok(value.value) =>
Length::parse_dimension(value.value, unit).map(LengthOrPercentageOrAutoOrContent::Length),
NoCalcLength::parse_dimension(value.value, unit).map(LengthOrPercentageOrAutoOrContent::Length),
Token::Percentage(ref value) if context.is_ok(value.unit_value) =>
Ok(LengthOrPercentageOrAutoOrContent::Percentage(Percentage(value.unit_value))),
Token::Number(ref value) if value.value == 0. =>
Ok(LengthOrPercentageOrAutoOrContent::Length(Length::zero())),
Ok(LengthOrPercentageOrAutoOrContent::Length(NoCalcLength::zero())),
Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") =>
Ok(LengthOrPercentageOrAutoOrContent::Auto),
Token::Ident(ref value) if value.eq_ignore_ascii_case("content") =>
Expand Down

0 comments on commit 8d09d64

Please sign in to comment.