mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
Pass ParserContext down to lengths
To make it possible to check the rule type when parsing lengths, we need to pass the `ParserContext` down through many layers to the place where length units are parsed. This change leaves it unused, so it's only to prepare for the next change. MozReview-Commit-ID: 70YwtcCxnWw
This commit is contained in:
parent
1ae1d370f2
commit
1a31b87c22
31 changed files with 304 additions and 251 deletions
|
@ -525,16 +525,16 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
}
|
||||
|
||||
impl Parse for SingleSpecifiedValue {
|
||||
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
if input.try(|input| input.expect_ident_matching("auto")).is_ok() {
|
||||
return Ok(SingleSpecifiedValue::Auto);
|
||||
}
|
||||
|
||||
if let Ok(len) = input.try(|input| LengthOrPercentage::parse_non_negative(input)) {
|
||||
if let Ok(len) = input.try(|input| LengthOrPercentage::parse_non_negative(context, input)) {
|
||||
return Ok(SingleSpecifiedValue::LengthOrPercentage(len));
|
||||
}
|
||||
|
||||
let num = try!(Number::parse_non_negative(input));
|
||||
let num = try!(Number::parse_non_negative(context, input));
|
||||
Ok(SingleSpecifiedValue::Number(num))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue