From ba59fafb44a62ee54cd2f701a2e99fe7327b7834 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 24 Apr 2017 14:41:51 +0200 Subject: [PATCH] Implement the unitless length quirk for clip --- components/style/values/specified/length.rs | 12 +++++++++++- components/style/values/specified/mod.rs | 4 ++-- .../quirks-mode/unitless-length.html.ini | 18 ------------------ 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 830a6bb4554..142b44e1861 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -618,7 +618,17 @@ impl Length { impl Parse for Length { fn parse(context: &ParserContext, input: &mut Parser) -> Result { - 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::parse_internal(context, input, AllowedLengthType::All, allow_quirks) } } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 6c7a74627c0..eb7c71eabe8 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -1291,13 +1291,13 @@ impl ToComputedValue for ClipRect { impl Parse for ClipRect { fn parse(context: &ParserContext, input: &mut Parser) -> Result { - use values::specified::Length; + use values::specified::{AllowQuirks, Length}; fn parse_argument(context: &ParserContext, input: &mut Parser) -> Result, ()> { 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) } } diff --git a/tests/wpt/metadata/quirks-mode/unitless-length.html.ini b/tests/wpt/metadata/quirks-mode/unitless-length.html.ini index 870dcb0d8e8..6b916d49a89 100644 --- a/tests/wpt/metadata/quirks-mode/unitless-length.html.ini +++ b/tests/wpt/metadata/quirks-mode/unitless-length.html.ini @@ -12,9 +12,6 @@ expected: if os == "mac": FAIL - [clip: 1 (quirks)] - expected: FAIL - [font-size: 1 (quirks)] expected: FAIL @@ -99,9 +96,6 @@ expected: if os == "mac": FAIL - [clip: +1 (quirks)] - expected: FAIL - [font-size: +1 (quirks)] expected: FAIL @@ -186,9 +180,6 @@ expected: if os == "mac": FAIL - [clip: -1 (quirks)] - expected: FAIL - [letter-spacing: -1 (quirks)] expected: FAIL @@ -240,9 +231,6 @@ expected: if os == "mac": FAIL - [clip: 1.5 (quirks)] - expected: FAIL - [font-size: 1.5 (quirks)] expected: FAIL @@ -327,9 +315,6 @@ expected: if os == "mac": FAIL - [clip: +1.5 (quirks)] - expected: FAIL - [font-size: +1.5 (quirks)] expected: FAIL @@ -414,9 +399,6 @@ expected: if os == "mac": FAIL - [clip: -1.5 (quirks)] - expected: FAIL - [letter-spacing: -1.5 (quirks)] expected: FAIL