diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-02-24 21:25:16 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-02-24 22:45:42 +0100 |
commit | 98c9292ecb8912e51566279e07c0453ace80454b (patch) | |
tree | 84fa3fc8b16d0d710b6c3947080eb15afb58fc8c /components | |
parent | b8fb41da0c7d43ba602a11989334163df307ebd4 (diff) | |
download | servo-98c9292ecb8912e51566279e07c0453ace80454b.tar.gz servo-98c9292ecb8912e51566279e07c0453ace80454b.zip |
style: Remove get_ prefix from get_state and get_id.
Diffstat (limited to 'components')
-rw-r--r-- | components/layout_thread/dom_wrapper.rs | 4 | ||||
-rw-r--r-- | components/style/bloom.rs | 2 | ||||
-rw-r--r-- | components/style/dom.rs | 4 | ||||
-rw-r--r-- | components/style/gecko/wrapper.rs | 24 | ||||
-rw-r--r-- | components/style/invalidation/element/element_wrapper.rs | 4 | ||||
-rw-r--r-- | components/style/invalidation/element/state_and_attributes.rs | 2 | ||||
-rw-r--r-- | components/style/invalidation/stylesheets.rs | 2 | ||||
-rw-r--r-- | components/style/selector_map.rs | 4 | ||||
-rw-r--r-- | components/style/sharing/checks.rs | 4 | ||||
-rw-r--r-- | components/style/sharing/mod.rs | 2 |
10 files changed, 27 insertions, 25 deletions
diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index a8d454ec654..2494f8955f5 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -372,7 +372,7 @@ impl<'le> TElement for ServoLayoutElement<'le> { } } - fn get_state(&self) -> ElementState { + fn state(&self) -> ElementState { self.element.get_state_for_layout() } @@ -382,7 +382,7 @@ impl<'le> TElement for ServoLayoutElement<'le> { } #[inline] - fn get_id(&self) -> Option<Atom> { + fn id(&self) -> Option<Atom> { unsafe { (*self.element.id_attribute()).clone() } diff --git a/components/style/bloom.rs b/components/style/bloom.rs index eaffd22fd01..83063e194c7 100644 --- a/components/style/bloom.rs +++ b/components/style/bloom.rs @@ -101,7 +101,7 @@ where f(element.local_name().get_hash()); f(element.namespace().get_hash()); - if let Some(id) = element.get_id() { + if let Some(id) = element.id() { f(id.get_hash()); } diff --git a/components/style/dom.rs b/components/style/dom.rs index 5aa339bd772..6d307d80845 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -461,13 +461,13 @@ pub trait TElement } /// Get this element's state, for non-tree-structural pseudos. - fn get_state(&self) -> ElementState; + fn state(&self) -> ElementState; /// Whether this element has an attribute with a given namespace. fn has_attr(&self, namespace: &Namespace, attr: &LocalName) -> bool; /// The ID for this element. - fn get_id(&self) -> Option<Atom>; + fn id(&self) -> Option<Atom>; /// Internal iterator for the classes of this element. fn each_class<F>(&self, callback: F) where F: FnMut(&Atom); diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 7508da3a7b8..80772db1caf 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -456,7 +456,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.local_name())?; - if let Some(id) = self.get_id() { + if let Some(id) = self.id() { write!(f, " id={}", id)?; } @@ -645,7 +645,7 @@ impl<'le> GeckoElement<'le> { } #[inline] - fn get_state_internal(&self) -> u64 { + fn state_internal(&self) -> u64 { if !self.as_node().get_bool_flag(nsINode_BooleanFlag::ElementHasLockedStyleStates) { return self.0.mState.mStates; } @@ -1163,8 +1163,8 @@ impl<'le> TElement for GeckoElement<'le> { } #[inline] - fn get_state(&self) -> ElementState { - ElementState::from_bits_truncate(self.get_state_internal()) + fn state(&self) -> ElementState { + ElementState::from_bits_truncate(self.state_internal()) } #[inline] @@ -1174,7 +1174,9 @@ impl<'le> TElement for GeckoElement<'le> { } } - fn get_id(&self) -> Option<Atom> { + // FIXME(emilio): we should probably just return a reference to the Atom. + #[inline] + fn id(&self) -> Option<Atom> { if !self.has_id() { return None; } @@ -1259,7 +1261,7 @@ impl<'le> TElement for GeckoElement<'le> { } fn is_visited_link(&self) -> bool { - self.get_state().intersects(ElementState::IN_VISITED_STATE) + self.state().intersects(ElementState::IN_VISITED_STATE) } #[inline] @@ -1723,7 +1725,7 @@ impl<'le> TElement for GeckoElement<'le> { ); } - let active = self.get_state().intersects(NonTSPseudoClass::Active.state_flag()); + let active = self.state().intersects(NonTSPseudoClass::Active.state_flag()); if active { let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) }; let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> = @@ -2021,7 +2023,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::Active | NonTSPseudoClass::Hover | NonTSPseudoClass::MozAutofillPreview => { - self.get_state().intersects(pseudo_class.state_flag()) + self.state().intersects(pseudo_class.state_flag()) }, NonTSPseudoClass::AnyLink => self.is_link(), NonTSPseudoClass::Link => { @@ -2114,8 +2116,8 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { } NonTSPseudoClass::Dir(ref dir) => { match **dir { - Direction::Ltr => self.get_state().intersects(ElementState::IN_LTR_STATE), - Direction::Rtl => self.get_state().intersects(ElementState::IN_RTL_STATE), + Direction::Ltr => self.state().intersects(ElementState::IN_LTR_STATE), + Direction::Rtl => self.state().intersects(ElementState::IN_RTL_STATE), Direction::Other(..) => false, } } @@ -2138,7 +2140,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { #[inline] fn is_link(&self) -> bool { - self.get_state().intersects(NonTSPseudoClass::AnyLink.state_flag()) + self.state().intersects(NonTSPseudoClass::AnyLink.state_flag()) } #[inline] diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs index 3354d60f6f2..88798f82970 100644 --- a/components/style/invalidation/element/element_wrapper.rs +++ b/components/style/invalidation/element/element_wrapper.rs @@ -109,7 +109,7 @@ where }; match snapshot.state() { - Some(state) => state ^ self.element.get_state(), + Some(state) => state ^ self.element.state(), None => ElementState::empty(), } } @@ -186,7 +186,7 @@ impl<'a, E> Element for ElementWrapper<'a, E> } let state = match self.snapshot().and_then(|s| s.state()) { Some(snapshot_state) => snapshot_state, - None => self.element.get_state(), + None => self.element.state(), }; return state.contains(selector_flag); } diff --git a/components/style/invalidation/element/state_and_attributes.rs b/components/style/invalidation/element/state_and_attributes.rs index f272d22a71d..6d345e06679 100644 --- a/components/style/invalidation/element/state_and_attributes.rs +++ b/components/style/invalidation/element/state_and_attributes.rs @@ -200,7 +200,7 @@ where let mut id_added = None; if snapshot.id_changed() { let old_id = snapshot.id_attr(); - let current_id = element.get_id(); + let current_id = element.id(); if old_id != current_id { id_removed = old_id; diff --git a/components/style/invalidation/stylesheets.rs b/components/style/invalidation/stylesheets.rs index 091206bbcdd..25dcb68e43a 100644 --- a/components/style/invalidation/stylesheets.rs +++ b/components/style/invalidation/stylesheets.rs @@ -66,7 +66,7 @@ impl Invalidation { } } Invalidation::ID(ref id) => { - if let Some(ref element_id) = element.get_id() { + if let Some(ref element_id) = element.id() { if case_sensitivity.eq_atom(element_id, id) { return true; } diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index 88b23d71967..fbec863d598 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -175,7 +175,7 @@ impl SelectorMap<Rule> { // At the end, we're going to sort the rules that we added, so remember // where we began. let init_len = matching_rules_list.len(); - if let Some(id) = rule_hash_target.get_id() { + if let Some(id) = rule_hash_target.id() { if let Some(rules) = self.id_hash.get(&id, quirks_mode) { SelectorMap::get_matching_rules( element, @@ -315,7 +315,7 @@ impl<T: SelectorMapEntry> SelectorMap<T> { F: FnMut(&'a T) -> bool { // Id. - if let Some(id) = element.get_id() { + if let Some(id) = element.id() { if let Some(v) = self.id_hash.get(&id, quirks_mode) { for entry in v.iter() { if !f(&entry) { diff --git a/components/style/sharing/checks.rs b/components/style/sharing/checks.rs index ac434245c69..df467de1197 100644 --- a/components/style/sharing/checks.rs +++ b/components/style/sharing/checks.rs @@ -145,8 +145,8 @@ pub fn may_match_different_id_rules<E>( where E: TElement, { - let element_id = element.get_id(); - let candidate_id = candidate.get_id(); + let element_id = element.id(); + let candidate_id = candidate.id(); if element_id == candidate_id { return false; diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index ab667795a3b..de815d11520 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -700,7 +700,7 @@ impl<E: TElement> StyleSharingCache<E> { // We do not ignore visited state here, because Gecko // needs to store extra bits on visited style contexts, // so these contexts cannot be shared - if target.element.get_state() != candidate.get_state() { + if target.element.state() != candidate.state() { trace!("Miss: User and Author State"); return None; } |