Bug 1464091 - Ignore case in media feature names inside media query expressions - r=heycam
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 31 May 2018 18:22:48 +1000
changeset 479030 8a3088e2b4673c3badbbe015e1ce0ad1e551e703
parent 479029 64960572836b471f9f68ad4abb78ffb3cb0e61c4
child 479031 32a24b5f542d6f14f11c8c2cc32180066c4c8b62
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1464091
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464091 - Ignore case in media feature names inside media query expressions - r=heycam 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. MozReview-Commit-ID: JUeeEQEMIi4
servo/components/style/gecko/media_queries.rs
--- a/servo/components/style/gecko/media_queries.rs
+++ b/servo/components/style/gecko/media_queries.rs
@@ -18,17 +18,17 @@ use gecko_bindings::structs::{nsMediaFea
 use gecko_bindings::structs::{nsMediaFeature_ValueType, nsPresContext};
 use gecko_bindings::structs::RawGeckoPresContextOwned;
 use media_queries::MediaType;
 use parser::{Parse, ParserContext};
 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};
 use style_traits::viewport::ViewportConstraints;
 use stylesheets::Origin;
 use values::{serialize_atom_identifier, CSSFloat, CustomIdent, KeyframesName};
 use values::computed::{self, ToComputedValue};
 use values::computed::font::FontSize;
@@ -591,17 +591,17 @@ impl Expression {
                         Range::Min
                     } else if starts_with_ignore_ascii_case(feature_name, "max-") {
                         feature_name = &feature_name[4..];
                         Range::Max
                     } else {
                         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(()),
                     }
                 };
 
                 match result {
                     Ok((f, r)) => {