Auto merge of #17883 - frewsxcv:frewsxcxv-lowercase, r=SimonSapin

Audit usages of unicode case-changing methods.

Part of https://github.com/servo/servo/issues/17777.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17883)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-02 03:01:26 -05:00 committed by GitHub
commit 5fff90c73f
10 changed files with 46 additions and 48 deletions

View file

@ -12,7 +12,6 @@ use cssparser::{Delimiter, Parser, Token, ParserInput};
use parser::ParserContext;
use selectors::parser::SelectorParseError;
use serialize_comma_separated_list;
use std::ascii::AsciiExt;
use std::fmt;
use style_traits::{ToCss, ParseError, StyleParseError};
@ -146,20 +145,15 @@ pub enum MediaQueryType {
impl MediaQueryType {
fn parse(ident: &str) -> Result<Self, ()> {
if ident.eq_ignore_ascii_case("all") {
return Ok(MediaQueryType::All);
}
// From https://drafts.csswg.org/mediaqueries/#mq-syntax:
//
// The <media-type> production does not include the keywords only,
// not, and, and or.
if ident.eq_ignore_ascii_case("not") ||
ident.eq_ignore_ascii_case("or") ||
ident.eq_ignore_ascii_case("and") ||
ident.eq_ignore_ascii_case("only") {
return Err(())
}
match_ignore_ascii_case! { ident,
"all" => return Ok(MediaQueryType::All),
// From https://drafts.csswg.org/mediaqueries/#mq-syntax:
//
// The <media-type> production does not include the keywords only,
// not, and, and or.
"not" | "or" | "and" | "only" => return Err(()),
_ => (),
};
Ok(match MediaType::parse(ident) {
Some(media_type) => MediaQueryType::Known(media_type),