mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Implement the unitless length quirk for border-*-width
This commit is contained in:
parent
03d24e8361
commit
b5a558e592
4 changed files with 20 additions and 52 deletions
|
@ -491,7 +491,17 @@ pub enum BorderWidth {
|
|||
|
||||
impl Parse for BorderWidth {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<BorderWidth, ()> {
|
||||
match input.try(|i| Length::parse_non_negative(context, i)) {
|
||||
Self::parse_quirky(context, input, AllowQuirks::No)
|
||||
}
|
||||
}
|
||||
|
||||
impl BorderWidth {
|
||||
/// Parses a border width, allowing quirks.
|
||||
pub fn parse_quirky(context: &ParserContext,
|
||||
input: &mut Parser,
|
||||
allow_quirks: AllowQuirks)
|
||||
-> Result<BorderWidth, ()> {
|
||||
match input.try(|i| Length::parse_non_negative_quirky(context, i, allow_quirks)) {
|
||||
Ok(length) => Ok(BorderWidth::Width(length)),
|
||||
Err(_) => match_ignore_ascii_case! { &try!(input.expect_ident()),
|
||||
"thin" => Ok(BorderWidth::Thin),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue