style: Do not use borrowed types in the selectors::Element trait.

Closes #22972
Closes #23463
This commit is contained in:
Evgeniy Reizner 2019-05-26 19:10:24 +03:00 committed by Emilio Cobos Álvarez
parent 2e5078e9c5
commit 6f1df517e0
8 changed files with 100 additions and 42 deletions

View file

@ -1166,6 +1166,19 @@ impl<'le> TElement for GeckoElement<'le> {
self.namespace_id() == structs::root::kNameSpaceID_XUL as i32
}
#[inline]
fn local_name(&self) -> &WeakAtom {
unsafe { WeakAtom::new(self.as_node().node_info().mInner.mName) }
}
#[inline]
fn namespace(&self) -> &WeakNamespace {
unsafe {
let namespace_manager = structs::nsContentUtils_sNameSpaceManager;
WeakNamespace::new((*namespace_manager).mURIArray[self.namespace_id() as usize].mRawPtr)
}
}
/// Return the list of slotted nodes of this node.
#[inline]
fn slotted_nodes(&self) -> &[Self::ConcreteNode] {
@ -2071,16 +2084,18 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
}
#[inline]
fn local_name(&self) -> &WeakAtom {
unsafe { WeakAtom::new(self.as_node().node_info().mInner.mName) }
fn has_local_name(&self, name: &WeakAtom) -> bool {
self.local_name() == name
}
#[inline]
fn namespace(&self) -> &WeakNamespace {
unsafe {
let namespace_manager = structs::nsContentUtils_sNameSpaceManager;
WeakNamespace::new((*namespace_manager).mURIArray[self.namespace_id() as usize].mRawPtr)
}
fn has_namespace(&self, ns: &WeakNamespace) -> bool {
self.namespace() == ns
}
#[inline]
fn is_same_type(&self, other: &Self) -> bool {
self.local_name() == other.local_name() && self.namespace() == other.namespace()
}
fn match_non_ts_pseudo_class<F>(