aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko/snapshot_helpers.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-06-07 19:07:07 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-06-12 23:33:53 +0200
commit5bccf98aa4925264b7fe0c5e996ab5de13d02f3a (patch)
treeb21f0d1cdc9aeda8a336119a01e495a88f8769aa /components/style/gecko/snapshot_helpers.rs
parent524fcac19155c69f8f2ea1683b411a8ef0ee149b (diff)
downloadservo-5bccf98aa4925264b7fe0c5e996ab5de13d02f3a.tar.gz
servo-5bccf98aa4925264b7fe0c5e996ab5de13d02f3a.zip
ID and class selectors are ASCII case-insensitive in quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
Diffstat (limited to 'components/style/gecko/snapshot_helpers.rs')
-rw-r--r--components/style/gecko/snapshot_helpers.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/style/gecko/snapshot_helpers.rs b/components/style/gecko/snapshot_helpers.rs
index f7a0efa48c0..70af6f7082a 100644
--- a/components/style/gecko/snapshot_helpers.rs
+++ b/components/style/gecko/snapshot_helpers.rs
@@ -4,7 +4,10 @@
//! Element an snapshot common logic.
+use CaseSensitivityExt;
use gecko_bindings::structs::nsIAtom;
+use gecko_string_cache::WeakAtom;
+use selectors::attr::CaseSensitivity;
use std::{ptr, slice};
use string_cache::Atom;
@@ -16,6 +19,7 @@ pub type ClassOrClassList<T> = unsafe extern fn (T, *mut *mut nsIAtom, *mut *mut
/// element has the class that `name` represents.
pub fn has_class<T>(item: T,
name: &Atom,
+ case_sensitivity: CaseSensitivity,
getter: ClassOrClassList<T>) -> bool
{
unsafe {
@@ -24,10 +28,10 @@ pub fn has_class<T>(item: T,
let length = getter(item, &mut class, &mut list);
match length {
0 => false,
- 1 => name.as_ptr() == class,
+ 1 => case_sensitivity.eq_atom(name, WeakAtom::new(class)),
n => {
let classes = slice::from_raw_parts(list, n as usize);
- classes.iter().any(|ptr| name.as_ptr() == *ptr)
+ classes.iter().any(|ptr| case_sensitivity.eq_atom(name, WeakAtom::new(*ptr)))
}
}
}