From 029150c770d887acabb3667b934efc53c6e1629b Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 26 Apr 2017 05:39:36 +0200 Subject: [PATCH] Exclude 'none' from after all. https://github.com/w3c/csswg-drafts/issues/1295 --- components/style/counter_style/mod.rs | 3 ++- components/style/stylesheets.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index 8397ebff755..ca27a650334 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -38,7 +38,8 @@ pub fn parse_counter_style_name(input: &mut Parser) -> Result { if let Some(&lower_cased) = predefined(&ident) { Ok(CustomIdent(Atom::from(lower_cased))) } else { - CustomIdent::from_ident(ident, &[]) + // https://github.com/w3c/csswg-drafts/issues/1295 excludes "none" + CustomIdent::from_ident(ident, &["none"]) } } } diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index 4012761a6ef..9986328cb00 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -6,10 +6,10 @@ #![deny(missing_docs)] -use {Prefix, Namespace}; +use {Atom, Prefix, Namespace}; use counter_style::{CounterStyleRule, parse_counter_style_name, parse_counter_style_body}; 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 error_reporting::{ParseErrorReporter, NullReporter}; #[cfg(feature = "servo")] @@ -1117,10 +1117,10 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { return Err(()) } let name = parse_counter_style_name(input)?; - // FIXME: use static atoms and eq_ignore_ascii_case - // https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 - // "decimal" is already lower-cased by `parse_counter_style_name`. - if name.0 == "decimal" || name.0.eq_str_ignore_ascii_case("none") { + // ASCII-case-insensitive matches for "decimal" are already lower-cased + // by `parse_counter_style_name`, so we can use == here. + // FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 use atom!("decimal") + if name.0 == Atom::from("decimal") { return Err(()) } Ok(AtRuleType::WithBlock(AtRulePrelude::CounterStyle(name)))