style: respect allow_quirks for boxed properties.

This will unblock #19119
This commit is contained in:
Emilio Cobos Álvarez 2017-11-07 13:28:06 +01:00
parent 4a132437df
commit 7f073456f9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -402,22 +402,30 @@
% endif % endif
} }
% if not property.derived_from: % if not property.derived_from:
pub fn parse_specified<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) pub fn parse_specified<'i, 't>(
% if property.boxed: context: &ParserContext,
-> Result<Box<SpecifiedValue>, ParseError<'i>> { input: &mut Parser<'i, 't>,
parse(context, input).map(|result| Box::new(result)) % if property.boxed:
) -> Result<Box<SpecifiedValue>, ParseError<'i>> {
% else:
) -> Result<SpecifiedValue, ParseError<'i>> {
% endif
% if property.allow_quirks:
parse_quirky(context, input, specified::AllowQuirks::Yes)
% else: % else:
-> Result<SpecifiedValue, ParseError<'i>> { parse(context, input)
% if property.allow_quirks: % endif
parse_quirky(context, input, specified::AllowQuirks::Yes) % if property.boxed:
% else: .map(Box::new)
parse(context, input)
% endif
% endif % endif
} }
pub fn parse_declared<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<PropertyDeclaration, ParseError<'i>> { pub fn parse_declared<'i, 't>(
parse_specified(context, input).map(PropertyDeclaration::${property.camel_case}) context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<PropertyDeclaration, ParseError<'i>> {
parse_specified(context, input)
.map(PropertyDeclaration::${property.camel_case})
} }
% endif % endif
} }