diff --git a/components/style/counter_style.rs b/components/style/counter_style.rs index 0a3581a99b9..88de60751f7 100644 --- a/components/style/counter_style.rs +++ b/components/style/counter_style.rs @@ -193,8 +193,11 @@ counter_style_descriptors! { Fallback(CustomIdent(Atom::from("decimal"))) } - /// https://drafts.csswg.org/css-counter-styles/#counter-style-symbols + /// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols "symbols" symbols / eCSSCounterDesc_Symbols: Symbols = ! + + /// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols + "additive-symbols" additive_symbols / eCSSCounterDesc_AdditiveSymbols: Vec = ! } /// https://drafts.csswg.org/css-counter-styles/#counter-style-system @@ -400,8 +403,7 @@ impl Parse for Pad { impl ToCss for Pad { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - write!(dest, "{}", self.0)?; - dest.write_char(' ')?; + write!(dest, "{} ", self.0)?; self.1.to_css(dest) } } @@ -422,7 +424,7 @@ impl ToCss for Fallback { } } -/// https://drafts.csswg.org/css-counter-styles/#counter-style-symbols +/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols #[derive(Debug, Clone)] pub struct Symbols(pub Vec); @@ -455,3 +457,31 @@ impl ToCss for Symbols { Ok(()) } } + +/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols +#[derive(Debug, Clone)] +pub struct AdditiveSymbol { + value: i32, + symbol: Symbol, +} + +impl OneOrMoreCommaSeparated for AdditiveSymbol {} + +impl Parse for AdditiveSymbol { + fn parse(context: &ParserContext, input: &mut Parser) -> Result { + let value = input.try(|input| input.expect_integer()); + let symbol = Symbol::parse(context, input)?; + let value = value.or_else(|()| input.expect_integer())?; + Ok(AdditiveSymbol { + value: value, + symbol: symbol, + }) + } +} + +impl ToCss for AdditiveSymbol { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + write!(dest, "{} ", self.value)?; + self.symbol.to_css(dest) + } +} diff --git a/components/style/gecko/rules.rs b/components/style/gecko/rules.rs index e36b1a5c724..d9e27faf683 100644 --- a/components/style/gecko/rules.rs +++ b/components/style/gecko/rules.rs @@ -234,3 +234,10 @@ impl ToNsCssValue for counter_style::Symbols { // FIXME: add bindings for nsCSSValueList } } + +impl ToNsCssValue for Vec { + fn convert(&self, _nscssvalue: &mut nsCSSValue) { + debug_assert!(!self.is_empty()); + // FIXME: add bindings for nsCSSValuePairList + } +}