mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Do not use borrowed types in the selectors::Element trait.
Closes #22972 Closes #23463
This commit is contained in:
parent
2e5078e9c5
commit
6f1df517e0
8 changed files with 100 additions and 42 deletions
|
@ -596,7 +596,7 @@ where
|
|||
&local_name.lower_name,
|
||||
)
|
||||
.borrow();
|
||||
element.local_name() == name
|
||||
element.has_local_name(name)
|
||||
}
|
||||
|
||||
/// Determines whether the given element matches the given compound selector.
|
||||
|
@ -681,11 +681,11 @@ where
|
|||
Component::LocalName(ref local_name) => matches_local_name(element, local_name),
|
||||
Component::ExplicitUniversalType | Component::ExplicitAnyNamespace => true,
|
||||
Component::Namespace(_, ref url) | Component::DefaultNamespace(ref url) => {
|
||||
element.namespace() == url.borrow()
|
||||
element.has_namespace(&url.borrow())
|
||||
},
|
||||
Component::ExplicitNoNamespace => {
|
||||
let ns = crate::parser::namespace_empty_string::<E::Impl>();
|
||||
element.namespace() == ns.borrow()
|
||||
element.has_namespace(&ns.borrow())
|
||||
},
|
||||
Component::ID(ref id) => {
|
||||
element.has_id(id, context.shared.classes_and_ids_case_sensitivity())
|
||||
|
@ -897,11 +897,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn same_type<E: Element>(a: &E, b: &E) -> bool {
|
||||
a.local_name() == b.local_name() && a.namespace() == b.namespace()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn nth_child_index<E>(
|
||||
element: &E,
|
||||
|
@ -924,7 +919,7 @@ where
|
|||
let mut curr = element.clone();
|
||||
while let Some(e) = curr.prev_sibling_element() {
|
||||
curr = e;
|
||||
if !is_of_type || same_type(element, &curr) {
|
||||
if !is_of_type || element.is_same_type(&curr) {
|
||||
if let Some(i) = c.lookup(curr.opaque()) {
|
||||
return i - index;
|
||||
}
|
||||
|
@ -945,7 +940,7 @@ where
|
|||
};
|
||||
while let Some(e) = next(curr) {
|
||||
curr = e;
|
||||
if !is_of_type || same_type(element, &curr) {
|
||||
if !is_of_type || element.is_same_type(&curr) {
|
||||
// If we're computing indices from the left, check each element in the
|
||||
// cache. We handle the indices-from-the-right case at the top of this
|
||||
// function.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue