mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Move Event States to |Element|.
Conceptually they belong there, rather than on |Node|. Fixes #7934.
This commit is contained in:
parent
628c2a0432
commit
75ec093334
14 changed files with 251 additions and 262 deletions
|
@ -5,16 +5,16 @@
|
|||
use dom::attr::Attr;
|
||||
use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding::HTMLFieldSetElementMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{ElementTypeId, HTMLElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, ElementTypeId, HTMLElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLLegendElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, NodeTypeId};
|
||||
use dom::bindings::js::{Root, RootedReference};
|
||||
use dom::document::Document;
|
||||
use dom::element::{AttributeMutation, Element};
|
||||
use dom::element::{AttributeMutation, Element, IN_ENABLED_STATE};
|
||||
use dom::htmlcollection::{CollectionFilter, HTMLCollection};
|
||||
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 util::str::{DOMString, StaticStringVec};
|
||||
|
@ -30,7 +30,7 @@ impl HTMLFieldSetElement {
|
|||
document: &Document) -> HTMLFieldSetElement {
|
||||
HTMLFieldSetElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
localName, prefix, document)
|
||||
}
|
||||
}
|
||||
|
@ -99,8 +99,9 @@ impl VirtualMethods for HTMLFieldSetElement {
|
|||
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 mut found_legend = false;
|
||||
let children = node.children().filter(|node| {
|
||||
if found_legend {
|
||||
|
@ -135,13 +136,15 @@ impl VirtualMethods for HTMLFieldSetElement {
|
|||
});
|
||||
if disabled_state {
|
||||
for field in fields {
|
||||
field.set_disabled_state(true);
|
||||
field.set_enabled_state(false);
|
||||
let el = ElementCast::to_ref(field.r()).unwrap();
|
||||
el.set_disabled_state(true);
|
||||
el.set_enabled_state(false);
|
||||
}
|
||||
} else {
|
||||
for field in fields {
|
||||
field.check_disabled_attribute();
|
||||
field.check_ancestors_disabled_state_for_form_control();
|
||||
let el = ElementCast::to_ref(field.r()).unwrap();
|
||||
el.check_disabled_attribute();
|
||||
el.check_ancestors_disabled_state_for_form_control();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue