style: Avoid serializing the counter type in counter functions if it's decimal.

See https://github.com/w3c/web-platform-tests/pull/9862 and such.
This commit is contained in:
Emilio Cobos Álvarez 2018-03-07 03:14:53 +01:00
parent daaee046b3
commit 839eda000a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 15 additions and 8 deletions

View file

@ -76,9 +76,22 @@ fn parse_counters<'i, 't>(
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
type CounterStyleType = ListStyleType; type CounterStyleType = ListStyleType;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
type CounterStyleType = CounterStyleOrNone; type CounterStyleType = CounterStyleOrNone;
#[cfg(feature = "servo")]
#[inline]
fn is_decimal(counter_type: &CounterStyleType) -> bool {
*counter_type == ListStyleType::Decimal
}
#[cfg(feature = "gecko")]
#[inline]
fn is_decimal(counter_type: &CounterStyleType) -> bool {
*counter_type == CounterStyleOrNone::decimal()
}
/// The specified value for the `content` property. /// The specified value for the `content` property.
/// ///
/// https://drafts.csswg.org/css-content/#propdef-content /// https://drafts.csswg.org/css-content/#propdef-content
@ -102,10 +115,10 @@ pub enum ContentItem {
String(Box<str>), String(Box<str>),
/// `counter(name, style)`. /// `counter(name, style)`.
#[css(comma, function)] #[css(comma, function)]
Counter(CustomIdent, CounterStyleType), Counter(CustomIdent, #[css(skip_if = "is_decimal")] CounterStyleType),
/// `counters(name, separator, style)`. /// `counters(name, separator, style)`.
#[css(comma, function)] #[css(comma, function)]
Counters(CustomIdent, Box<str>, CounterStyleType), Counters(CustomIdent, Box<str>, #[css(skip_if = "is_decimal")] CounterStyleType),
/// `open-quote`. /// `open-quote`.
OpenQuote, OpenQuote,
/// `close-quote`. /// `close-quote`.

View file

@ -98,9 +98,3 @@
[widows: inherit] [widows: inherit]
expected: FAIL expected: FAIL
[content: counter(par-num)]
expected: FAIL
[content: counter(par-num, decimal)]
expected: FAIL