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/htmloptgroupelement.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/htmloptgroupelement.rs')
-rw-r--r-- | components/script/dom/htmloptgroupelement.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index b90eacff87f..cabb19936ab 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -5,12 +5,13 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods; -use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLOptionElementDerived, NodeCast}; +use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLOptionElementCast}; +use dom::bindings::codegen::InheritTypes::{HTMLOptionElementDerived, NodeCast}; 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::node::{IN_ENABLED_STATE, Node, NodeFlags}; +use dom::node::{Node}; use dom::virtualmethods::VirtualMethods; use util::str::DOMString; @@ -25,7 +26,7 @@ impl HTMLOptGroupElement { document: &Document) -> HTMLOptGroupElement { HTMLOptGroupElement { htmlelement: - HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE, + HTMLElement::new_inherited_with_state(IN_ENABLED_STATE, localName, prefix, document) } } @@ -66,19 +67,22 @@ impl VirtualMethods for HTMLOptGroupElement { AttributeMutation::Removed => false, }; let node = NodeCast::from_ref(self); - node.set_disabled_state(disabled_state); - node.set_enabled_state(!disabled_state); + let el = ElementCast::from_ref(self); + el.set_disabled_state(disabled_state); + el.set_enabled_state(!disabled_state); let options = node.children().filter(|child| { child.is_htmloptionelement() - }); + }).map(|child| Root::from_ref(HTMLOptionElementCast::to_ref(child.r()).unwrap())); if disabled_state { for option in options { - option.set_disabled_state(true); - option.set_enabled_state(false); + let el = ElementCast::from_ref(option.r()); + el.set_disabled_state(true); + el.set_enabled_state(false); } } else { for option in options { - option.check_disabled_attribute(); + let el = ElementCast::from_ref(option.r()); + el.check_disabled_attribute(); } } }, |