mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #23503 - emilio:gecko-sync, r=emilio
style: sync changes from mozilla-central See each individual commit for details. This also cherry-picks #23463 with a few fixes that were needed in Gecko-only code. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23503) <!-- Reviewable:end -->
This commit is contained in:
commit
fe8aad7227
47 changed files with 897 additions and 915 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.
|
||||
|
|
|
@ -62,10 +62,13 @@ pub trait Element: Sized + Clone + Debug {
|
|||
|
||||
fn is_html_element_in_html_document(&self) -> bool;
|
||||
|
||||
fn local_name(&self) -> &<Self::Impl as SelectorImpl>::BorrowedLocalName;
|
||||
fn has_local_name(&self, local_name: &<Self::Impl as SelectorImpl>::BorrowedLocalName) -> bool;
|
||||
|
||||
/// Empty string for no namespace
|
||||
fn namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl;
|
||||
fn has_namespace(&self, ns: &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl) -> bool;
|
||||
|
||||
/// Whether this element and the `other` element have the same local name and namespace.
|
||||
fn is_same_type(&self, other: &Self) -> bool;
|
||||
|
||||
fn attr_matches(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue