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:
J. Ryan Stinnett 2017-04-11 16:00:37 +08:00
parent 1ae1d370f2
commit 1a31b87c22
31 changed files with 304 additions and 251 deletions

View file

@ -138,8 +138,8 @@ pub fn parse_flex(input: &mut Parser) -> Result<CSSFloat, ()> {
}
impl Parse for TrackBreadth<LengthOrPercentage> {
fn parse(_: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if let Ok(lop) = input.try(LengthOrPercentage::parse_non_negative) {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if let Ok(lop) = input.try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
return Ok(TrackBreadth::Breadth(lop))
}
@ -230,7 +230,7 @@ impl Parse for TrackSize<LengthOrPercentage> {
if input.try(|i| i.expect_function_matching("minmax")).is_ok() {
return input.parse_nested_block(|input| {
let inflexible_breadth =
match input.try(LengthOrPercentage::parse_non_negative) {
match input.try(|i| LengthOrPercentage::parse_non_negative(context, i)) {
Ok(lop) => TrackBreadth::Breadth(lop),
Err(..) => {
let keyword = try!(TrackKeyword::parse(input));