mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix and tests for negative border radius
This commit is contained in:
parent
7902842730
commit
f5253c9f09
2 changed files with 24 additions and 9 deletions
|
@ -749,10 +749,10 @@ impl ToCss for BorderRadius {
|
|||
}
|
||||
|
||||
impl Parse for BorderRadius {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
let mut widths = try!(parse_one_set_of_border_values(context, input));
|
||||
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
let mut widths = try!(parse_one_set_of_border_values(input));
|
||||
let mut heights = if input.try(|input| input.expect_delim('/')).is_ok() {
|
||||
try!(parse_one_set_of_border_values(context, input))
|
||||
try!(parse_one_set_of_border_values(input))
|
||||
} else {
|
||||
[widths[0].clone(),
|
||||
widths[1].clone(),
|
||||
|
@ -768,23 +768,22 @@ impl Parse for BorderRadius {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_one_set_of_border_values(context: &ParserContext, mut input: &mut Parser)
|
||||
fn parse_one_set_of_border_values(mut input: &mut Parser)
|
||||
-> Result<[LengthOrPercentage; 4], ()> {
|
||||
let a = try!(LengthOrPercentage::parse(context, input));
|
||||
|
||||
let b = if let Ok(b) = input.try(|i| LengthOrPercentage::parse(context, i)) {
|
||||
let a = try!(LengthOrPercentage::parse_non_negative(input));
|
||||
let b = if let Ok(b) = input.try(|i| LengthOrPercentage::parse_non_negative(i)) {
|
||||
b
|
||||
} else {
|
||||
return Ok([a.clone(), a.clone(), a.clone(), a])
|
||||
};
|
||||
|
||||
let c = if let Ok(c) = input.try(|i| LengthOrPercentage::parse(context, i)) {
|
||||
let c = if let Ok(c) = input.try(|i| LengthOrPercentage::parse_non_negative(i)) {
|
||||
c
|
||||
} else {
|
||||
return Ok([a.clone(), b.clone(), a, b])
|
||||
};
|
||||
|
||||
if let Ok(d) = input.try(|i| LengthOrPercentage::parse(context, i)) {
|
||||
if let Ok(d) = input.try(|i| LengthOrPercentage::parse_non_negative(i)) {
|
||||
Ok([a, b, c, d])
|
||||
} else {
|
||||
Ok([a, b.clone(), c, b])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue