mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add support for symbols() function.
This commit is contained in:
parent
9f4a78c2d0
commit
1df685dc40
3 changed files with 97 additions and 17 deletions
|
@ -337,7 +337,7 @@ impl ToCss for System {
|
|||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#typedef-symbol
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Symbol {
|
||||
/// <string>
|
||||
String(String),
|
||||
|
@ -367,6 +367,17 @@ impl ToCss for Symbol {
|
|||
}
|
||||
}
|
||||
|
||||
impl Symbol {
|
||||
/// Returns whether this symbol is allowed in symbols() function.
|
||||
pub fn is_allowed_in_symbols(&self) -> bool {
|
||||
match self {
|
||||
// Identifier is not allowed.
|
||||
&Symbol::Ident(_) => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-negative
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Negative(pub Symbol, pub Option<Symbol>);
|
||||
|
@ -495,7 +506,7 @@ impl ToCss for Fallback {
|
|||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Symbols(pub Vec<Symbol>);
|
||||
|
||||
impl Parse for Symbols {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue