diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2015-10-07 20:02:00 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2015-10-16 17:56:31 -0700 |
commit | 75ec093334ff8f8f7ef41b90007588b924c40731 (patch) | |
tree | ba73c6dc51812c01f118e63c90ede1d8638f060d /components/script/dom/htmlselectelement.rs | |
parent | 628c2a04326b27ac2743771dca52612c8ce30ad2 (diff) | |
download | servo-75ec093334ff8f8f7ef41b90007588b924c40731.tar.gz servo-75ec093334ff8f8f7ef41b90007588b924c40731.zip |
Move Event States to |Element|.
Conceptually they belong there, rather than on |Node|.
Fixes #7934.
Diffstat (limited to 'components/script/dom/htmlselectelement.rs')
-rw-r--r-- | components/script/dom/htmlselectelement.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 33a46acace1..878bfe2538c 100644 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -5,15 +5,15 @@ use dom::attr::{Attr, AttrValue}; use dom::bindings::codegen::Bindings::HTMLSelectElementBinding; use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods; -use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLFieldSetElementDerived, NodeCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLFieldSetElementDerived, NodeCast}; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; use dom::bindings::js::Root; use dom::document::Document; -use dom::element::AttributeMutation; +use dom::element::{AttributeMutation, IN_ENABLED_STATE}; use dom::htmlelement::HTMLElement; use dom::htmlformelement::{FormControl, HTMLFormElement}; -use dom::node::{IN_ENABLED_STATE, Node, NodeFlags, window_from_node}; +use dom::node::{Node, window_from_node}; use dom::validitystate::ValidityState; use dom::virtualmethods::VirtualMethods; use std::borrow::ToOwned; @@ -33,7 +33,7 @@ impl HTMLSelectElement { document: &Document) -> HTMLSelectElement { HTMLSelectElement { htmlelement: - HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE, + HTMLElement::new_inherited_with_state(IN_ENABLED_STATE, localName, prefix, document) } } @@ -107,16 +107,16 @@ impl VirtualMethods for HTMLSelectElement { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { self.super_type().unwrap().attribute_mutated(attr, mutation); if attr.local_name() == &atom!(disabled) { - let node = NodeCast::from_ref(self); + let el = ElementCast::from_ref(self); match mutation { AttributeMutation::Set(_) => { - node.set_disabled_state(true); - node.set_enabled_state(false); + el.set_disabled_state(true); + el.set_enabled_state(false); }, AttributeMutation::Removed => { - node.set_disabled_state(false); - node.set_enabled_state(true); - node.check_ancestors_disabled_state_for_form_control(); + el.set_disabled_state(false); + el.set_enabled_state(true); + el.check_ancestors_disabled_state_for_form_control(); } } } @@ -127,8 +127,8 @@ impl VirtualMethods for HTMLSelectElement { s.bind_to_tree(tree_in_doc); } - let node = NodeCast::from_ref(self); - node.check_ancestors_disabled_state_for_form_control(); + let el = ElementCast::from_ref(self); + el.check_ancestors_disabled_state_for_form_control(); } fn unbind_from_tree(&self, tree_in_doc: bool) { @@ -137,10 +137,11 @@ impl VirtualMethods for HTMLSelectElement { } let node = NodeCast::from_ref(self); + let el = ElementCast::from_ref(self); if node.ancestors().any(|ancestor| ancestor.r().is_htmlfieldsetelement()) { - node.check_ancestors_disabled_state_for_form_control(); + el.check_ancestors_disabled_state_for_form_control(); } else { - node.check_disabled_attribute(); + el.check_disabled_attribute(); } } |