diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index a909ce72e8f..a8d454ec654 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -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 Iterator for ThreadSafeLayoutNodeChildrenIterator Iterator for ThreadSafeLayoutNodeChildrenIterator ::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( diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 9c88c1391fd..c8407c3277f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -2628,12 +2628,12 @@ impl<'a> SelectorsElement for DomRoot { }) } - 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( diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index a3365c3c6e5..a23a417cb6d 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -347,8 +347,8 @@ pub trait ThreadSafeLayoutElement #[inline] fn get_details_summary_pseudo(&self) -> Option { - 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 { - 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 { diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs index a8bf3f689f9..849edf74a09 100644 --- a/components/selectors/matching.rs +++ b/components/selectors/matching.rs @@ -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::(); - 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(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] diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs index 0b0f65de073..ae4ec41d4f5 100644 --- a/components/selectors/tree.rs +++ b/components/selectors/tree.rs @@ -53,10 +53,10 @@ pub trait Element: Sized + Clone + Debug { fn is_html_element_in_html_document(&self) -> bool; - fn get_local_name(&self) -> &::BorrowedLocalName; + fn local_name(&self) -> &::BorrowedLocalName; /// Empty string for no namespace - fn get_namespace(&self) -> &::BorrowedNamespaceUrl; + fn namespace(&self) -> &::BorrowedNamespaceUrl; fn attr_matches(&self, ns: &NamespaceConstraint<&::NamespaceUrl>, diff --git a/components/style/bloom.rs b/components/style/bloom.rs index 2e85c61ff73..eaffd22fd01 100644 --- a/components/style/bloom.rs +++ b/components/style/bloom.rs @@ -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()); diff --git a/components/style/dom_apis.rs b/components/style/dom_apis.rs index c1c5c989193..1a775853f90 100644 --- a/components/style/dom_apis.rs +++ b/components/style/dom_apis.rs @@ -349,9 +349,9 @@ where Component::LocalName(LocalName { ref name, ref lower_name }) => { collect_all_elements::(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() } }) } diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 5fd26382cb9..c768ed0207f 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -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(); // 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, } diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs index 2fb0a4f8412..3354d60f6f2 100644 --- a/components/style/invalidation/element/element_wrapper.rs +++ b/components/style/invalidation/element/element_wrapper.rs @@ -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) -> &::BorrowedLocalName { - self.element.get_local_name() + #[inline] + fn local_name(&self) -> &::BorrowedLocalName { + self.element.local_name() } - fn get_namespace(&self) -> &::BorrowedNamespaceUrl { - self.element.get_namespace() + #[inline] + fn namespace(&self) -> &::BorrowedNamespaceUrl { + self.element.namespace() } - fn attr_matches(&self, - ns: &NamespaceConstraint<&Namespace>, - local_name: &LocalName, - operation: &AttrSelectorOperation<&AttrValue>) - -> bool { + fn attr_matches( + &self, + ns: &NamespaceConstraint<&Namespace>, + local_name: &LocalName, + operation: &AttrSelectorOperation<&AttrValue>, + ) -> bool { match self.snapshot() { Some(snapshot) if snapshot.has_attrs() => { snapshot.attr_matches(ns, local_name, operation) diff --git a/components/style/invalidation/stylesheets.rs b/components/style/invalidation/stylesheets.rs index 2b511ea1569..091206bbcdd 100644 --- a/components/style/invalidation/stylesheets.rs +++ b/components/style/invalidation/stylesheets.rs @@ -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 } } diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index b10a54f8124..88b23d71967 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -201,7 +201,7 @@ impl SelectorMap { } }); - 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 SelectorMap { } // 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; diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index 729a8592187..4220d88fa0e 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -676,12 +676,12 @@ impl StyleSharingCache { 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; }