mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Stylo: avoid atom refcount traffic in ID selector matching
This commit is contained in:
parent
b82713924c
commit
138c03b24d
1 changed files with 13 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue