style: Ignore case in media feature names inside media query expressions.

Media feature names are converted to lower case before being processed, making
them effectively case-insensitive.
Prefixes ("min-", etc.) and values are already treated in a case-insensitive
manner.

Bug: 1464091
Reviewed-by: heycam
MozReview-Commit-ID: JUeeEQEMIi4
This commit is contained in:
Gerald Squelart 2018-05-31 18:22:48 +10:00 committed by Emilio Cobos Álvarez
parent 1f562af418
commit 9d679c9b20
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -23,7 +23,7 @@ use properties::ComputedValues;
use servo_arc::Arc;
use std::fmt::{self, Write};
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
use str::starts_with_ignore_ascii_case;
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
use string_cache::Atom;
use style_traits::{CSSPixel, CssWriter, DevicePixel};
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
@ -596,7 +596,7 @@ impl Expression {
Range::Equal
};
let atom = Atom::from(feature_name);
let atom = Atom::from(string_as_ascii_lowercase(feature_name));
match find_feature(|f| atom.as_ptr() == unsafe { *f.mName as *mut _ }) {
Some(f) => Ok((f, range)),
None => Err(()),