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.
This commit is contained in:
Anthony Ramine 2015-09-28 01:07:32 +02:00
parent 617fc08783
commit 7d6ea83479
79 changed files with 173 additions and 231 deletions

View file

@ -126,8 +126,7 @@ impl LateLintPass for UnrootedPass {
match kind { match kind {
visit::FnKind::ItemFn(n, _, _, _, _, _) | visit::FnKind::ItemFn(n, _, _, _, _, _) |
visit::FnKind::Method(n, _, _) if n.as_str() == "new" visit::FnKind::Method(n, _, _) if n.as_str() == "new"
|| n.as_str() == "new_inherited" || n.as_str().starts_with("new_") => {
|| n.as_str() == "new_initialized" => {
self.in_new_function = true; self.in_new_function = true;
return; return;
}, },

View file

@ -6,8 +6,7 @@
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
use dom::bindings::codegen::InheritTypes::{CharacterDataTypeId, ElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{NodeCast, NodeTypeId};
use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::js::{LayoutJS, Root};
@ -26,9 +25,9 @@ pub struct CharacterData {
} }
impl CharacterData { impl CharacterData {
pub fn new_inherited(id: CharacterDataTypeId, data: DOMString, document: &Document) -> CharacterData { pub fn new_inherited(data: DOMString, document: &Document) -> CharacterData {
CharacterData { CharacterData {
node: Node::new_inherited(NodeTypeId::CharacterData(id), document), node: Node::new_inherited(document),
data: DOMRefCell::new(data), data: DOMRefCell::new(data),
} }
} }

View file

@ -4,7 +4,6 @@
use dom::bindings::codegen::Bindings::CommentBinding; use dom::bindings::codegen::Bindings::CommentBinding;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::CharacterDataTypeId;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::Root; use dom::bindings::js::Root;
@ -22,7 +21,7 @@ pub struct Comment {
impl Comment { impl Comment {
fn new_inherited(text: DOMString, document: &Document) -> Comment { fn new_inherited(text: DOMString, document: &Document) -> Comment {
Comment { Comment {
characterdata: CharacterData::new_inherited(CharacterDataTypeId::Comment, text, document) characterdata: CharacterData::new_inherited(text, document)
} }
} }

View file

@ -1019,7 +1019,7 @@ impl Document {
}; };
Document { Document {
node: Node::new_without_doc(NodeTypeId::Document), node: Node::new_document_node(),
window: JS::from_ref(window), window: JS::from_ref(window),
idmap: DOMRefCell::new(HashMap::new()), idmap: DOMRefCell::new(HashMap::new()),
implementation: Default::default(), implementation: Default::default(),

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::DocumentFragmentBinding; use dom::bindings::codegen::Bindings::DocumentFragmentBinding;
use dom::bindings::codegen::Bindings::DocumentFragmentBinding::DocumentFragmentMethods; use dom::bindings::codegen::Bindings::DocumentFragmentBinding::DocumentFragmentMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast, NodeTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast};
use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
@ -28,7 +28,7 @@ impl DocumentFragment {
/// Creates a new DocumentFragment. /// Creates a new DocumentFragment.
fn new_inherited(document: &Document) -> DocumentFragment { fn new_inherited(document: &Document) -> DocumentFragment {
DocumentFragment { DocumentFragment {
node: Node::new_inherited(NodeTypeId::DocumentFragment, document), node: Node::new_inherited(document),
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::DocumentTypeBinding; use dom::bindings::codegen::Bindings::DocumentTypeBinding;
use dom::bindings::codegen::Bindings::DocumentTypeBinding::DocumentTypeMethods; use dom::bindings::codegen::Bindings::DocumentTypeBinding::DocumentTypeMethods;
use dom::bindings::codegen::InheritTypes::{NodeCast, NodeTypeId}; use dom::bindings::codegen::InheritTypes::NodeCast;
use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::Root; use dom::bindings::js::Root;
@ -30,7 +30,7 @@ impl DocumentType {
document: &Document) document: &Document)
-> DocumentType { -> DocumentType {
DocumentType { DocumentType {
node: Node::new_inherited(NodeTypeId::DocumentType, document), node: Node::new_inherited(document),
name: name, name: name,
public_id: public_id.unwrap_or("".to_owned()), public_id: public_id.unwrap_or("".to_owned()),
system_id: system_id.unwrap_or("".to_owned()) system_id: system_id.unwrap_or("".to_owned())

View file

@ -46,9 +46,9 @@ use dom::htmltablecellelement::HTMLTableCellElementLayoutHelpers;
use dom::htmltableelement::HTMLTableElement; use dom::htmltableelement::HTMLTableElement;
use dom::htmltextareaelement::RawLayoutHTMLTextAreaElementHelpers; use dom::htmltextareaelement::RawLayoutHTMLTextAreaElementHelpers;
use dom::namednodemap::NamedNodeMap; use dom::namednodemap::NamedNodeMap;
use dom::node::{CLICK_IN_PROGRESS, LayoutNodeHelpers, Node, SEQUENTIALLY_FOCUSABLE}; use dom::node::{CLICK_IN_PROGRESS, LayoutNodeHelpers, Node};
use dom::node::{NodeDamage, document_from_node}; use dom::node::{NodeDamage, NodeFlags, SEQUENTIALLY_FOCUSABLE};
use dom::node::{window_from_node}; use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList; use dom::nodelist::NodeList;
use dom::virtualmethods::{VirtualMethods, vtable_for}; use dom::virtualmethods::{VirtualMethods, vtable_for};
use html5ever::serialize; use html5ever::serialize;
@ -111,11 +111,20 @@ impl Element {
create_element(name, prefix, document, creator) create_element(name, prefix, document, creator)
} }
pub fn new_inherited(type_id: ElementTypeId, local_name: DOMString,
pub fn new_inherited(local_name: DOMString,
namespace: Namespace, prefix: Option<DOMString>, namespace: Namespace, prefix: Option<DOMString>,
document: &Document) -> Element { document: &Document) -> Element {
Element::new_inherited_with_flags(NodeFlags::new(), local_name,
namespace, prefix, document)
}
pub fn new_inherited_with_flags(flags: NodeFlags, local_name: DOMString,
namespace: Namespace, prefix: Option<DOMString>,
document: &Document)
-> Element {
Element { Element {
node: Node::new_inherited(NodeTypeId::Element(type_id), document), node: Node::new_inherited_with_flags(flags, document),
local_name: Atom::from_slice(&local_name), local_name: Atom::from_slice(&local_name),
namespace: namespace, namespace: namespace,
prefix: prefix, prefix: prefix,
@ -132,7 +141,7 @@ impl Element {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> Root<Element> { document: &Document) -> Root<Element> {
Node::reflect_node( Node::reflect_node(
box Element::new_inherited(ElementTypeId::Element, local_name, namespace, prefix, document), box Element::new_inherited(local_name, namespace, prefix, document),
document, document,
ElementBinding::Wrap) ElementBinding::Wrap)
} }

View file

@ -11,8 +11,7 @@ use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding::HTMLAnchorElemen
use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLImageElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLImageElementDerived, MouseEventCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{MouseEventCast, NodeCast};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::document::Document; use dom::document::Document;
use dom::domtokenlist::DOMTokenList; use dom::domtokenlist::DOMTokenList;
@ -40,7 +39,7 @@ impl HTMLAnchorElement {
document: &Document) -> HTMLAnchorElement { document: &Document) -> HTMLAnchorElement {
HTMLAnchorElement { HTMLAnchorElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
rel_list: Default::default(), rel_list: Default::default(),
} }
} }

View file

@ -5,7 +5,7 @@
use dom::attr::AttrValue; use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding; use dom::bindings::codegen::Bindings::HTMLAppletElementBinding;
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods; use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::HTMLElementCast;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -25,7 +25,7 @@ impl HTMLAppletElement {
document: &Document) -> HTMLAppletElement { document: &Document) -> HTMLAppletElement {
HTMLAppletElement { HTMLAppletElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -5,7 +5,7 @@
use dom::attr::AttrValue; use dom::attr::AttrValue;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::utils::Reflectable; use dom::bindings::utils::Reflectable;
use dom::document::Document; use dom::document::Document;
@ -26,7 +26,7 @@ pub struct HTMLAreaElement {
impl HTMLAreaElement { impl HTMLAreaElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLAreaElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLAreaElement {
HTMLAreaElement { HTMLAreaElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAreaElement, localName, prefix, document), htmlelement: HTMLElement::new_inherited(localName, prefix, document),
rel_list: Default::default(), rel_list: Default::default(),
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLAudioElementBinding; use dom::bindings::codegen::Bindings::HTMLAudioElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMediaElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlmediaelement::HTMLMediaElement; use dom::htmlmediaelement::HTMLMediaElement;
@ -21,7 +20,7 @@ impl HTMLAudioElement {
document: &Document) -> HTMLAudioElement { document: &Document) -> HTMLAudioElement {
HTMLAudioElement { HTMLAudioElement {
htmlmediaelement: htmlmediaelement:
HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document) HTMLMediaElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -4,7 +4,7 @@
use dom::attr::Attr; use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding; use dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::AttributeMutation; use dom::element::AttributeMutation;
@ -22,7 +22,7 @@ pub struct HTMLBaseElement {
impl HTMLBaseElement { impl HTMLBaseElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLBaseElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLBaseElement {
HTMLBaseElement { HTMLBaseElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLBaseElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -8,8 +8,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods};
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::utils::Reflectable; use dom::bindings::utils::Reflectable;
use dom::document::Document; use dom::document::Document;
@ -42,10 +41,7 @@ impl HTMLBodyElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
-> HTMLBodyElement { -> HTMLBodyElement {
HTMLBodyElement { HTMLBodyElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLBodyElement, htmlelement: HTMLElement::new_inherited(localName, prefix, document),
localName,
prefix,
document),
background_color: Cell::new(None), background_color: Cell::new(None),
background: DOMRefCell::new(None) background: DOMRefCell::new(None)
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLBRElementBinding; use dom::bindings::codegen::Bindings::HTMLBRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLBRElement {
impl HTMLBRElement { impl HTMLBRElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLBRElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLBRElement {
HTMLBRElement { HTMLBRElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLBRElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -6,8 +6,7 @@ use dom::activation::Activatable;
use dom::attr::Attr; use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLButtonElementBinding; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding;
use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLButtonElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLButtonElementCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId};
use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, NodeCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
@ -17,7 +16,8 @@ use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlformelement::{FormControl, FormSubmitter}; use dom::htmlformelement::{FormControl, FormSubmitter};
use dom::htmlformelement::{SubmittedFrom, HTMLFormElement}; use dom::htmlformelement::{SubmittedFrom, HTMLFormElement};
use dom::node::{Node, document_from_node, window_from_node}; use dom::node::{IN_ENABLED_STATE, Node, NodeFlags};
use dom::node::{document_from_node, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
@ -47,7 +47,8 @@ impl HTMLButtonElement {
document: &Document) -> HTMLButtonElement { document: &Document) -> HTMLButtonElement {
HTMLButtonElement { HTMLButtonElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document), HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document),
//TODO: implement button_type in attribute_mutated //TODO: implement button_type in attribute_mutated
button_type: Cell::new(ButtonType::ButtonSubmit) button_type: Cell::new(ButtonType::ButtonSubmit)
} }

View file

@ -7,7 +7,7 @@ use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding; use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::HTMLCanvasElementMethods; use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::HTMLCanvasElementMethods;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRenderingContext; use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRenderingContext;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{HeapGCValue, JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::{HeapGCValue, JS, LayoutJS, MutNullableHeap, Root};
@ -60,7 +60,7 @@ impl HTMLCanvasElement {
document: &Document) -> HTMLCanvasElement { document: &Document) -> HTMLCanvasElement {
HTMLCanvasElement { HTMLCanvasElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
context: Default::default(), context: Default::default(),
width: Cell::new(DEFAULT_WIDTH), width: Cell::new(DEFAULT_WIDTH),
height: Cell::new(DEFAULT_HEIGHT), height: Cell::new(DEFAULT_HEIGHT),

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLDataElementBinding; use dom::bindings::codegen::Bindings::HTMLDataElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -20,7 +19,7 @@ impl HTMLDataElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLDataElement { document: &Document) -> HTMLDataElement {
HTMLDataElement { HTMLDataElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::HTMLDataListElementBinding; use dom::bindings::codegen::Bindings::HTMLDataListElementBinding;
use dom::bindings::codegen::Bindings::HTMLDataListElementBinding::HTMLDataListElementMethods; use dom::bindings::codegen::Bindings::HTMLDataListElementBinding::HTMLDataListElementMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLOptionElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLOptionElementDerived, NodeCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::Element; use dom::element::Element;
@ -24,7 +24,7 @@ impl HTMLDataListElement {
document: &Document) -> HTMLDataListElement { document: &Document) -> HTMLDataListElement {
HTMLDataListElement { HTMLDataListElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -5,7 +5,6 @@
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLDialogElementBinding; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding;
use dom::bindings::codegen::Bindings::HTMLDialogElementBinding::HTMLDialogElementMethods; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding::HTMLDialogElementMethods;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -25,7 +24,7 @@ impl HTMLDialogElement {
document: &Document) -> HTMLDialogElement { document: &Document) -> HTMLDialogElement {
HTMLDialogElement { HTMLDialogElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
return_value: DOMRefCell::new("".to_owned()), return_value: DOMRefCell::new("".to_owned()),
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLDirectoryElementBinding; use dom::bindings::codegen::Bindings::HTMLDirectoryElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLDirectoryElement {
document: &Document) -> HTMLDirectoryElement { document: &Document) -> HTMLDirectoryElement {
HTMLDirectoryElement { HTMLDirectoryElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLDivElementBinding::{self, HTMLDivElementMethods}; use dom::bindings::codegen::Bindings::HTMLDivElementBinding::{self, HTMLDivElementMethods};
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -20,7 +19,7 @@ impl HTMLDivElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLDivElement { document: &Document) -> HTMLDivElement {
HTMLDivElement { HTMLDivElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDivElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLDListElementBinding; use dom::bindings::codegen::Bindings::HTMLDListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -19,7 +18,7 @@ impl HTMLDListElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLDListElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLDListElement {
HTMLDListElement { HTMLDListElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -22,7 +22,8 @@ use dom::document::Document;
use dom::domstringmap::DOMStringMap; use dom::domstringmap::DOMStringMap;
use dom::element::{AttributeMutation, Element}; use dom::element::{AttributeMutation, Element};
use dom::htmlinputelement::HTMLInputElement; 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 dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::FocusType; use msg::constellation_msg::FocusType;
use std::borrow::ToOwned; use std::borrow::ToOwned;
@ -46,13 +47,17 @@ impl PartialEq for HTMLElement {
} }
impl HTMLElement { impl HTMLElement {
pub fn new_inherited(type_id: HTMLElementTypeId, pub fn new_inherited(tag_name: DOMString, prefix: Option<DOMString>,
tag_name: DOMString,
prefix: Option<DOMString>,
document: &Document) -> HTMLElement { 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 { HTMLElement {
element: 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(), style_decl: Default::default(),
dataset: Default::default(), dataset: Default::default(),
} }
@ -60,7 +65,7 @@ impl HTMLElement {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> Root<HTMLElement> { 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) Node::reflect_node(box element, document, HTMLElementBinding::Wrap)
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLEmbedElementBinding; use dom::bindings::codegen::Bindings::HTMLEmbedElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLEmbedElement {
impl HTMLEmbedElement { impl HTMLEmbedElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLEmbedElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLEmbedElement {
HTMLEmbedElement { HTMLEmbedElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLEmbedElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -14,7 +14,7 @@ use dom::element::{AttributeMutation, Element};
use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlcollection::{CollectionFilter, HTMLCollection};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlformelement::{FormControl, HTMLFormElement}; use dom::htmlformelement::{FormControl, HTMLFormElement};
use dom::node::{Node, window_from_node}; use dom::node::{IN_ENABLED_STATE, Node, NodeFlags, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use util::str::{DOMString, StaticStringVec}; use util::str::{DOMString, StaticStringVec};
@ -30,7 +30,8 @@ impl HTMLFieldSetElement {
document: &Document) -> HTMLFieldSetElement { document: &Document) -> HTMLFieldSetElement {
HTMLFieldSetElement { HTMLFieldSetElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document) HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document)
} }
} }

View file

@ -7,7 +7,7 @@ use dom::attr::{Attr, AttrValue};
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bindings::HTMLFontElementBinding;
use dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods; use dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, RawLayoutElementHelpers}; use dom::element::{AttributeMutation, RawLayoutElementHelpers};
@ -30,7 +30,7 @@ pub struct HTMLFontElement {
impl HTMLFontElement { impl HTMLFontElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLFontElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLFontElement {
HTMLFontElement { HTMLFontElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFontElement, localName, prefix, document), htmlelement: HTMLElement::new_inherited(localName, prefix, document),
color: Cell::new(None), color: Cell::new(None),
face: DOMRefCell::new(None), face: DOMRefCell::new(None),
} }

View file

@ -55,7 +55,7 @@ impl HTMLFormElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLFormElement { document: &Document) -> HTMLFormElement {
HTMLFormElement { HTMLFormElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFormElement, localName, prefix, document), htmlelement: HTMLElement::new_inherited(localName, prefix, document),
marked_for_reset: Cell::new(false), marked_for_reset: Cell::new(false),
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLFrameElementBinding; use dom::bindings::codegen::Bindings::HTMLFrameElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLFrameElement {
impl HTMLFrameElement { impl HTMLFrameElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLFrameElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLFrameElement {
HTMLFrameElement { HTMLFrameElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding; use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLFrameSetElement {
document: &Document) -> HTMLFrameSetElement { document: &Document) -> HTMLFrameSetElement {
HTMLFrameSetElement { HTMLFrameSetElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLHeadElementBinding; use dom::bindings::codegen::Bindings::HTMLHeadElementBinding;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::HTMLElementCast;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -22,7 +22,7 @@ impl HTMLHeadElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLHeadElement { document: &Document) -> HTMLHeadElement {
HTMLHeadElement { HTMLHeadElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding; use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -33,7 +32,7 @@ impl HTMLHeadingElement {
level: HeadingLevel) -> HTMLHeadingElement { level: HeadingLevel) -> HTMLHeadingElement {
HTMLHeadingElement { HTMLHeadingElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
level: level, level: level,
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLHRElementBinding; use dom::bindings::codegen::Bindings::HTMLHRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLHRElement {
impl HTMLHRElement { impl HTMLHRElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLHRElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLHRElement {
HTMLHRElement { HTMLHRElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHRElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLHtmlElementBinding; use dom::bindings::codegen::Bindings::HTMLHtmlElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLHtmlElement {
impl HTMLHtmlElement { impl HTMLHtmlElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLHtmlElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLHtmlElement {
HTMLHtmlElement { HTMLHtmlElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHtmlElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -6,9 +6,8 @@ use dom::attr::{Attr, AttrHelpersForLayout, AttrValue};
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventCast, EventTargetCast};
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, NodeCast};
use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
@ -185,8 +184,7 @@ impl HTMLIFrameElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLIFrameElement { document: &Document) -> HTMLIFrameElement {
HTMLIFrameElement { HTMLIFrameElement {
htmlelement: htmlelement: HTMLElement::new_inherited(localName, prefix, document),
HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document),
pipeline_id: Cell::new(None), pipeline_id: Cell::new(None),
subpage_id: Cell::new(None), subpage_id: Cell::new(None),
containing_page_pipeline_id: Cell::new(None), containing_page_pipeline_id: Cell::new(None),

View file

@ -8,8 +8,8 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods; use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::js::{LayoutJS, Root};
@ -134,7 +134,7 @@ impl HTMLImageElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLImageElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLImageElement {
HTMLImageElement { HTMLImageElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLImageElement, localName, prefix, document), htmlelement: HTMLElement::new_inherited(localName, prefix, document),
url: DOMRefCell::new(None), url: DOMRefCell::new(None),
image: DOMRefCell::new(None), image: DOMRefCell::new(None),
} }

View file

@ -11,8 +11,7 @@ use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::HTMLInputElementBinding; use dom::bindings::codegen::Bindings::HTMLInputElementBinding;
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods; use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods; use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId};
use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, HTMLInputElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, HTMLInputElementCast};
use dom::bindings::codegen::InheritTypes::{KeyboardEventCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{KeyboardEventCast, NodeCast};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
@ -25,7 +24,7 @@ use dom::htmlelement::HTMLElement;
use dom::htmlformelement::{FormControl, FormDatum, FormSubmitter, HTMLFormElement}; use dom::htmlformelement::{FormControl, FormDatum, FormSubmitter, HTMLFormElement};
use dom::htmlformelement::{ResetFrom, SubmittedFrom}; use dom::htmlformelement::{ResetFrom, SubmittedFrom};
use dom::keyboardevent::KeyboardEvent; use dom::keyboardevent::KeyboardEvent;
use dom::node::{Node, NodeDamage}; use dom::node::{IN_ENABLED_STATE, Node, NodeDamage, NodeFlags};
use dom::node::{document_from_node, window_from_node}; use dom::node::{document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::ConstellationChan;
@ -109,7 +108,9 @@ impl HTMLInputElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLInputElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLInputElement {
let chan = document.window().r().constellation_chan(); let chan = document.window().r().constellation_chan();
HTMLInputElement { HTMLInputElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLInputElement, localName, prefix, document), htmlelement:
HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document),
input_type: Cell::new(InputType::InputText), input_type: Cell::new(InputType::InputText),
checked: Cell::new(false), checked: Cell::new(false),
placeholder: DOMRefCell::new("".to_owned()), placeholder: DOMRefCell::new("".to_owned()),

View file

@ -4,7 +4,6 @@
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding; use dom::bindings::codegen::Bindings::HTMLLabelElementBinding;
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods; use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -23,7 +22,7 @@ impl HTMLLabelElement {
document: &Document) -> HTMLLabelElement { document: &Document) -> HTMLLabelElement {
HTMLLabelElement { HTMLLabelElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLLegendElementBinding; use dom::bindings::codegen::Bindings::HTMLLegendElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLLegendElement {
document: &Document) -> HTMLLegendElement { document: &Document) -> HTMLLegendElement {
HTMLLegendElement { HTMLLegendElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLLIElementBinding; use dom::bindings::codegen::Bindings::HTMLLIElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLLIElement {
impl HTMLLIElement { impl HTMLLIElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLLIElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLLIElement {
HTMLLIElement { HTMLLIElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLIElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -8,8 +8,8 @@ use dom::attr::{Attr, AttrValue};
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{RootedReference}; use dom::bindings::js::{RootedReference};
@ -42,7 +42,7 @@ pub struct HTMLLinkElement {
impl HTMLLinkElement { impl HTMLLinkElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLLinkElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLLinkElement {
HTMLLinkElement { HTMLLinkElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLinkElement, localName, prefix, document), htmlelement: HTMLElement::new_inherited(localName, prefix, document),
rel_list: Default::default(), rel_list: Default::default(),
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLMapElementBinding; use dom::bindings::codegen::Bindings::HTMLMapElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -20,7 +19,7 @@ impl HTMLMapElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLMapElement { document: &Document) -> HTMLMapElement {
HTMLMapElement { HTMLMapElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMapElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLMediaElementTypeId};
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use util::str::DOMString; use util::str::DOMString;
@ -13,12 +12,12 @@ pub struct HTMLMediaElement {
} }
impl HTMLMediaElement { impl HTMLMediaElement {
pub fn new_inherited(type_id: HTMLMediaElementTypeId, tag_name: DOMString, pub fn new_inherited(tag_name: DOMString,
prefix: Option<DOMString>, document: &Document) prefix: Option<DOMString>, document: &Document)
-> HTMLMediaElement { -> HTMLMediaElement {
HTMLMediaElement { HTMLMediaElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document) HTMLElement::new_inherited(tag_name, prefix, document)
} }
} }

View file

@ -4,8 +4,7 @@
use dom::bindings::codegen::Bindings::HTMLMetaElementBinding; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding;
use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, NodeCast};
use dom::bindings::js::{Root, RootedReference}; use dom::bindings::js::{Root, RootedReference};
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -26,7 +25,7 @@ impl HTMLMetaElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLMetaElement { document: &Document) -> HTMLMetaElement {
HTMLMetaElement { HTMLMetaElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMetaElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLMeterElementBinding; use dom::bindings::codegen::Bindings::HTMLMeterElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -20,7 +19,7 @@ impl HTMLMeterElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLMeterElement { document: &Document) -> HTMLMeterElement {
HTMLMeterElement { HTMLMeterElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMeterElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLModElementBinding; use dom::bindings::codegen::Bindings::HTMLModElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLModElement {
document: &Document) -> HTMLModElement { document: &Document) -> HTMLModElement {
HTMLModElement { HTMLModElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -6,7 +6,7 @@ use dom::attr::Attr;
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLObjectElementBinding; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding;
use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::AttributeMutation; use dom::element::AttributeMutation;
@ -31,7 +31,7 @@ impl HTMLObjectElement {
document: &Document) -> HTMLObjectElement { document: &Document) -> HTMLObjectElement {
HTMLObjectElement { HTMLObjectElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
image: DOMRefCell::new(None), image: DOMRefCell::new(None),
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLOListElementBinding; use dom::bindings::codegen::Bindings::HTMLOListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -20,7 +19,7 @@ impl HTMLOListElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLOListElement { document: &Document) -> HTMLOListElement {
HTMLOListElement { HTMLOListElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOListElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -5,13 +5,12 @@
use dom::attr::Attr; use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;
use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLOptionElementDerived, NodeCast};
use dom::bindings::codegen::InheritTypes::{HTMLOptionElementDerived, NodeCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::AttributeMutation; use dom::element::AttributeMutation;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::node::Node; use dom::node::{IN_ENABLED_STATE, Node, NodeFlags};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use util::str::DOMString; use util::str::DOMString;
@ -26,7 +25,8 @@ impl HTMLOptGroupElement {
document: &Document) -> HTMLOptGroupElement { document: &Document) -> HTMLOptGroupElement {
HTMLOptGroupElement { HTMLOptGroupElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document) HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document)
} }
} }

View file

@ -7,14 +7,14 @@ use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding; use dom::bindings::codegen::Bindings::HTMLOptionElementBinding;
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods; use dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLScriptElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLScriptElementDerived};
use dom::bindings::codegen::InheritTypes::{NodeCast, TextDerived}; use dom::bindings::codegen::InheritTypes::{NodeCast, TextDerived};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element}; use dom::element::{AttributeMutation, Element};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::node::Node; use dom::node::{IN_ENABLED_STATE, Node, NodeFlags};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use std::cell::Cell; use std::cell::Cell;
use util::str::{DOMString, split_html_space_chars, str_join}; use util::str::{DOMString, split_html_space_chars, str_join};
@ -36,7 +36,8 @@ impl HTMLOptionElement {
document: &Document) -> HTMLOptionElement { document: &Document) -> HTMLOptionElement {
HTMLOptionElement { HTMLOptionElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document), HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document),
selectedness: Cell::new(false), selectedness: Cell::new(false),
dirtiness: Cell::new(false), dirtiness: Cell::new(false),
} }

View file

@ -4,7 +4,6 @@
use dom::bindings::codegen::Bindings::HTMLOutputElementBinding; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding;
use dom::bindings::codegen::Bindings::HTMLOutputElementBinding::HTMLOutputElementMethods; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding::HTMLOutputElementMethods;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -24,7 +23,7 @@ impl HTMLOutputElement {
document: &Document) -> HTMLOutputElement { document: &Document) -> HTMLOutputElement {
HTMLOutputElement { HTMLOutputElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLParagraphElementBinding; use dom::bindings::codegen::Bindings::HTMLParagraphElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLParagraphElement {
document: &Document) -> HTMLParagraphElement { document: &Document) -> HTMLParagraphElement {
HTMLParagraphElement { HTMLParagraphElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLParamElementBinding; use dom::bindings::codegen::Bindings::HTMLParamElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLParamElement {
document: &Document) -> HTMLParamElement { document: &Document) -> HTMLParamElement {
HTMLParamElement { HTMLParamElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLPreElementBinding; use dom::bindings::codegen::Bindings::HTMLPreElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLPreElement {
document: &Document) -> HTMLPreElement { document: &Document) -> HTMLPreElement {
HTMLPreElement { HTMLPreElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLProgressElementBinding; use dom::bindings::codegen::Bindings::HTMLProgressElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLProgressElement {
document: &Document) -> HTMLProgressElement { document: &Document) -> HTMLProgressElement {
HTMLProgressElement { HTMLProgressElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLQuoteElementBinding; use dom::bindings::codegen::Bindings::HTMLQuoteElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLQuoteElement {
document: &Document) -> HTMLQuoteElement { document: &Document) -> HTMLQuoteElement {
HTMLQuoteElement { HTMLQuoteElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -10,8 +10,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::Bindings::HTMLScriptElementBinding; use dom::bindings::codegen::Bindings::HTMLScriptElementBinding;
use dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElementMethods; use dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId};
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLScriptElementCast, NodeCast};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::RootedReference; use dom::bindings::js::RootedReference;
@ -78,7 +77,7 @@ impl HTMLScriptElement {
creator: ElementCreator) -> HTMLScriptElement { creator: ElementCreator) -> HTMLScriptElement {
HTMLScriptElement { HTMLScriptElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLScriptElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
already_started: Cell::new(false), already_started: Cell::new(false),
parser_inserted: Cell::new(creator == ElementCreator::ParserCreated), parser_inserted: Cell::new(creator == ElementCreator::ParserCreated),
non_blocking: Cell::new(creator != ElementCreator::ParserCreated), non_blocking: Cell::new(creator != ElementCreator::ParserCreated),

View file

@ -5,8 +5,7 @@
use dom::attr::{Attr, AttrValue}; use dom::attr::{Attr, AttrValue};
use dom::bindings::codegen::Bindings::HTMLSelectElementBinding; use dom::bindings::codegen::Bindings::HTMLSelectElementBinding;
use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods; use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLFieldSetElementDerived, NodeCast};
use dom::bindings::codegen::InheritTypes::{HTMLFieldSetElementDerived, NodeCast};
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement;
use dom::bindings::js::Root; use dom::bindings::js::Root;
@ -14,7 +13,7 @@ use dom::document::Document;
use dom::element::AttributeMutation; use dom::element::AttributeMutation;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlformelement::{FormControl, HTMLFormElement}; use dom::htmlformelement::{FormControl, HTMLFormElement};
use dom::node::{Node, window_from_node}; use dom::node::{IN_ENABLED_STATE, Node, NodeFlags, window_from_node};
use dom::validitystate::ValidityState; use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use std::borrow::ToOwned; use std::borrow::ToOwned;
@ -34,7 +33,8 @@ impl HTMLSelectElement {
document: &Document) -> HTMLSelectElement { document: &Document) -> HTMLSelectElement {
HTMLSelectElement { HTMLSelectElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document) HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use dom::bindings::codegen::Bindings::HTMLSourceElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLSourceElement {
document: &Document) -> HTMLSourceElement { document: &Document) -> HTMLSourceElement {
HTMLSourceElement { HTMLSourceElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLSpanElementBinding; use dom::bindings::codegen::Bindings::HTMLSpanElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLSpanElement {
impl HTMLSpanElement { impl HTMLSpanElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLSpanElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLSpanElement {
HTMLSpanElement { HTMLSpanElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSpanElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -5,8 +5,7 @@
use cssparser::Parser as CssParser; use cssparser::Parser as CssParser;
use dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, NodeCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -27,7 +26,7 @@ impl HTMLStyleElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLStyleElement { document: &Document) -> HTMLStyleElement {
HTMLStyleElement { HTMLStyleElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLStyleElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding; use dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLTableCaptionElement {
document: &Document) -> HTMLTableCaptionElement { document: &Document) -> HTMLTableCaptionElement {
HTMLTableCaptionElement { HTMLTableCaptionElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -6,8 +6,7 @@ use cssparser::RGBA;
use dom::attr::{Attr, AttrValue}; use dom::attr::{Attr, AttrValue};
use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods; use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTableCellElementDerived};
use dom::bindings::codegen::InheritTypes::{HTMLTableCellElementDerived, HTMLTableCellElementTypeId};
use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, NodeCast};
use dom::bindings::js::LayoutJS; use dom::bindings::js::LayoutJS;
use dom::document::Document; use dom::document::Document;
@ -30,14 +29,12 @@ pub struct HTMLTableCellElement {
} }
impl HTMLTableCellElement { impl HTMLTableCellElement {
pub fn new_inherited(type_id: HTMLTableCellElementTypeId, pub fn new_inherited(tag_name: DOMString,
tag_name: DOMString,
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) document: &Document)
-> HTMLTableCellElement { -> HTMLTableCellElement {
HTMLTableCellElement { HTMLTableCellElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCellElement(type_id), htmlelement: HTMLElement::new_inherited(tag_name, prefix, document),
tag_name, prefix, document),
background_color: Cell::new(None), background_color: Cell::new(None),
colspan: Cell::new(None), colspan: Cell::new(None),
width: Cell::new(LengthOrPercentageOrAuto::Auto), width: Cell::new(LengthOrPercentageOrAuto::Auto),

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLTableColElementBinding; use dom::bindings::codegen::Bindings::HTMLTableColElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLTableColElement {
document: &Document) -> HTMLTableColElement { document: &Document) -> HTMLTableColElement {
HTMLTableColElement { HTMLTableColElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLTableDataCellElementBinding; use dom::bindings::codegen::Bindings::HTMLTableDataCellElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableCellElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmltablecellelement::HTMLTableCellElement; use dom::htmltablecellelement::HTMLTableCellElement;
@ -21,8 +20,7 @@ impl HTMLTableDataCellElement {
document: &Document) -> HTMLTableDataCellElement { document: &Document) -> HTMLTableDataCellElement {
HTMLTableDataCellElement { HTMLTableDataCellElement {
htmltablecellelement: htmltablecellelement:
HTMLTableCellElement::new_inherited( HTMLTableCellElement::new_inherited(localName, prefix, document)
HTMLTableCellElementTypeId::HTMLTableDataCellElement, localName, prefix, document)
} }
} }

View file

@ -7,8 +7,8 @@ use dom::attr::{Attr, AttrValue};
use dom::bindings::codegen::Bindings::HTMLTableElementBinding; use dom::bindings::codegen::Bindings::HTMLTableElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods; use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLTableCaptionElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTableCaptionElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLTableSectionElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLTableSectionElementDerived, NodeCast};
use dom::bindings::js::{Root, RootedReference}; use dom::bindings::js::{Root, RootedReference};
use dom::document::Document; use dom::document::Document;
@ -35,10 +35,7 @@ impl HTMLTableElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
-> HTMLTableElement { -> HTMLTableElement {
HTMLTableElement { HTMLTableElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableElement, htmlelement: HTMLElement::new_inherited(localName, prefix, document),
localName,
prefix,
document),
background_color: Cell::new(None), background_color: Cell::new(None),
border: Cell::new(None), border: Cell::new(None),
cellspacing: Cell::new(None), cellspacing: Cell::new(None),

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding; use dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLTableCellElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmltablecellelement::HTMLTableCellElement; use dom::htmltablecellelement::HTMLTableCellElement;
@ -20,8 +19,8 @@ impl HTMLTableHeaderCellElement {
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLTableHeaderCellElement { document: &Document) -> HTMLTableHeaderCellElement {
HTMLTableHeaderCellElement { HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited( htmltablecellelement:
HTMLTableCellElementTypeId::HTMLTableHeaderCellElement, localName, prefix, document) HTMLTableCellElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -6,7 +6,7 @@ use cssparser::RGBA;
use dom::attr::Attr; use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::{self, HTMLTableRowElementMethods}; use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::{self, HTMLTableRowElementMethods};
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId, HTMLTableDataCellElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTableDataCellElementDerived};
use dom::bindings::codegen::InheritTypes::{HTMLTableHeaderCellElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLTableHeaderCellElementDerived, NodeCast};
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::document::Document; use dom::document::Document;
@ -39,10 +39,7 @@ impl HTMLTableRowElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
-> HTMLTableRowElement { -> HTMLTableRowElement {
HTMLTableRowElement { HTMLTableRowElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableRowElement, htmlelement: HTMLElement::new_inherited(localName, prefix, document),
localName,
prefix,
document),
cells: Default::default(), cells: Default::default(),
background_color: Cell::new(None), background_color: Cell::new(None),
} }

View file

@ -7,7 +7,7 @@ use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTMLTableSectionElementMethods}; use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTMLTableSectionElementMethods};
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, NodeCast}; use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, NodeCast};
use dom::bindings::error::Error; use dom::bindings::error::Error;
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
@ -33,10 +33,7 @@ impl HTMLTableSectionElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
-> HTMLTableSectionElement { -> HTMLTableSectionElement {
HTMLTableSectionElement { HTMLTableSectionElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableSectionElement, htmlelement: HTMLElement::new_inherited(localName, prefix, document),
localName,
prefix,
document),
background_color: Cell::new(None), background_color: Cell::new(None),
} }
} }

View file

@ -6,8 +6,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTemplateElementCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{HTMLTemplateElementCast, NodeCast};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::document::Document; use dom::document::Document;
use dom::documentfragment::DocumentFragment; use dom::documentfragment::DocumentFragment;
@ -30,7 +29,7 @@ impl HTMLTemplateElement {
document: &Document) -> HTMLTemplateElement { document: &Document) -> HTMLTemplateElement {
HTMLTemplateElement { HTMLTemplateElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTemplateElement, localName, prefix, document), HTMLElement::new_inherited(localName, prefix, document),
contents: MutNullableHeap::new(None), contents: MutNullableHeap::new(None),
} }
} }

View file

@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, HTMLFieldSetElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLFieldSetElementDerived};
use dom::bindings::codegen::InheritTypes::{KeyboardEventCast, NodeCast}; use dom::bindings::codegen::InheritTypes::{KeyboardEventCast, NodeCast};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::js::{LayoutJS, Root};
@ -20,8 +20,8 @@ use dom::event::{Event, EventBubbles, EventCancelable};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlformelement::{FormControl, HTMLFormElement}; use dom::htmlformelement::{FormControl, HTMLFormElement};
use dom::keyboardevent::KeyboardEvent; use dom::keyboardevent::KeyboardEvent;
use dom::node::{ChildrenMutation, Node, NodeDamage}; use dom::node::{ChildrenMutation, IN_ENABLED_STATE, Node, NodeDamage};
use dom::node::{document_from_node, window_from_node}; use dom::node::{NodeFlags, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::ConstellationChan;
use script_task::ScriptTaskEventCategory::InputEvent; use script_task::ScriptTaskEventCategory::InputEvent;
@ -87,7 +87,8 @@ impl HTMLTextAreaElement {
let chan = document.window().r().constellation_chan(); let chan = document.window().r().constellation_chan();
HTMLTextAreaElement { HTMLTextAreaElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTextAreaElement, localName, prefix, document), HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
localName, prefix, document),
textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), chan)), textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), chan)),
cols: Cell::new(DEFAULT_COLS), cols: Cell::new(DEFAULT_COLS),
rows: Cell::new(DEFAULT_ROWS), rows: Cell::new(DEFAULT_ROWS),

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLTimeElementBinding; use dom::bindings::codegen::Bindings::HTMLTimeElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLTimeElement {
impl HTMLTimeElement { impl HTMLTimeElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLTimeElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLTimeElement {
HTMLTimeElement { HTMLTimeElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTimeElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLTitleElementBinding;
use dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods; use dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{CharacterDataCast, HTMLElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementTypeId, NodeCast, TextCast}; use dom::bindings::codegen::InheritTypes::{NodeCast, TextCast};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -23,7 +23,7 @@ pub struct HTMLTitleElement {
impl HTMLTitleElement { impl HTMLTitleElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLTitleElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLTitleElement {
HTMLTitleElement { HTMLTitleElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTitleElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLTrackElementBinding; use dom::bindings::codegen::Bindings::HTMLTrackElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLTrackElement {
impl HTMLTrackElement { impl HTMLTrackElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLTrackElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLTrackElement {
HTMLTrackElement { HTMLTrackElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTrackElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLUListElementBinding; use dom::bindings::codegen::Bindings::HTMLUListElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,7 @@ pub struct HTMLUListElement {
impl HTMLUListElement { impl HTMLUListElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLUListElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLUListElement {
HTMLUListElement { HTMLUListElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLUListElement, localName, prefix, document) htmlelement: HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLUnknownElementBinding; use dom::bindings::codegen::Bindings::HTMLUnknownElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -21,7 +20,7 @@ impl HTMLUnknownElement {
document: &Document) -> HTMLUnknownElement { document: &Document) -> HTMLUnknownElement {
HTMLUnknownElement { HTMLUnknownElement {
htmlelement: htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLUnknownElement, localName, prefix, document) HTMLElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLVideoElementBinding; use dom::bindings::codegen::Bindings::HTMLVideoElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLMediaElementTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::document::Document; use dom::document::Document;
use dom::htmlmediaelement::HTMLMediaElement; use dom::htmlmediaelement::HTMLMediaElement;
@ -19,7 +18,7 @@ impl HTMLVideoElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLVideoElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLVideoElement {
HTMLVideoElement { HTMLVideoElement {
htmlmediaelement: htmlmediaelement:
HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLVideoElement, localName, prefix, document) HTMLMediaElement::new_inherited(localName, prefix, document)
} }
} }

View file

@ -163,22 +163,8 @@ bitflags! {
} }
impl NodeFlags { impl NodeFlags {
pub fn new(type_id: NodeTypeId) -> NodeFlags { pub fn new() -> NodeFlags {
let dirty = HAS_CHANGED | IS_DIRTY | HAS_DIRTY_SIBLINGS | HAS_DIRTY_DESCENDANTS; HAS_CHANGED | IS_DIRTY | HAS_DIRTY_SIBLINGS | HAS_DIRTY_DESCENDANTS
match type_id {
NodeTypeId::Document => IS_IN_DOC | dirty,
// The following elements are enabled by default.
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) |
//NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMenuItemElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)) =>
IN_ENABLED_STATE | dirty,
_ => dirty,
}
} }
} }
@ -1358,15 +1344,19 @@ impl Node {
reflect_dom_object(node, GlobalRef::Window(window.r()), wrap_fn) reflect_dom_object(node, GlobalRef::Window(window.r()), wrap_fn)
} }
pub fn new_inherited(type_id: NodeTypeId, doc: &Document) -> Node { pub fn new_inherited(doc: &Document) -> Node {
Node::new_(type_id, Some(doc.clone())) Node::new_inherited_with_flags(NodeFlags::new(), doc)
} }
pub fn new_without_doc(type_id: NodeTypeId) -> Node { pub fn new_inherited_with_flags(flags: NodeFlags, doc: &Document) -> Node {
Node::new_(type_id, None) Node::new_(flags, Some(doc))
} }
fn new_(type_id: NodeTypeId, doc: Option<&Document>) -> Node { pub fn new_document_node() -> Node {
Node::new_(NodeFlags::new() | IS_IN_DOC, None)
}
fn new_(flags: NodeFlags, doc: Option<&Document>) -> Node {
Node { Node {
eventtarget: EventTarget::new_inherited(), eventtarget: EventTarget::new_inherited(),
@ -1378,7 +1368,7 @@ impl Node {
owner_doc: MutNullableHeap::new(doc.map(JS::from_ref)), owner_doc: MutNullableHeap::new(doc.map(JS::from_ref)),
child_list: Default::default(), child_list: Default::default(),
children_count: Cell::new(0u32), children_count: Cell::new(0u32),
flags: Cell::new(NodeFlags::new(type_id)), flags: Cell::new(flags),
layout_data: LayoutDataRef::new(), layout_data: LayoutDataRef::new(),

View file

@ -4,7 +4,6 @@
use dom::bindings::codegen::Bindings::ProcessingInstructionBinding; use dom::bindings::codegen::Bindings::ProcessingInstructionBinding;
use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods; use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods;
use dom::bindings::codegen::InheritTypes::CharacterDataTypeId;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::characterdata::CharacterData; use dom::characterdata::CharacterData;
use dom::document::Document; use dom::document::Document;
@ -21,7 +20,7 @@ pub struct ProcessingInstruction {
impl ProcessingInstruction { impl ProcessingInstruction {
fn new_inherited(target: DOMString, data: DOMString, document: &Document) -> ProcessingInstruction { fn new_inherited(target: DOMString, data: DOMString, document: &Document) -> ProcessingInstruction {
ProcessingInstruction { ProcessingInstruction {
characterdata: CharacterData::new_inherited(CharacterDataTypeId::ProcessingInstruction, data, document), characterdata: CharacterData::new_inherited(data, document),
target: target target: target
} }
} }

View file

@ -7,8 +7,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::Bindings::TextBinding::{self, TextMethods}; use dom::bindings::codegen::Bindings::TextBinding::{self, TextMethods};
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, CharacterDataTypeId}; use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeCast, TextDerived};
use dom::bindings::codegen::InheritTypes::{NodeCast, TextDerived};
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::Root; use dom::bindings::js::Root;
@ -27,7 +26,7 @@ pub struct Text {
impl Text { impl Text {
fn new_inherited(text: DOMString, document: &Document) -> Text { fn new_inherited(text: DOMString, document: &Document) -> Text {
Text { Text {
characterdata: CharacterData::new_inherited(CharacterDataTypeId::Text, text, document) characterdata: CharacterData::new_inherited(text, document)
} }
} }