mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: [css-lists-3] Make 'none' invalid as a <counter-style> in counter()/counters().
CSSWG resolution: https://github.com/w3c/csswg-drafts/issues/4163#issuecomment-521331100 Spec: https://drafts.csswg.org/css-lists-3/#counter-functions Differential Revision: https://phabricator.services.mozilla.com/D43893
This commit is contained in:
parent
1406ae7f39
commit
f7a87c49b1
7 changed files with 63 additions and 63 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::generics::CounterStyleOrNone;
|
||||
use crate::values::generics::CounterStyle;
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::CustomIdent;
|
||||
use cssparser::{Parser, Token};
|
||||
|
@ -27,8 +27,10 @@ use style_traits::{ParseError, StyleParseErrorKind};
|
|||
ToShmem,
|
||||
)]
|
||||
pub enum ListStyleType {
|
||||
/// <counter-style> | none
|
||||
CounterStyle(CounterStyleOrNone),
|
||||
/// `none`
|
||||
None,
|
||||
/// <counter-style>
|
||||
CounterStyle(CounterStyle),
|
||||
/// <string>
|
||||
String(String),
|
||||
}
|
||||
|
@ -38,7 +40,7 @@ impl ListStyleType {
|
|||
/// Initial specified value for `list-style-type`.
|
||||
#[inline]
|
||||
pub fn disc() -> Self {
|
||||
ListStyleType::CounterStyle(CounterStyleOrNone::disc())
|
||||
ListStyleType::CounterStyle(CounterStyle::disc())
|
||||
}
|
||||
|
||||
/// Convert from gecko keyword to list-style-type.
|
||||
|
@ -50,10 +52,10 @@ impl ListStyleType {
|
|||
use crate::gecko_bindings::structs;
|
||||
|
||||
if value == structs::NS_STYLE_LIST_STYLE_NONE {
|
||||
return ListStyleType::CounterStyle(CounterStyleOrNone::None);
|
||||
return ListStyleType::None;
|
||||
}
|
||||
|
||||
ListStyleType::CounterStyle(CounterStyleOrNone::Name(CustomIdent(match value {
|
||||
ListStyleType::CounterStyle(CounterStyle::Name(CustomIdent(match value {
|
||||
structs::NS_STYLE_LIST_STYLE_DISC => atom!("disc"),
|
||||
structs::NS_STYLE_LIST_STYLE_CIRCLE => atom!("circle"),
|
||||
structs::NS_STYLE_LIST_STYLE_SQUARE => atom!("square"),
|
||||
|
@ -73,10 +75,12 @@ impl Parse for ListStyleType {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(style) = input.try(|i| CounterStyleOrNone::parse(context, i)) {
|
||||
if let Ok(style) = input.try(|i| CounterStyle::parse(context, i)) {
|
||||
return Ok(ListStyleType::CounterStyle(style));
|
||||
}
|
||||
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(ListStyleType::None);
|
||||
}
|
||||
Ok(ListStyleType::String(
|
||||
input.expect_string()?.as_ref().to_owned(),
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue