diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index f10c04ab828..ad68be7175f 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -903,7 +903,7 @@ impl Document { for element in new_target.upcast::() .inclusive_ancestors() .filter_map(Root::downcast::) { - if element.get_hover_state() { + if element.hover_state() { break; } @@ -1774,7 +1774,7 @@ impl Document { let mut map = self.modified_elements.borrow_mut(); let snapshot = map.entry(JS::from_ref(el)).or_insert(ElementSnapshot::new()); if snapshot.state.is_none() { - snapshot.state = Some(el.get_state()); + snapshot.state = Some(el.state()); } } @@ -1802,7 +1802,7 @@ impl Element { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) - if self.get_disabled_state() => true, + if self.disabled_state() => true, _ => false, } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 88deaeae4cf..4e2af78f31a 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -791,7 +791,7 @@ impl Element { } } - pub fn get_root_element(&self) -> Root { + pub fn root_element(&self) -> Root { if self.node.is_in_doc() { self.upcast::() .owner_doc() @@ -864,7 +864,7 @@ impl Element { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) => { - self.get_disabled_state() + self.disabled_state() } // TODO: // an optgroup element that has a disabled attribute @@ -1874,7 +1874,7 @@ impl<'a> ::selectors::Element for Root { NonTSPseudoClass::Disabled | NonTSPseudoClass::Checked | NonTSPseudoClass::Indeterminate => - Element::get_state(self).contains(pseudo_class.state_flag()), + Element::state(self).contains(pseudo_class.state_flag()), } } @@ -2077,7 +2077,7 @@ impl Element { self.set_click_in_progress(false); } - pub fn get_state(&self) -> ElementState { + pub fn state(&self) -> ElementState { self.state.get() } @@ -2096,7 +2096,7 @@ impl Element { self.state.set(state); } - pub fn get_active_state(&self) -> bool { + pub fn active_state(&self) -> bool { self.state.get().contains(IN_ACTIVE_STATE) } @@ -2104,7 +2104,7 @@ impl Element { self.set_state(IN_ACTIVE_STATE, value) } - pub fn get_focus_state(&self) -> bool { + pub fn focus_state(&self) -> bool { self.state.get().contains(IN_FOCUS_STATE) } @@ -2113,7 +2113,7 @@ impl Element { self.upcast::().dirty(NodeDamage::OtherNodeDamage); } - pub fn get_hover_state(&self) -> bool { + pub fn hover_state(&self) -> bool { self.state.get().contains(IN_HOVER_STATE) } @@ -2121,7 +2121,7 @@ impl Element { self.set_state(IN_HOVER_STATE, value) } - pub fn get_enabled_state(&self) -> bool { + pub fn enabled_state(&self) -> bool { self.state.get().contains(IN_ENABLED_STATE) } @@ -2129,7 +2129,7 @@ impl Element { self.set_state(IN_ENABLED_STATE, value) } - pub fn get_disabled_state(&self) -> bool { + pub fn disabled_state(&self) -> bool { self.state.get().contains(IN_DISABLED_STATE) } @@ -2141,7 +2141,7 @@ impl Element { impl Element { pub fn check_ancestors_disabled_state_for_form_control(&self) { let node = self.upcast::(); - if self.get_disabled_state() { + if self.disabled_state() { return; } for ancestor in node.ancestors() { @@ -2150,7 +2150,7 @@ impl Element { if !ancestor.is::() { continue; } - if !ancestor.downcast::().unwrap().get_disabled_state() { + if !ancestor.downcast::().unwrap().disabled_state() { continue; } if ancestor.is_parent_of(node) { @@ -2175,13 +2175,13 @@ impl Element { } pub fn check_parent_disabled_state_for_option(&self) { - if self.get_disabled_state() { + if self.disabled_state() { return; } let node = self.upcast::(); if let Some(ref parent) = node.GetParentNode() { if parent.is::() && - parent.downcast::().unwrap().get_disabled_state() { + parent.downcast::().unwrap().disabled_state() { self.set_disabled_state(true); self.set_enabled_state(false); } diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 342d4173343..22fed30a2df 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -213,7 +213,7 @@ impl Activatable for HTMLButtonElement { fn is_instance_activatable(&self) -> bool { //https://html.spec.whatwg.org/multipage/#the-button-element - !self.upcast::().get_disabled_state() + !self.upcast::().disabled_state() } // https://html.spec.whatwg.org/multipage/#run-pre-click-activation-steps diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index aa2ee98ad1f..b3c95f89127 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -200,7 +200,7 @@ impl HTMLElementMethods for HTMLElement { // https://html.spec.whatwg.org/multipage/#dom-click fn Click(&self) { - if !self.upcast::().get_disabled_state() { + if !self.upcast::().disabled_state() { synthetic_click_activation(self.upcast::(), false, false, @@ -223,7 +223,7 @@ impl HTMLElementMethods for HTMLElement { // https://html.spec.whatwg.org/multipage/#dom-blur fn Blur(&self) { // TODO: Run the unfocusing steps. - if !self.upcast::().get_focus_state() { + if !self.upcast::().focus_state() { return; } // https://html.spec.whatwg.org/multipage/#unfocusing-steps @@ -449,7 +449,7 @@ impl HTMLElement { }; // Traverse entire tree for