servo: Merge #20224 - Fix counter() and counters() serialization (from emilio:counter-serialization); r=nox

See https://github.com/w3c/csswg-drafts/issues/670 and https://github.com/w3c/web-platform-tests/pull/9862.

Source-Repo: https://github.com/servo/servo
Source-Revision: 7b326529db64ac27f0b956880b3b63dd12cd0c1a

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : f14cab2e020a7dfcb494721a5f04426cc54637a3
This commit is contained in:
Emilio Cobos Álvarez 2018-03-14 13:26:00 -04:00
Родитель ab60ae72ae
Коммит 4de3433bd6
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -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<str>),
/// `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<str>, CounterStyleType),
Counters(CustomIdent, Box<str>, #[css(skip_if = "is_decimal")] CounterStyleType),
/// `open-quote`.
OpenQuote,
/// `close-quote`.