mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Always inline GeckoElement::has_class.
It's easier, and probably faster, than trying to inline the function call to Gecko. This symbol is in libxul.so as of right now.
This commit is contained in:
parent
1e72a12265
commit
e55bb3e76d
2 changed files with 2 additions and 2 deletions
|
@ -34,7 +34,7 @@ pub fn has_class<T>(
|
||||||
let classes = slice::from_raw_parts(list, n as usize);
|
let classes = slice::from_raw_parts(list, n as usize);
|
||||||
match case_sensitivity {
|
match case_sensitivity {
|
||||||
CaseSensitivity::CaseSensitive => {
|
CaseSensitivity::CaseSensitive => {
|
||||||
classes.iter().any(|ptr| name == WeakAtom::new(*ptr))
|
classes.iter().any(|ptr| &**name == WeakAtom::new(*ptr))
|
||||||
}
|
}
|
||||||
CaseSensitivity::AsciiCaseInsensitive => {
|
CaseSensitivity::AsciiCaseInsensitive => {
|
||||||
classes.iter().any(|ptr| name.eq_ignore_ascii_case(WeakAtom::new(*ptr)))
|
classes.iter().any(|ptr| name.eq_ignore_ascii_case(WeakAtom::new(*ptr)))
|
||||||
|
|
|
@ -2191,7 +2191,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline(always)]
|
||||||
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||||
if !self.may_have_class() {
|
if !self.may_have_class() {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue