Skip to content

Commit

Permalink
Implement the unitless length quirk for clip
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 27, 2017
1 parent 46913ff commit ba59faf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
12 changes: 11 additions & 1 deletion components/style/values/specified/length.rs
Expand Up @@ -618,7 +618,17 @@ impl Length {

impl Parse for Length {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
Self::parse_internal(context, input, AllowedLengthType::All, AllowQuirks::No)
Self::parse_quirky(context, input, AllowQuirks::No)
}
}

impl Length {
/// Parses a length, with quirks.
pub fn parse_quirky(context: &ParserContext,
input: &mut Parser,
allow_quirks: AllowQuirks)
-> Result<Self, ()> {
Self::parse_internal(context, input, AllowedLengthType::All, allow_quirks)
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/style/values/specified/mod.rs
Expand Up @@ -1291,13 +1291,13 @@ impl ToComputedValue for ClipRect {

impl Parse for ClipRect {
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
use values::specified::Length;
use values::specified::{AllowQuirks, Length};

fn parse_argument(context: &ParserContext, input: &mut Parser) -> Result<Option<Length>, ()> {
if input.try(|input| input.expect_ident_matching("auto")).is_ok() {
Ok(None)
} else {
Length::parse(context, input).map(Some)
Length::parse_quirky(context, input, AllowQuirks::Yes).map(Some)
}
}

Expand Down
18 changes: 0 additions & 18 deletions tests/wpt/metadata/quirks-mode/unitless-length.html.ini
Expand Up @@ -12,9 +12,6 @@
expected:
if os == "mac": FAIL

[clip: 1 (quirks)]
expected: FAIL

[font-size: 1 (quirks)]
expected: FAIL

Expand Down Expand Up @@ -99,9 +96,6 @@
expected:
if os == "mac": FAIL

[clip: +1 (quirks)]
expected: FAIL

[font-size: +1 (quirks)]
expected: FAIL

Expand Down Expand Up @@ -186,9 +180,6 @@
expected:
if os == "mac": FAIL

[clip: -1 (quirks)]
expected: FAIL

[letter-spacing: -1 (quirks)]
expected: FAIL

Expand Down Expand Up @@ -240,9 +231,6 @@
expected:
if os == "mac": FAIL

[clip: 1.5 (quirks)]
expected: FAIL

[font-size: 1.5 (quirks)]
expected: FAIL

Expand Down Expand Up @@ -327,9 +315,6 @@
expected:
if os == "mac": FAIL

[clip: +1.5 (quirks)]
expected: FAIL

[font-size: +1.5 (quirks)]
expected: FAIL

Expand Down Expand Up @@ -414,9 +399,6 @@
expected:
if os == "mac": FAIL

[clip: -1.5 (quirks)]
expected: FAIL

[letter-spacing: -1.5 (quirks)]
expected: FAIL

Expand Down

0 comments on commit ba59faf

Please sign in to comment.