From 839eda000a8bcd979f8af932803180e3b5c96e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 7 Mar 2018 03:14:53 +0100 Subject: [PATCH] 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. --- components/style/values/specified/counters.rs | 17 +++++++++++++++-- .../css/cssom/serialize-values.html.ini | 6 ------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/components/style/values/specified/counters.rs b/components/style/values/specified/counters.rs index f7130a79b2f..d1d4f138f59 100644 --- a/components/style/values/specified/counters.rs +++ b/components/style/values/specified/counters.rs @@ -76,9 +76,22 @@ fn parse_counters<'i, 't>( #[cfg(feature = "servo")] type CounterStyleType = ListStyleType; + #[cfg(feature = "gecko")] 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. /// /// https://drafts.csswg.org/css-content/#propdef-content @@ -102,10 +115,10 @@ pub enum ContentItem { String(Box), /// `counter(name, style)`. #[css(comma, function)] - Counter(CustomIdent, CounterStyleType), + Counter(CustomIdent, #[css(skip_if = "is_decimal")] CounterStyleType), /// `counters(name, separator, style)`. #[css(comma, function)] - Counters(CustomIdent, Box, CounterStyleType), + Counters(CustomIdent, Box, #[css(skip_if = "is_decimal")] CounterStyleType), /// `open-quote`. OpenQuote, /// `close-quote`. diff --git a/tests/wpt/metadata/css/cssom/serialize-values.html.ini b/tests/wpt/metadata/css/cssom/serialize-values.html.ini index d499a0af3df..3120a9ea8f7 100644 --- a/tests/wpt/metadata/css/cssom/serialize-values.html.ini +++ b/tests/wpt/metadata/css/cssom/serialize-values.html.ini @@ -98,9 +98,3 @@ [widows: inherit] expected: FAIL - [content: counter(par-num)] - expected: FAIL - - [content: counter(par-num, decimal)] - expected: FAIL -