Use Rect in InsetRect

This commit is contained in:
Anthony Ramine 2017-05-25 13:01:06 +02:00
parent 6f3c46ca61
commit 150c9df246
6 changed files with 34 additions and 47 deletions

View file

@ -128,17 +128,14 @@ impl InsetRect {
/// Parse the inner function arguments of `inset()`
pub fn parse_function_arguments(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
let rect = Rect::parse_with(context, input, LengthOrPercentage::parse)?;
let round_rect = if input.try(|i| i.expect_ident_matching("round")).is_ok() {
let round = if input.try(|i| i.expect_ident_matching("round")).is_ok() {
Some(BorderRadius::parse(context, input)?)
} else {
None
};
Ok(GenericInsetRect {
top: rect.top,
right: rect.right,
bottom: rect.bottom,
left: rect.left,
round: round_rect,
rect: rect,
round: round,
})
}
}