diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 6563b97df15..478e1be659b 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -809,7 +809,8 @@ % endif -<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, needs_context=True, **kwargs)"> +<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, + needs_context=True, allow_quirks=False, **kwargs)"> <% sub_properties=' '.join(sub_property_pattern % side for side in ['top', 'right', 'bottom', 'left']) %> <%call expr="self.shorthand(name, sub_properties=sub_properties, **kwargs)"> #[allow(unused_imports)] @@ -819,7 +820,9 @@ pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result { let (top, right, bottom, left) = - % if needs_context: + % if allow_quirks: + try!(parse_four_sides(input, |i| ${parser_function}_quirky(context, i, specified::AllowQuirks::Yes))); + % elif needs_context: try!(parse_four_sides(input, |i| ${parser_function}(context, i))); % else: try!(parse_four_sides(input, ${parser_function})); diff --git a/components/style/properties/shorthand/margin.mako.rs b/components/style/properties/shorthand/margin.mako.rs index 4dcaa71e626..07b6ba6bbed 100644 --- a/components/style/properties/shorthand/margin.mako.rs +++ b/components/style/properties/shorthand/margin.mako.rs @@ -6,4 +6,5 @@ ${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthOrPercentageOrAuto::parse", spec="https://drafts.csswg.org/css-box/#propdef-margin", - allowed_in_page_rule=True)} + allowed_in_page_rule=True, + allow_quirks=True)} diff --git a/tests/wpt/metadata/quirks-mode/unitless-length.html.ini b/tests/wpt/metadata/quirks-mode/unitless-length.html.ini index 3a7420644f1..57b312ab152 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 - [margin: 1 (quirks)] - expected: FAIL - [max-height: 1 (quirks)] expected: FAIL @@ -75,9 +72,6 @@ expected: if os == "mac": FAIL - [margin: +1 (quirks)] - expected: FAIL - [max-height: +1 (quirks)] expected: FAIL @@ -138,9 +132,6 @@ expected: if os == "mac": FAIL - [margin: -1 (quirks)] - expected: FAIL - [padding: -1 (quirks)] expected: FAIL @@ -177,9 +168,6 @@ expected: if os == "mac": FAIL - [margin: 1.5 (quirks)] - expected: FAIL - [max-height: 1.5 (quirks)] expected: FAIL @@ -240,9 +228,6 @@ expected: if os == "mac": FAIL - [margin: +1.5 (quirks)] - expected: FAIL - [max-height: +1.5 (quirks)] expected: FAIL @@ -303,9 +288,6 @@ expected: if os == "mac": FAIL - [margin: -1.5 (quirks)] - expected: FAIL - [padding: -1.5 (quirks)] expected: FAIL @@ -1314,27 +1296,15 @@ expected: if os == "mac": FAIL - [margin: 1px 2 (quirks)] - expected: FAIL - [padding: 1px 2 (quirks)] expected: FAIL - [margin: 1 2px (quirks)] - expected: FAIL - [padding: 1 2px (quirks)] expected: FAIL - [margin: 1 +2 (quirks)] - expected: FAIL - [padding: 1 +2 (quirks)] expected: FAIL - [margin: 1 -2 (quirks)] - expected: FAIL - [padding: 1 -2 (quirks)] expected: FAIL