Exclude 'none' from <counter-style-name> after all.

https://github.com/w3c/csswg-drafts/issues/1295
This commit is contained in:
Simon Sapin 2017-04-26 05:39:36 +02:00
parent be38c9a5a7
commit 029150c770
2 changed files with 8 additions and 7 deletions

View file

@ -38,7 +38,8 @@ pub fn parse_counter_style_name(input: &mut Parser) -> Result<CustomIdent, ()> {
if let Some(&lower_cased) = predefined(&ident) { if let Some(&lower_cased) = predefined(&ident) {
Ok(CustomIdent(Atom::from(lower_cased))) Ok(CustomIdent(Atom::from(lower_cased)))
} else { } else {
CustomIdent::from_ident(ident, &[]) // https://github.com/w3c/csswg-drafts/issues/1295 excludes "none"
CustomIdent::from_ident(ident, &["none"])
} }
} }
} }

View file

@ -6,10 +6,10 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use {Prefix, Namespace}; use {Atom, Prefix, Namespace};
use counter_style::{CounterStyleRule, parse_counter_style_name, parse_counter_style_body}; use counter_style::{CounterStyleRule, parse_counter_style_name, parse_counter_style_body};
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser}; use cssparser::{AtRuleParser, Parser, QualifiedRuleParser};
use cssparser::{AtRuleType, RuleListParser, SourcePosition, parse_one_rule}; use cssparser::{AtRuleType, RuleListParser, parse_one_rule};
use cssparser::ToCss as ParserToCss; use cssparser::ToCss as ParserToCss;
use error_reporting::{ParseErrorReporter, NullReporter}; use error_reporting::{ParseErrorReporter, NullReporter};
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
@ -1117,10 +1117,10 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> {
return Err(()) return Err(())
} }
let name = parse_counter_style_name(input)?; let name = parse_counter_style_name(input)?;
// FIXME: use static atoms and eq_ignore_ascii_case // ASCII-case-insensitive matches for "decimal" are already lower-cased
// https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 // by `parse_counter_style_name`, so we can use == here.
// "decimal" is already lower-cased by `parse_counter_style_name`. // FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 use atom!("decimal")
if name.0 == "decimal" || name.0.eq_str_ignore_ascii_case("none") { if name.0 == Atom::from("decimal") {
return Err(()) return Err(())
} }
Ok(AtRuleType::WithBlock(AtRulePrelude::CounterStyle(name))) Ok(AtRuleType::WithBlock(AtRulePrelude::CounterStyle(name)))