mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add 'additive-symbols' descriptor for @counter-style
This commit is contained in:
parent
f93a9a4b10
commit
62d261add4
2 changed files with 41 additions and 4 deletions
|
@ -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<AdditiveSymbol> = !
|
||||
}
|
||||
|
||||
/// 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<W>(&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<Symbol>);
|
||||
|
||||
|
@ -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<Self, ()> {
|
||||
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<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
write!(dest, "{} ", self.value)?;
|
||||
self.symbol.to_css(dest)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,3 +234,10 @@ impl ToNsCssValue for counter_style::Symbols {
|
|||
// FIXME: add bindings for nsCSSValueList
|
||||
}
|
||||
}
|
||||
|
||||
impl ToNsCssValue for Vec<counter_style::AdditiveSymbol> {
|
||||
fn convert(&self, _nscssvalue: &mut nsCSSValue) {
|
||||
debug_assert!(!self.is_empty());
|
||||
// FIXME: add bindings for nsCSSValuePairList
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue