mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Upgrade cssparser to 0.15
This commit is contained in:
parent
66c130d55a
commit
b83afdedc8
42 changed files with 234 additions and 217 deletions
|
@ -231,21 +231,20 @@ impl Resolution {
|
|||
|
||||
fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
let (value, unit) = match try!(input.next()) {
|
||||
Token::Dimension(value, unit) => {
|
||||
Token::Dimension { value, unit, .. } => {
|
||||
(value, unit)
|
||||
},
|
||||
t => return Err(BasicParseError::UnexpectedToken(t).into()),
|
||||
};
|
||||
|
||||
let inner_value = value.value;
|
||||
if inner_value <= 0. {
|
||||
if value <= 0. {
|
||||
return Err(StyleParseError::UnspecifiedError.into())
|
||||
}
|
||||
|
||||
(match_ignore_ascii_case! { &unit,
|
||||
"dpi" => Ok(Resolution::Dpi(inner_value)),
|
||||
"dppx" => Ok(Resolution::Dppx(inner_value)),
|
||||
"dpcm" => Ok(Resolution::Dpcm(inner_value)),
|
||||
"dpi" => Ok(Resolution::Dpi(value)),
|
||||
"dppx" => Ok(Resolution::Dppx(value)),
|
||||
"dpcm" => Ok(Resolution::Dpcm(value)),
|
||||
_ => Err(())
|
||||
}).map_err(|()| StyleParseError::UnexpectedDimension(unit).into())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue