mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Accept strings in -moz-image-rect() (fixes #16823)
This commit is contained in:
parent
73f77e0a53
commit
c9d140121d
1 changed files with 26 additions and 29 deletions
|
@ -391,35 +391,6 @@ impl ShapeExtent {
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse for ImageRect {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
match_ignore_ascii_case! { &try!(input.expect_function()),
|
||||
"-moz-image-rect" => {
|
||||
input.parse_nested_block(|input| {
|
||||
let url = SpecifiedUrl::parse(context, input)?;
|
||||
input.expect_comma()?;
|
||||
let top = NumberOrPercentage::parse(context, input)?;
|
||||
input.expect_comma()?;
|
||||
let right = NumberOrPercentage::parse(context, input)?;
|
||||
input.expect_comma()?;
|
||||
let bottom = NumberOrPercentage::parse(context, input)?;
|
||||
input.expect_comma()?;
|
||||
let left = NumberOrPercentage::parse(context, input)?;
|
||||
|
||||
Ok(ImageRect {
|
||||
url: url,
|
||||
top: top,
|
||||
right: right,
|
||||
bottom: bottom,
|
||||
left: left,
|
||||
})
|
||||
})
|
||||
}
|
||||
_ => Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for ColorStop {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
Ok(ColorStop {
|
||||
|
@ -428,3 +399,29 @@ impl Parse for ColorStop {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for ImageRect {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
input.try(|i| i.expect_function_matching("-moz-image-rect"))?;
|
||||
input.parse_nested_block(|i| {
|
||||
let string = i.expect_url_or_string()?;
|
||||
let url = SpecifiedUrl::parse_from_string(string, context)?;
|
||||
i.expect_comma()?;
|
||||
let top = NumberOrPercentage::parse(context, i)?;
|
||||
i.expect_comma()?;
|
||||
let right = NumberOrPercentage::parse(context, i)?;
|
||||
i.expect_comma()?;
|
||||
let bottom = NumberOrPercentage::parse(context, i)?;
|
||||
i.expect_comma()?;
|
||||
let left = NumberOrPercentage::parse(context, i)?;
|
||||
|
||||
Ok(ImageRect {
|
||||
url: url,
|
||||
top: top,
|
||||
right: right,
|
||||
bottom: bottom,
|
||||
left: left,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue