mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
selectors: Remove the get_ prefix from get_local_name and get_namespace.
This commit is contained in:
parent
da99f159f4
commit
7ab4b21bc3
12 changed files with 60 additions and 55 deletions
|
@ -692,12 +692,12 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_local_name(&self) -> &LocalName {
|
||||
fn local_name(&self) -> &LocalName {
|
||||
self.element.local_name()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_namespace(&self) -> &Namespace {
|
||||
fn namespace(&self) -> &Namespace {
|
||||
self.element.namespace()
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
|
|||
fn is_html_slot_element(&self) -> bool {
|
||||
unsafe {
|
||||
self.element.is_html_element() &&
|
||||
self.get_local_name() == &local_name!("slot")
|
||||
self.local_name() == &local_name!("slot")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1025,8 +1025,8 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
|
|||
loop {
|
||||
let next_node = if let Some(ref node) = current_node {
|
||||
if let Some(element) = node.as_element() {
|
||||
if element.get_local_name() == &local_name!("summary") &&
|
||||
element.get_namespace() == &ns!(html) {
|
||||
if element.local_name() == &local_name!("summary") &&
|
||||
element.namespace() == &ns!(html) {
|
||||
self.current_node = None;
|
||||
return Some(node.clone());
|
||||
}
|
||||
|
@ -1044,8 +1044,8 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
|
|||
let node = self.current_node.clone();
|
||||
let node = node.and_then(|node| {
|
||||
if node.is_element() &&
|
||||
node.as_element().unwrap().get_local_name() == &local_name!("summary") &&
|
||||
node.as_element().unwrap().get_namespace() == &ns!(html) {
|
||||
node.as_element().unwrap().local_name() == &local_name!("summary") &&
|
||||
node.as_element().unwrap().namespace() == &ns!(html) {
|
||||
unsafe { node.dangerous_next_sibling() }
|
||||
} else {
|
||||
Some(node)
|
||||
|
@ -1193,13 +1193,13 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_local_name(&self) -> &LocalName {
|
||||
self.element.get_local_name()
|
||||
fn local_name(&self) -> &LocalName {
|
||||
self.element.local_name()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_namespace(&self) -> &Namespace {
|
||||
self.element.get_namespace()
|
||||
fn namespace(&self) -> &Namespace {
|
||||
self.element.namespace()
|
||||
}
|
||||
|
||||
fn match_pseudo_element(
|
||||
|
|
|
@ -2628,12 +2628,12 @@ impl<'a> SelectorsElement for DomRoot<Element> {
|
|||
})
|
||||
}
|
||||
|
||||
fn get_local_name(&self) -> &LocalName {
|
||||
self.local_name()
|
||||
fn local_name(&self) -> &LocalName {
|
||||
Element::local_name(self)
|
||||
}
|
||||
|
||||
fn get_namespace(&self) -> &Namespace {
|
||||
self.namespace()
|
||||
fn namespace(&self) -> &Namespace {
|
||||
Element::namespace(self)
|
||||
}
|
||||
|
||||
fn match_non_ts_pseudo_class<F>(
|
||||
|
|
|
@ -347,8 +347,8 @@ pub trait ThreadSafeLayoutElement
|
|||
|
||||
#[inline]
|
||||
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
||||
if self.get_local_name() == &local_name!("details") &&
|
||||
self.get_namespace() == &ns!(html) {
|
||||
if self.local_name() == &local_name!("details") &&
|
||||
self.namespace() == &ns!(html) {
|
||||
Some(self.with_pseudo(PseudoElementType::DetailsSummary))
|
||||
} else {
|
||||
None
|
||||
|
@ -357,8 +357,8 @@ pub trait ThreadSafeLayoutElement
|
|||
|
||||
#[inline]
|
||||
fn get_details_content_pseudo(&self) -> Option<Self> {
|
||||
if self.get_local_name() == &local_name!("details") &&
|
||||
self.get_namespace() == &ns!(html) &&
|
||||
if self.local_name() == &local_name!("details") &&
|
||||
self.namespace() == &ns!(html) &&
|
||||
self.get_attr(&ns!(), &local_name!("open")).is_some() {
|
||||
Some(self.with_pseudo(PseudoElementType::DetailsContent))
|
||||
} else {
|
||||
|
|
|
@ -553,7 +553,7 @@ where
|
|||
&local_name.name,
|
||||
&local_name.lower_name
|
||||
).borrow();
|
||||
element.get_local_name() == name
|
||||
element.local_name() == name
|
||||
}
|
||||
|
||||
/// Determines whether the given element matches the given compound selector.
|
||||
|
@ -655,11 +655,11 @@ where
|
|||
}
|
||||
Component::Namespace(_, ref url) |
|
||||
Component::DefaultNamespace(ref url) => {
|
||||
element.get_namespace() == url.borrow()
|
||||
element.namespace() == url.borrow()
|
||||
}
|
||||
Component::ExplicitNoNamespace => {
|
||||
let ns = ::parser::namespace_empty_string::<E::Impl>();
|
||||
element.get_namespace() == ns.borrow()
|
||||
element.namespace() == ns.borrow()
|
||||
}
|
||||
Component::ID(ref id) => {
|
||||
element.has_id(id, context.shared.classes_and_ids_case_sensitivity())
|
||||
|
@ -860,8 +860,8 @@ where
|
|||
|
||||
#[inline]
|
||||
fn same_type<E: Element>(a: &E, b: &E) -> bool {
|
||||
a.get_local_name() == b.get_local_name() &&
|
||||
a.get_namespace() == b.get_namespace()
|
||||
a.local_name() == b.local_name() &&
|
||||
a.namespace() == b.namespace()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -53,10 +53,10 @@ pub trait Element: Sized + Clone + Debug {
|
|||
|
||||
fn is_html_element_in_html_document(&self) -> bool;
|
||||
|
||||
fn get_local_name(&self) -> &<Self::Impl as SelectorImpl>::BorrowedLocalName;
|
||||
fn local_name(&self) -> &<Self::Impl as SelectorImpl>::BorrowedLocalName;
|
||||
|
||||
/// Empty string for no namespace
|
||||
fn get_namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl;
|
||||
fn namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl;
|
||||
|
||||
fn attr_matches(&self,
|
||||
ns: &NamespaceConstraint<&<Self::Impl as SelectorImpl>::NamespaceUrl>,
|
||||
|
|
|
@ -98,8 +98,8 @@ where
|
|||
E: TElement,
|
||||
F: FnMut(u32),
|
||||
{
|
||||
f(element.get_local_name().get_hash());
|
||||
f(element.get_namespace().get_hash());
|
||||
f(element.local_name().get_hash());
|
||||
f(element.namespace().get_hash());
|
||||
|
||||
if let Some(id) = element.get_id() {
|
||||
f(id.get_hash());
|
||||
|
|
|
@ -349,9 +349,9 @@ where
|
|||
Component::LocalName(LocalName { ref name, ref lower_name }) => {
|
||||
collect_all_elements::<E, Q, _>(root, results, |element| {
|
||||
if element.is_html_element_in_html_document() {
|
||||
element.get_local_name() == lower_name.borrow()
|
||||
element.local_name() == lower_name.borrow()
|
||||
} else {
|
||||
element.get_local_name() == name.borrow()
|
||||
element.local_name() == name.borrow()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@ pub struct GeckoElement<'le>(pub &'le RawGeckoElement);
|
|||
|
||||
impl<'le> fmt::Debug for GeckoElement<'le> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "<{}", self.get_local_name())?;
|
||||
write!(f, "<{}", self.local_name())?;
|
||||
if let Some(id) = self.get_id() {
|
||||
write!(f, " id={}", id)?;
|
||||
}
|
||||
|
@ -1621,7 +1621,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
fn is_html_document_body_element(&self) -> bool {
|
||||
if self.get_local_name() != &*local_name!("body") {
|
||||
if self.local_name() != &*local_name!("body") {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1687,15 +1687,15 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
let ns = self.namespace_id();
|
||||
// <th> elements get a default MozCenterOrInherit which may get overridden
|
||||
if ns == structs::kNameSpaceID_XHTML as i32 {
|
||||
if self.get_local_name().as_ptr() == atom!("th").as_ptr() {
|
||||
if self.local_name().as_ptr() == atom!("th").as_ptr() {
|
||||
hints.push(TH_RULE.clone());
|
||||
} else if self.get_local_name().as_ptr() == atom!("table").as_ptr() &&
|
||||
} else if self.local_name().as_ptr() == atom!("table").as_ptr() &&
|
||||
self.as_node().owner_doc().quirks_mode() == QuirksMode::Quirks {
|
||||
hints.push(TABLE_COLOR_RULE.clone());
|
||||
}
|
||||
}
|
||||
if ns == structs::kNameSpaceID_SVG as i32 {
|
||||
if self.get_local_name().as_ptr() == atom!("text").as_ptr() {
|
||||
if self.local_name().as_ptr() == atom!("text").as_ptr() {
|
||||
hints.push(SVG_TEXT_DISABLE_ZOOM_RULE.clone());
|
||||
}
|
||||
}
|
||||
|
@ -1772,7 +1772,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
// MathML's default lang has precedence over both `lang` and `xml:lang`
|
||||
if ns == structs::kNameSpaceID_MathML as i32 {
|
||||
if self.get_local_name().as_ptr() == atom!("math").as_ptr() {
|
||||
if self.local_name().as_ptr() == atom!("math").as_ptr() {
|
||||
hints.push(MATHML_LANG_RULE.clone());
|
||||
}
|
||||
}
|
||||
|
@ -1965,14 +1965,14 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_local_name(&self) -> &WeakAtom {
|
||||
fn local_name(&self) -> &WeakAtom {
|
||||
unsafe {
|
||||
WeakAtom::new(self.as_node().node_info().mInner.mName)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_namespace(&self) -> &WeakNamespace {
|
||||
fn namespace(&self) -> &WeakNamespace {
|
||||
unsafe {
|
||||
let namespace_manager = structs::nsContentUtils_sNameSpaceManager;
|
||||
WeakNamespace::new((*namespace_manager).mURIArray[self.namespace_id() as usize].mRawPtr)
|
||||
|
@ -2198,7 +2198,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
#[inline]
|
||||
fn is_html_slot_element(&self) -> bool {
|
||||
self.is_html_element() &&
|
||||
self.get_local_name().as_ptr() == local_name!("slot").as_ptr()
|
||||
self.local_name().as_ptr() == local_name!("slot").as_ptr()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -2217,8 +2217,8 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
// If this element is the shadow root of an use-element shadow
|
||||
// tree, according to the spec, we should not match rules
|
||||
// cross the shadow DOM boundary.
|
||||
e.get_local_name() == &*local_name!("use") &&
|
||||
e.get_namespace() == &*ns!("http://www.w3.org/2000/svg")
|
||||
e.local_name() == &*local_name!("use") &&
|
||||
e.namespace() == &*ns!("http://www.w3.org/2000/svg")
|
||||
},
|
||||
None => false,
|
||||
}
|
||||
|
|
|
@ -291,27 +291,32 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
|||
.map(|e| ElementWrapper::new(e, self.snapshot_map))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_html_element_in_html_document(&self) -> bool {
|
||||
self.element.is_html_element_in_html_document()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_html_slot_element(&self) -> bool {
|
||||
self.element.is_html_slot_element()
|
||||
}
|
||||
|
||||
fn get_local_name(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedLocalName {
|
||||
self.element.get_local_name()
|
||||
#[inline]
|
||||
fn local_name(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedLocalName {
|
||||
self.element.local_name()
|
||||
}
|
||||
|
||||
fn get_namespace(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedNamespaceUrl {
|
||||
self.element.get_namespace()
|
||||
#[inline]
|
||||
fn namespace(&self) -> &<Self::Impl as ::selectors::SelectorImpl>::BorrowedNamespaceUrl {
|
||||
self.element.namespace()
|
||||
}
|
||||
|
||||
fn attr_matches(&self,
|
||||
fn attr_matches(
|
||||
&self,
|
||||
ns: &NamespaceConstraint<&Namespace>,
|
||||
local_name: &LocalName,
|
||||
operation: &AttrSelectorOperation<&AttrValue>)
|
||||
-> bool {
|
||||
operation: &AttrSelectorOperation<&AttrValue>,
|
||||
) -> bool {
|
||||
match self.snapshot() {
|
||||
Some(snapshot) if snapshot.has_attrs() => {
|
||||
snapshot.attr_matches(ns, local_name, operation)
|
||||
|
|
|
@ -84,7 +84,7 @@ impl Invalidation {
|
|||
// This could look at the quirks mode of the document, instead
|
||||
// of testing against both names, but it's probably not worth
|
||||
// it.
|
||||
let local_name = element.get_local_name();
|
||||
let local_name = element.local_name();
|
||||
return *local_name == **name || *local_name == **lower_name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ impl SelectorMap<Rule> {
|
|||
}
|
||||
});
|
||||
|
||||
if let Some(rules) = self.local_name_hash.get(rule_hash_target.get_local_name()) {
|
||||
if let Some(rules) = self.local_name_hash.get(rule_hash_target.local_name()) {
|
||||
SelectorMap::get_matching_rules(
|
||||
element,
|
||||
rules,
|
||||
|
@ -344,7 +344,7 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
|||
}
|
||||
|
||||
// Local name.
|
||||
if let Some(v) = self.local_name_hash.get(element.get_local_name()) {
|
||||
if let Some(v) = self.local_name_hash.get(element.local_name()) {
|
||||
for entry in v.iter() {
|
||||
if !f(&entry) {
|
||||
return false;
|
||||
|
|
|
@ -676,12 +676,12 @@ impl<E: TElement> StyleSharingCache<E> {
|
|||
return None;
|
||||
}
|
||||
|
||||
if *target.get_local_name() != *candidate.element.get_local_name() {
|
||||
if *target.local_name() != *candidate.element.local_name() {
|
||||
trace!("Miss: Local Name");
|
||||
return None;
|
||||
}
|
||||
|
||||
if *target.get_namespace() != *candidate.element.get_namespace() {
|
||||
if *target.namespace() != *candidate.element.namespace() {
|
||||
trace!("Miss: Namespace");
|
||||
return None;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue