Skip to content

Commit

Permalink
Stylo: avoid atom refcount traffic in ID selector matching
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Jun 12, 2017
1 parent b827139 commit 138c03b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/style/gecko/wrapper.rs
Expand Up @@ -1593,7 +1593,19 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
}

fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
self.get_id().map_or(false, |atom| case_sensitivity.eq_atom(&atom, id))
if !self.has_id() {
return false
}

unsafe {
let ptr = bindings::Gecko_AtomAttrValue(self.0, atom!("id").as_ptr());

if ptr.is_null() {
false
} else {
case_sensitivity.eq_atom(WeakAtom::new(ptr), id)
}
}
}

fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
Expand Down

0 comments on commit 138c03b

Please sign in to comment.