diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-09-28 01:07:32 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-10-15 17:30:41 +0200 |
commit | 7d6ea834790445d2ea71ca186484ef59ac2ac268 (patch) | |
tree | f535bc5428961c332e4ffc3e9c948d180817922e /components/script/dom/htmlelement.rs | |
parent | 617fc08783d2356e644266d9e9addcd720a7138a (diff) | |
download | servo-7d6ea834790445d2ea71ca186484ef59ac2ac268.tar.gz servo-7d6ea834790445d2ea71ca186484ef59ac2ac268.zip |
Explicitly customise flags of new nodes where needed
Given codegen now generates the various TypeId enums, it seems pointless to
still have to write their respective values in every DOM struct inheriting from
Node just to set the initial IS_IN_DOC flag in Document and IN_ENABLED_STATE in
form controls.
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 01a6856e066..48154d25042 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -22,7 +22,8 @@ use dom::document::Document; use dom::domstringmap::DOMStringMap; use dom::element::{AttributeMutation, Element}; use dom::htmlinputelement::HTMLInputElement; -use dom::node::{Node, SEQUENTIALLY_FOCUSABLE, document_from_node, window_from_node}; +use dom::node::{Node, NodeFlags, SEQUENTIALLY_FOCUSABLE}; +use dom::node::{document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::FocusType; use std::borrow::ToOwned; @@ -46,13 +47,17 @@ impl PartialEq for HTMLElement { } impl HTMLElement { - pub fn new_inherited(type_id: HTMLElementTypeId, - tag_name: DOMString, - prefix: Option<DOMString>, + pub fn new_inherited(tag_name: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLElement { + HTMLElement::new_inherited_with_flags(NodeFlags::new(), tag_name, prefix, document) + } + + pub fn new_inherited_with_flags(flags: NodeFlags, tag_name: DOMString, + prefix: Option<DOMString>, document: &Document) + -> HTMLElement { HTMLElement { element: - Element::new_inherited(ElementTypeId::HTMLElement(type_id), tag_name, ns!(HTML), prefix, document), + Element::new_inherited_with_flags(flags, tag_name, ns!(HTML), prefix, document), style_decl: Default::default(), dataset: Default::default(), } @@ -60,7 +65,7 @@ impl HTMLElement { #[allow(unrooted_must_root)] pub fn new(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> Root<HTMLElement> { - let element = HTMLElement::new_inherited(HTMLElementTypeId::HTMLElement, localName, prefix, document); + let element = HTMLElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLElementBinding::Wrap) } |