diff options
-rw-r--r-- | components/style/values/specified/length.rs | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 2b75773a6ad..42d4a9c1188 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -585,33 +585,29 @@ impl CalcLengthOrPercentage { products.push(try!(CalcLengthOrPercentage::parse_product(input, expected_unit))); loop { - let position = input.position(); - match input.next_including_whitespace() { - Ok(Token::WhiteSpace(_)) => { - match input.next() { - Ok(Token::Delim('+')) => { - products.push(try!(CalcLengthOrPercentage::parse_product(input, expected_unit))); - } - - Ok(Token::Delim('-')) => { - let mut right = try!(CalcLengthOrPercentage::parse_product(input, expected_unit)); - right.values.push(CalcValueNode::Number(-1.)); - products.push(right); + let position = input.position(); + match input.next_including_whitespace() { + Ok(Token::WhiteSpace(_)) => { + match input.next() { + Ok(Token::Delim('+')) => { + products.push(try!(CalcLengthOrPercentage::parse_product(input, expected_unit))); + } + Ok(Token::Delim('-')) => { + let mut right = try!(CalcLengthOrPercentage::parse_product(input, expected_unit)); + right.values.push(CalcValueNode::Number(-1.)); + products.push(right); + } + _ => { + return Err(()); + } + } } - _ => { - return Err(()); + input.reset(position); + break } - } - } - _ => { - input.reset(position); - break } - } - } - - + } Ok(CalcSumNode { products: products }) } |