auto merge of #1177 : Ms2ger/servo/new-htmlelement, r=jdm

r? @jdm
This commit is contained in:
bors-servo 2013-11-05 07:17:27 -08:00
commit e16a29480e
67 changed files with 748 additions and 176 deletions

View file

@ -12,7 +12,6 @@ use dom::element::{Element};
use dom::element::{HTMLHeadElementTypeId, HTMLTitleElementTypeId};
use dom::htmlcollection::HTMLCollection;
use dom::htmldocument::HTMLDocument;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView, Node, ElementNodeTypeId, DocumentNodeTypeId};
use dom::text::Text;
use dom::window::Window;
@ -236,13 +235,12 @@ impl Document {
}
pub fn CreateElement(&self, abstract_self: AbstractDocument, local_name: &DOMString) -> Fallible<AbstractNode<ScriptView>> {
let cx = self.get_cx();
let local_name = null_str_as_empty(local_name);
if !is_valid_element_name(local_name) {
return Err(InvalidCharacter);
}
let local_name = local_name.to_ascii_lower();
Ok(build_element_from_tag(cx, local_name, abstract_self))
Ok(build_element_from_tag(local_name, abstract_self))
}
pub fn CreateDocumentFragment(&self, abstract_self: AbstractDocument) -> AbstractNode<ScriptView> {
@ -323,12 +321,7 @@ impl Document {
break;
}
if !has_title {
let new_title = @HTMLTitleElement {
htmlelement: HTMLElement::new(HTMLTitleElementTypeId, ~"title", abstract_self)
};
let new_title = unsafe {
Node::as_abstract_node(self.get_cx(), new_title)
};
let new_title = HTMLTitleElement::new(~"title", abstract_self);
new_title.AppendChild(self.CreateTextNode(abstract_self, title));
node.AppendChild(new_title);
}

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::htmlelement::HTMLElement;
use dom::bindings::codegen::HTMLAnchorElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLAnchorElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLAnchorElement {
htmlelement: HTMLElement
}
impl HTMLAnchorElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLAnchorElement {
HTMLAnchorElement {
htmlelement: HTMLElement::new_inherited(HTMLAnchorElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLAnchorElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLAnchorElementBinding::Wrap)
}
}
impl HTMLAnchorElement {
pub fn Href(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLAppletElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLAppletElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLAppletElement {
htmlelement: HTMLElement
}
impl HTMLAppletElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLAppletElement {
HTMLAppletElement {
htmlelement: HTMLElement::new_inherited(HTMLAppletElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLAppletElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLAppletElementBinding::Wrap)
}
}
impl HTMLAppletElement {
pub fn Align(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLAreaElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLAreaElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLAreaElement {
htmlelement: HTMLElement
}
impl HTMLAreaElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLAreaElement {
HTMLAreaElement {
htmlelement: HTMLElement::new_inherited(HTMLAreaElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLAreaElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLAreaElementBinding::Wrap)
}
}
impl HTMLAreaElement {
pub fn Alt(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLBaseElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLBaseElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLBaseElement {
htmlelement: HTMLElement
}
impl HTMLBaseElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLBaseElement {
HTMLBaseElement {
htmlelement: HTMLElement::new_inherited(HTMLBaseElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLBaseElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLBaseElementBinding::Wrap)
}
}
impl HTMLBaseElement {
pub fn Href(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLBodyElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLBodyElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLBodyElement {
htmlelement: HTMLElement
}
impl HTMLBodyElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLBodyElement {
HTMLBodyElement {
htmlelement: HTMLElement::new_inherited(HTMLBodyElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLBodyElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLBodyElementBinding::Wrap)
}
}
impl HTMLBodyElement {
pub fn Text(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLBRElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLBRElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLBRElement {
htmlelement: HTMLElement,
}
impl HTMLBRElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLBRElement {
HTMLBRElement {
htmlelement: HTMLElement::new_inherited(HTMLBRElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLBRElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLBRElementBinding::Wrap)
}
}
impl HTMLBRElement {
pub fn Clear(&self) -> DOMString {
None

View file

@ -2,15 +2,31 @@
* 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/. */
use dom::bindings::codegen::HTMLButtonElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLButtonElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, Node, ScriptView};
use dom::validitystate::ValidityState;
pub struct HTMLButtonElement {
htmlelement: HTMLElement
}
impl HTMLButtonElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLButtonElement {
HTMLButtonElement {
htmlelement: HTMLElement::new_inherited(HTMLButtonElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLButtonElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLButtonElementBinding::Wrap)
}
}
impl HTMLButtonElement {
pub fn Autofocus(&self) -> bool {
false

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLCanvasElementBinding;
use dom::bindings::utils::{ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLCanvasElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLCanvasElement {
htmlelement: HTMLElement,
}
impl HTMLCanvasElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLCanvasElement {
HTMLCanvasElement {
htmlelement: HTMLElement::new_inherited(HTMLCanvasElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLCanvasElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLCanvasElementBinding::Wrap)
}
}
impl HTMLCanvasElement {
pub fn Width(&self) -> u32 {
0

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLDataElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLDataElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLDataElement {
htmlelement: HTMLElement
}
impl HTMLDataElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLDataElement {
HTMLDataElement {
htmlelement: HTMLElement::new_inherited(HTMLDataElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLDataElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLDataElementBinding::Wrap)
}
}
impl HTMLDataElement {
pub fn Value(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLDataListElementBinding;
use dom::document::AbstractDocument;
use dom::element::HTMLDataListElementTypeId;
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLDataListElement {
htmlelement: HTMLElement
}
impl HTMLDataListElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLDataListElement {
HTMLDataListElement {
htmlelement: HTMLElement::new_inherited(HTMLDataListElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLDataListElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLDataListElementBinding::Wrap)
}
}
impl HTMLDataListElement {
pub fn Options(&self) -> @mut HTMLCollection {
let window = self.htmlelement.element.node.owner_doc().document().window;

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLDirectoryElementBinding;
use dom::bindings::utils::ErrorResult;
use dom::document::AbstractDocument;
use dom::element::HTMLDirectoryElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLDirectoryElement {
htmlelement: HTMLElement
}
impl HTMLDirectoryElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLDirectoryElement {
HTMLDirectoryElement {
htmlelement: HTMLElement::new_inherited(HTMLDirectoryElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLDirectoryElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLDirectoryElementBinding::Wrap)
}
}
impl HTMLDirectoryElement {
pub fn Compact(&self) -> bool {
false

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLDivElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLDivElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLDivElement {
htmlelement: HTMLElement
}
impl HTMLDivElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLDivElement {
HTMLDivElement {
htmlelement: HTMLElement::new_inherited(HTMLDivElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLDivElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLDivElementBinding::Wrap)
}
}
impl HTMLDivElement {
pub fn Align(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLDListElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLDListElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLDListElement {
htmlelement: HTMLElement
}
impl HTMLDListElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLDListElement {
HTMLDListElement {
htmlelement: HTMLElement::new_inherited(HTMLDListElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLDListElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLDListElementBinding::Wrap)
}
}
impl HTMLDListElement {
pub fn Compact(&self) -> bool {
false

View file

@ -2,10 +2,11 @@
* 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/. */
use dom::bindings::codegen::HTMLElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult, Fallible};
use dom::document::AbstractDocument;
use dom::element::{Element, ElementTypeId};
use dom::node::{AbstractNode, ScriptView};
use dom::element::{Element, ElementTypeId, HTMLElementTypeId};
use dom::node::{AbstractNode, Node, ScriptView};
use js::jsapi::{JSContext, JSVal};
use js::JSVAL_NULL;
@ -14,11 +15,16 @@ pub struct HTMLElement {
}
impl HTMLElement {
pub fn new(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLElement {
HTMLElement {
element: Element::new(type_id, tag_name, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, document);
Node::reflect_node(@mut element, document, HTMLElementBinding::Wrap)
}
}
impl HTMLElement {

View file

@ -2,14 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLEmbedElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLEmbedElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLEmbedElement {
htmlelement: HTMLElement
}
impl HTMLEmbedElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLEmbedElement {
HTMLEmbedElement {
htmlelement: HTMLElement::new_inherited(HTMLEmbedElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLEmbedElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLEmbedElementBinding::Wrap)
}
}
impl HTMLEmbedElement {
pub fn Src(&self) -> DOMString {
None

View file

@ -2,16 +2,32 @@
* 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/. */
use dom::bindings::codegen::HTMLFieldSetElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLFieldSetElementTypeId;
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, Node, ScriptView};
use dom::validitystate::ValidityState;
pub struct HTMLFieldSetElement {
htmlelement: HTMLElement
}
impl HTMLFieldSetElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLFieldSetElement {
HTMLFieldSetElement {
htmlelement: HTMLElement::new_inherited(HTMLFieldSetElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLFieldSetElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLFieldSetElementBinding::Wrap)
}
}
impl HTMLFieldSetElement {
pub fn Disabled(&self) -> bool {
false

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLFontElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLFontElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLFontElement {
htmlelement: HTMLElement
}
impl HTMLFontElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLFontElement {
HTMLFontElement {
htmlelement: HTMLElement::new_inherited(HTMLFontElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLFontElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLFontElementBinding::Wrap)
}
}
impl HTMLFontElement {
pub fn Color(&self) -> DOMString {
None

View file

@ -2,15 +2,31 @@
* 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/. */
use dom::bindings::codegen::HTMLFormElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLFormElementTypeId;
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLFormElement {
htmlelement: HTMLElement
}
impl HTMLFormElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLFormElement {
HTMLFormElement {
htmlelement: HTMLElement::new_inherited(HTMLFormElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLFormElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLFormElementBinding::Wrap)
}
}
impl HTMLFormElement {
pub fn AcceptCharset(&self) -> DOMString {
None

View file

@ -2,15 +2,31 @@
* 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/. */
use dom::bindings::codegen::HTMLFrameElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLFrameElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
use dom::windowproxy::WindowProxy;
pub struct HTMLFrameElement {
htmlelement: HTMLElement
}
impl HTMLFrameElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLFrameElement {
HTMLFrameElement {
htmlelement: HTMLElement::new_inherited(HTMLFrameElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLFrameElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLFrameElementBinding::Wrap)
}
}
impl HTMLFrameElement {
pub fn Name(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLFrameSetElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLFrameSetElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLFrameSetElement {
htmlelement: HTMLElement
}
impl HTMLFrameSetElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLFrameSetElement {
HTMLFrameSetElement {
htmlelement: HTMLElement::new_inherited(HTMLFrameSetElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLFrameSetElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLFrameSetElementBinding::Wrap)
}
}
impl HTMLFrameSetElement {
pub fn Cols(&self) -> DOMString {
None

View file

@ -2,8 +2,25 @@
* 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/. */
use dom::bindings::codegen::HTMLHeadElementBinding;
use dom::document::AbstractDocument;
use dom::element::HTMLHeadElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLHeadElement {
htmlelement: HTMLElement
}
impl HTMLHeadElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLHeadElement {
HTMLHeadElement {
htmlelement: HTMLElement::new_inherited(HTMLHeadElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLHeadElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLHeadElementBinding::Wrap)
}
}

View file

@ -26,7 +26,7 @@ pub struct HTMLHeadingElement {
impl HTMLHeadingElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument, level: HeadingLevel) -> HTMLHeadingElement {
HTMLHeadingElement {
htmlelement: HTMLElement::new(HTMLHeadingElementTypeId, localName, document),
htmlelement: HTMLElement::new_inherited(HTMLHeadingElementTypeId, localName, document),
level: level,
}
}

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLHRElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLHRElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLHRElement {
htmlelement: HTMLElement,
}
impl HTMLHRElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLHRElement {
HTMLHRElement {
htmlelement: HTMLElement::new_inherited(HTMLHRElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLHRElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLHRElementBinding::Wrap)
}
}
impl HTMLHRElement {
pub fn Align(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLHtmlElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLHtmlElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLHtmlElement {
htmlelement: HTMLElement
}
impl HTMLHtmlElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLHtmlElement {
HTMLHtmlElement {
htmlelement: HTMLElement::new_inherited(HTMLHtmlElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLHtmlElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLHtmlElementBinding::Wrap)
}
}
impl HTMLHtmlElement {
pub fn Version(&self) -> DOMString {
None

View file

@ -63,7 +63,7 @@ impl HTMLIFrameElement {
impl HTMLIFrameElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLIFrameElement {
HTMLIFrameElement {
htmlelement: HTMLElement::new(HTMLIframeElementTypeId, localName, document),
htmlelement: HTMLElement::new_inherited(HTMLIframeElementTypeId, localName, document),
frame: None,
size: None,
sandbox: None,

View file

@ -24,7 +24,7 @@ pub struct HTMLImageElement {
impl HTMLImageElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLImageElement {
HTMLImageElement {
htmlelement: HTMLElement::new(HTMLImageElementTypeId, localName, document),
htmlelement: HTMLElement::new_inherited(HTMLImageElementTypeId, localName, document),
image: None,
}
}

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLInputElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult, Fallible};
use dom::document::AbstractDocument;
use dom::element::HTMLInputElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLInputElement {
htmlelement: HTMLElement,
}
impl HTMLInputElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLInputElement {
HTMLInputElement {
htmlelement: HTMLElement::new_inherited(HTMLInputElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLInputElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLInputElementBinding::Wrap)
}
}
impl HTMLInputElement {
pub fn Accept(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLLabelElementBinding;
use dom::bindings::utils::DOMString;
use dom::document::AbstractDocument;
use dom::element::HTMLLabelElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLLabelElement {
htmlelement: HTMLElement,
}
impl HTMLLabelElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLLabelElement {
HTMLLabelElement {
htmlelement: HTMLElement::new_inherited(HTMLLabelElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLLabelElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLLabelElementBinding::Wrap)
}
}
impl HTMLLabelElement {
pub fn HtmlFor(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLLegendElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLLegendElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLLegendElement {
htmlelement: HTMLElement,
}
impl HTMLLegendElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLLegendElement {
HTMLLegendElement {
htmlelement: HTMLElement::new_inherited(HTMLLegendElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLLegendElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLLegendElementBinding::Wrap)
}
}
impl HTMLLegendElement {
pub fn Align(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLLIElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLLIElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLLIElement {
htmlelement: HTMLElement,
}
impl HTMLLIElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLLIElement {
HTMLLIElement {
htmlelement: HTMLElement::new_inherited(HTMLLIElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLLIElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLLIElementBinding::Wrap)
}
}
impl HTMLLIElement {
pub fn Value(&self) -> i32 {
0

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLLinkElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLLinkElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLLinkElement {
htmlelement: HTMLElement,
}
impl HTMLLinkElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLLinkElement {
HTMLLinkElement {
htmlelement: HTMLElement::new_inherited(HTMLLinkElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLLinkElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLLinkElementBinding::Wrap)
}
}
impl HTMLLinkElement {
pub fn Disabled(&self) -> bool {
false

View file

@ -2,8 +2,25 @@
* 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/. */
use dom::bindings::codegen::HTMLMainElementBinding;
use dom::document::AbstractDocument;
use dom::element::HTMLMainElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLMainElement {
htmlelement: HTMLElement
}
impl HTMLMainElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLMainElement {
HTMLMainElement {
htmlelement: HTMLElement::new_inherited(HTMLMainElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLMainElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLMainElementBinding::Wrap)
}
}

View file

@ -2,14 +2,31 @@
* 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/. */
use dom::bindings::codegen::HTMLMapElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::htmlcollection::HTMLCollection;
use dom::document::AbstractDocument;
use dom::element::HTMLMapElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLMapElement {
htmlelement: HTMLElement
}
impl HTMLMapElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLMapElement {
HTMLMapElement {
htmlelement: HTMLElement::new_inherited(HTMLMapElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLMapElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLMapElementBinding::Wrap)
}
}
impl HTMLMapElement {
pub fn Name(&self) -> DOMString {
None

View file

@ -14,7 +14,7 @@ pub struct HTMLMediaElement {
impl HTMLMediaElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLMediaElement {
HTMLMediaElement {
htmlelement: HTMLElement::new(type_id, tag_name, document)
htmlelement: HTMLElement::new_inherited(type_id, tag_name, document)
}
}
}

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLMetaElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLMetaElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLMetaElement {
htmlelement: HTMLElement,
}
impl HTMLMetaElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLMetaElement {
HTMLMetaElement {
htmlelement: HTMLElement::new_inherited(HTMLMetaElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLMetaElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLMetaElementBinding::Wrap)
}
}
impl HTMLMetaElement {
pub fn Name(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLMeterElementBinding;
use dom::bindings::utils::ErrorResult;
use dom::document::AbstractDocument;
use dom::element::HTMLMeterElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLMeterElement {
htmlelement: HTMLElement
}
impl HTMLMeterElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLMeterElement {
HTMLMeterElement {
htmlelement: HTMLElement::new_inherited(HTMLMeterElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLMeterElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLMeterElementBinding::Wrap)
}
}
impl HTMLMeterElement {
pub fn Value(&self) -> f64 {
0.0

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLModElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLModElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLModElement {
htmlelement: HTMLElement
}
impl HTMLModElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLModElement {
HTMLModElement {
htmlelement: HTMLElement::new_inherited(HTMLModElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLModElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLModElementBinding::Wrap)
}
}
impl HTMLModElement {
pub fn Cite(&self) -> DOMString {
None

View file

@ -2,10 +2,12 @@
* 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/. */
use dom::bindings::codegen::HTMLObjectElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLObjectElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, Node, ScriptView};
use dom::validitystate::ValidityState;
use dom::windowproxy::WindowProxy;
@ -13,6 +15,19 @@ pub struct HTMLObjectElement {
htmlelement: HTMLElement
}
impl HTMLObjectElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLObjectElement {
HTMLObjectElement {
htmlelement: HTMLElement::new_inherited(HTMLObjectElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLObjectElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLObjectElementBinding::Wrap)
}
}
impl HTMLObjectElement {
pub fn Data(&self) -> DOMString {
None

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLOListElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLOListElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLOListElement {
htmlelement: HTMLElement,
}
impl HTMLOListElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLOListElement {
HTMLOListElement {
htmlelement: HTMLElement::new_inherited(HTMLOListElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLOListElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLOListElementBinding::Wrap)
}
}
impl HTMLOListElement {
pub fn Reversed(&self) -> bool {
false

View file

@ -2,13 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLOptGroupElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLOptGroupElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLOptGroupElement {
htmlelement: HTMLElement
}
impl HTMLOptGroupElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLOptGroupElement {
HTMLOptGroupElement {
htmlelement: HTMLElement::new_inherited(HTMLOptGroupElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLOptGroupElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLOptGroupElementBinding::Wrap)
}
}
impl HTMLOptGroupElement {
pub fn Disabled(&self) -> bool {
false

View file

@ -2,14 +2,30 @@
* 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/. */
use dom::bindings::codegen::HTMLOptionElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLOptionElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLOptionElement {
htmlelement: HTMLElement
}
impl HTMLOptionElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLOptionElement {
HTMLOptionElement {
htmlelement: HTMLElement::new_inherited(HTMLOptionElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLOptionElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLOptionElementBinding::Wrap)
}
}
impl HTMLOptionElement {
pub fn Disabled(&self) -> bool {
false

View file

@ -2,15 +2,31 @@
* 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/. */
use dom::bindings::codegen::HTMLOutputElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLOutputElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, Node, ScriptView};
use dom::validitystate::ValidityState;
pub struct HTMLOutputElement {
htmlelement: HTMLElement
}
impl HTMLOutputElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLOutputElement {
HTMLOutputElement {
htmlelement: HTMLElement::new_inherited(HTMLOutputElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
let element = HTMLOutputElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLOutputElementBinding::Wrap)
}
}
impl HTMLOutputElement {
pub fn GetForm(&self) -> Option<AbstractNode<ScriptView>> {
None

View file

@ -16,7 +16,7 @@ pub struct HTMLParagraphElement {
impl HTMLParagraphElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLParagraphElement {
HTMLParagraphElement {
htmlelement: HTMLElement::new(HTMLParagraphElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLParagraphElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLParamElement {
impl HTMLParamElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLParamElement {
HTMLParamElement {
htmlelement: HTMLElement::new(HTMLParamElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLParamElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLPreElement {
impl HTMLPreElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLPreElement {
HTMLPreElement {
htmlelement: HTMLElement::new(HTMLPreElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLPreElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLProgressElement {
impl HTMLProgressElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLProgressElement {
HTMLProgressElement {
htmlelement: HTMLElement::new(HTMLProgressElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLProgressElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLQuoteElement {
impl HTMLQuoteElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLQuoteElement {
HTMLQuoteElement {
htmlelement: HTMLElement::new(HTMLQuoteElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLQuoteElementTypeId, localName, document)
}
}

View file

@ -17,7 +17,7 @@ pub struct HTMLScriptElement {
impl HTMLScriptElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLScriptElement {
HTMLScriptElement {
htmlelement: HTMLElement::new(HTMLScriptElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLScriptElementTypeId, localName, document)
}
}

View file

@ -17,7 +17,7 @@ pub struct HTMLSelectElement {
impl HTMLSelectElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLSelectElement {
HTMLSelectElement {
htmlelement: HTMLElement::new(HTMLSelectElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLSelectElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLSourceElement {
impl HTMLSourceElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLSourceElement {
HTMLSourceElement {
htmlelement: HTMLElement::new(HTMLSourceElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLSourceElementTypeId, localName, document)
}
}

View file

@ -15,7 +15,7 @@ pub struct HTMLSpanElement {
impl HTMLSpanElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLSpanElement {
HTMLSpanElement {
htmlelement: HTMLElement::new(HTMLSpanElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLSpanElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLStyleElement {
impl HTMLStyleElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLStyleElement {
HTMLStyleElement {
htmlelement: HTMLElement::new(HTMLStyleElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLStyleElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTableCaptionElement {
impl HTMLTableCaptionElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableCaptionElement {
HTMLTableCaptionElement {
htmlelement: HTMLElement::new(HTMLTableCaptionElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTableCaptionElementTypeId, localName, document)
}
}

View file

@ -14,7 +14,7 @@ pub struct HTMLTableCellElement {
impl HTMLTableCellElement {
pub fn new_inherited(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLTableCellElement {
HTMLTableCellElement {
htmlelement: HTMLElement::new(type_id, tag_name, document)
htmlelement: HTMLElement::new_inherited(type_id, tag_name, document)
}
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTableColElement {
impl HTMLTableColElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableColElement {
HTMLTableColElement {
htmlelement: HTMLElement::new(HTMLTableColElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTableColElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTableElement {
impl HTMLTableElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableElement {
HTMLTableElement {
htmlelement: HTMLElement::new(HTMLTableElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTableElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTableRowElement {
impl HTMLTableRowElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableRowElement {
HTMLTableRowElement {
htmlelement: HTMLElement::new(HTMLTableRowElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTableRowElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTableSectionElement {
impl HTMLTableSectionElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableSectionElement {
HTMLTableSectionElement {
htmlelement: HTMLElement::new(HTMLTableSectionElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTableSectionElementTypeId, localName, document)
}
}

View file

@ -15,7 +15,7 @@ pub struct HTMLTemplateElement {
impl HTMLTemplateElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTemplateElement {
HTMLTemplateElement {
htmlelement: HTMLElement::new(HTMLTemplateElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTemplateElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTextAreaElement {
impl HTMLTextAreaElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTextAreaElement {
HTMLTextAreaElement {
htmlelement: HTMLElement::new(HTMLTextAreaElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTextAreaElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTimeElement {
impl HTMLTimeElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTimeElement {
HTMLTimeElement {
htmlelement: HTMLElement::new(HTMLTimeElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTimeElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTitleElement {
impl HTMLTitleElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTitleElement {
HTMLTitleElement {
htmlelement: HTMLElement::new(HTMLTitleElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTitleElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLTrackElement {
impl HTMLTrackElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTrackElement {
HTMLTrackElement {
htmlelement: HTMLElement::new(HTMLTrackElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLTrackElementTypeId, localName, document)
}
}

View file

@ -16,7 +16,7 @@ pub struct HTMLUListElement {
impl HTMLUListElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLUListElement {
HTMLUListElement {
htmlelement: HTMLElement::new(HTMLUListElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLUListElementTypeId, localName, document)
}
}

View file

@ -15,7 +15,7 @@ pub struct HTMLUnknownElement {
impl HTMLUnknownElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLUnknownElement {
HTMLUnknownElement {
htmlelement: HTMLElement::new(HTMLUnknownElementTypeId, localName, document)
htmlelement: HTMLElement::new_inherited(HTMLUnknownElementTypeId, localName, document)
}
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::document::AbstractDocument;
use dom::element::*;
use dom::element::{HTMLLinkElementTypeId, HTMLIframeElementTypeId, HTMLImageElementTypeId};
use dom::htmlelement::HTMLElement;
use dom::htmlheadingelement::{Heading1, Heading2, Heading3, Heading4, Heading5, Heading6};
use dom::htmliframeelement::IFrameSize;
@ -33,58 +33,13 @@ use extra::url::Url;
use geom::size::Size2D;
macro_rules! handle_element(
($cx: expr,
$document: expr,
$tag: expr,
$string: expr,
$type_id: expr,
$ctor: ident,
[ $(($field:ident : $field_init:expr)),* ]) => (
handle_element_base!(htmlelement, HTMLElement,
$cx, $document, $tag, $string, $type_id, $ctor,
[$(($field:$field_init)),*]);
)
)
macro_rules! handle_htmlelement(
($cx: expr,
$document: expr,
$tag: expr,
$string: expr,
$type_id: expr,
$ctor: ident) => (
handle_element_base!(element, Element,
$cx, $document, $tag, $string, $type_id, $ctor, []);
)
)
macro_rules! handle_newable_element(
($document: expr,
$localName: expr,
$string: expr,
$ctor: ident
$(, $arg:expr )*) => (
if eq_slice($localName, $string) {
return $ctor::new(($localName).to_str(), $document $(, $arg)*);
}
)
)
macro_rules! handle_element_base(
($parent: ident,
$parent_init: ident,
$cx: expr,
$document: expr,
$tag: expr,
$string: expr,
$type_id: expr,
$ctor: ident,
[ $(($field:ident : $field_init:expr)),* ]) => (
if eq_slice($tag, $string) {
let _element = @$ctor {
$parent: $parent_init::new($type_id, ($tag).to_str(), $document),
$(
$field: $field_init,
)*
};
return unsafe { Node::as_abstract_node($cx, _element) };
return $ctor::new($localName, $document $(, $arg)*);
}
)
)
@ -207,88 +162,87 @@ fn js_script_listener(to_parent: SharedChan<HtmlDiscoveryMessage>,
// Silly macros to handle constructing DOM nodes. This produces bad code and should be optimized
// via atomization (issue #85).
pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocument) -> AbstractNode<ScriptView> {
pub fn build_element_from_tag(tag: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
// TODO (Issue #85): use atoms
handle_element!(cx, document, tag, "a", HTMLAnchorElementTypeId, HTMLAnchorElement, []);
handle_element!(cx, document, tag, "applet", HTMLAppletElementTypeId, HTMLAppletElement, []);
handle_element!(cx, document, tag, "area", HTMLAreaElementTypeId, HTMLAreaElement, []);
handle_element!(cx, document, tag, "base", HTMLBaseElementTypeId, HTMLBaseElement, []);
handle_element!(cx, document, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []);
handle_element!(cx, document, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
handle_element!(cx, document, tag, "button", HTMLButtonElementTypeId, HTMLButtonElement, []);
handle_element!(cx, document, tag, "canvas", HTMLCanvasElementTypeId, HTMLCanvasElement, []);
handle_element!(cx, document, tag, "data", HTMLDataElementTypeId, HTMLDataElement, []);
handle_element!(cx, document, tag, "datalist",HTMLDataListElementTypeId, HTMLDataListElement, []);
handle_element!(cx, document, tag, "dir", HTMLDirectoryElementTypeId, HTMLDirectoryElement, []);
handle_element!(cx, document, tag, "div", HTMLDivElementTypeId, HTMLDivElement, []);
handle_element!(cx, document, tag, "dl", HTMLDListElementTypeId, HTMLDListElement, []);
handle_element!(cx, document, tag, "embed", HTMLEmbedElementTypeId, HTMLEmbedElement, []);
handle_element!(cx, document, tag, "fieldset",HTMLFieldSetElementTypeId, HTMLFieldSetElement, []);
handle_element!(cx, document, tag, "font", HTMLFontElementTypeId, HTMLFontElement, []);
handle_element!(cx, document, tag, "form", HTMLFormElementTypeId, HTMLFormElement, []);
handle_element!(cx, document, tag, "frame", HTMLFrameElementTypeId, HTMLFrameElement, []);
handle_element!(cx, document, tag, "frameset",HTMLFrameSetElementTypeId, HTMLFrameSetElement, []);
handle_element!(cx, document, tag, "hr", HTMLHRElementTypeId, HTMLHRElement, []);
handle_element!(cx, document, tag, "head", HTMLHeadElementTypeId, HTMLHeadElement, []);
handle_element!(cx, document, tag, "html", HTMLHtmlElementTypeId, HTMLHtmlElement, []);
handle_element!(cx, document, tag, "input", HTMLInputElementTypeId, HTMLInputElement, []);
handle_element!(cx, document, tag, "label", HTMLLabelElementTypeId, HTMLLabelElement, []);
handle_element!(cx, document, tag, "legend", HTMLLegendElementTypeId, HTMLLegendElement, []);
handle_element!(cx, document, tag, "link", HTMLLinkElementTypeId, HTMLLinkElement, []);
handle_element!(cx, document, tag, "li", HTMLLIElementTypeId, HTMLLIElement, []);
handle_element!(cx, document, tag, "map", HTMLMapElementTypeId, HTMLMapElement, []);
handle_element!(cx, document, tag, "main", HTMLMainElementTypeId, HTMLMainElement, []);
handle_element!(cx, document, tag, "meta", HTMLMetaElementTypeId, HTMLMetaElement, []);
handle_element!(cx, document, tag, "meter", HTMLMeterElementTypeId, HTMLMeterElement, []);
handle_element!(cx, document, tag, "mod", HTMLModElementTypeId, HTMLModElement, []);
handle_element!(cx, document, tag, "object", HTMLObjectElementTypeId, HTMLObjectElement, []);
handle_element!(cx, document, tag, "ol", HTMLOListElementTypeId, HTMLOListElement, []);
handle_element!(cx, document, tag, "option", HTMLOptionElementTypeId, HTMLOptionElement, []);
handle_element!(cx, document, tag, "optgroup",HTMLOptGroupElementTypeId, HTMLOptGroupElement, []);
handle_element!(cx, document, tag, "output", HTMLOutputElementTypeId, HTMLOutputElement, []);
handle_element!(document, tag, "a", HTMLAnchorElement);
handle_element!(document, tag, "applet", HTMLAppletElement);
handle_element!(document, tag, "area", HTMLAreaElement);
handle_element!(document, tag, "aside", HTMLElement);
handle_element!(document, tag, "audio", HTMLAudioElement);
handle_element!(document, tag, "b", HTMLElement);
handle_element!(document, tag, "base", HTMLBaseElement);
handle_element!(document, tag, "body", HTMLBodyElement);
handle_element!(document, tag, "br", HTMLBRElement);
handle_element!(document, tag, "button", HTMLButtonElement);
handle_element!(document, tag, "canvas", HTMLCanvasElement);
handle_element!(document, tag, "caption", HTMLTableCaptionElement);
handle_element!(document, tag, "col", HTMLTableColElement);
handle_element!(document, tag, "colgroup", HTMLTableColElement);
handle_element!(document, tag, "data", HTMLDataElement);
handle_element!(document, tag, "datalist", HTMLDataListElement);
handle_element!(document, tag, "del", HTMLModElement);
handle_element!(document, tag, "dir", HTMLDirectoryElement);
handle_element!(document, tag, "div", HTMLDivElement);
handle_element!(document, tag, "dl", HTMLDListElement);
handle_element!(document, tag, "embed", HTMLEmbedElement);
handle_element!(document, tag, "fieldset", HTMLFieldSetElement);
handle_element!(document, tag, "font", HTMLFontElement);
handle_element!(document, tag, "form", HTMLFormElement);
handle_element!(document, tag, "frame", HTMLFrameElement);
handle_element!(document, tag, "frameset", HTMLFrameSetElement);
handle_element!(document, tag, "h1", HTMLHeadingElement, Heading1);
handle_element!(document, tag, "h2", HTMLHeadingElement, Heading2);
handle_element!(document, tag, "h3", HTMLHeadingElement, Heading3);
handle_element!(document, tag, "h4", HTMLHeadingElement, Heading4);
handle_element!(document, tag, "h5", HTMLHeadingElement, Heading5);
handle_element!(document, tag, "h6", HTMLHeadingElement, Heading6);
handle_element!(document, tag, "head", HTMLHeadElement);
handle_element!(document, tag, "hr", HTMLHRElement);
handle_element!(document, tag, "html", HTMLHtmlElement);
handle_element!(document, tag, "i", HTMLElement);
handle_element!(document, tag, "iframe", HTMLIFrameElement);
handle_element!(document, tag, "img", HTMLImageElement);
handle_element!(document, tag, "input", HTMLInputElement);
handle_element!(document, tag, "ins", HTMLModElement);
handle_element!(document, tag, "label", HTMLLabelElement);
handle_element!(document, tag, "legend", HTMLLegendElement);
handle_element!(document, tag, "li", HTMLLIElement);
handle_element!(document, tag, "link", HTMLLinkElement);
handle_element!(document, tag, "main", HTMLMainElement);
handle_element!(document, tag, "map", HTMLMapElement);
handle_element!(document, tag, "meta", HTMLMetaElement);
handle_element!(document, tag, "meter", HTMLMeterElement);
handle_element!(document, tag, "object", HTMLObjectElement);
handle_element!(document, tag, "ol", HTMLOListElement);
handle_element!(document, tag, "optgroup", HTMLOptGroupElement);
handle_element!(document, tag, "option", HTMLOptionElement);
handle_element!(document, tag, "output", HTMLOutputElement);
handle_element!(document, tag, "p", HTMLParagraphElement);
handle_element!(document, tag, "param", HTMLParamElement);
handle_element!(document, tag, "pre", HTMLPreElement);
handle_element!(document, tag, "progress", HTMLProgressElement);
handle_element!(document, tag, "q", HTMLQuoteElement);
handle_element!(document, tag, "script", HTMLScriptElement);
handle_element!(document, tag, "section", HTMLElement);
handle_element!(document, tag, "select", HTMLSelectElement);
handle_element!(document, tag, "small", HTMLElement);
handle_element!(document, tag, "source", HTMLSourceElement);
handle_element!(document, tag, "span", HTMLSpanElement);
handle_element!(document, tag, "style", HTMLStyleElement);
handle_element!(document, tag, "table", HTMLTableElement);
handle_element!(document, tag, "tbody", HTMLTableSectionElement);
handle_element!(document, tag, "td", HTMLTableDataCellElement);
handle_element!(document, tag, "template", HTMLTemplateElement);
handle_element!(document, tag, "textarea", HTMLTextAreaElement);
handle_element!(document, tag, "th", HTMLTableHeaderCellElement);
handle_element!(document, tag, "time", HTMLTimeElement);
handle_element!(document, tag, "title", HTMLTitleElement);
handle_element!(document, tag, "tr", HTMLTableRowElement);
handle_element!(document, tag, "track", HTMLTrackElement);
handle_element!(document, tag, "ul", HTMLUListElement);
handle_element!(document, tag, "video", HTMLVideoElement);
handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "i", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "section", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "small", HTMLElementTypeId, HTMLElement);
handle_newable_element!(document, tag, "audio", HTMLAudioElement);
handle_newable_element!(document, tag, "caption", HTMLTableCaptionElement);
handle_newable_element!(document, tag, "col", HTMLTableColElement);
handle_newable_element!(document, tag, "colgroup", HTMLTableColElement);
handle_newable_element!(document, tag, "h1", HTMLHeadingElement, Heading1);
handle_newable_element!(document, tag, "h2", HTMLHeadingElement, Heading2);
handle_newable_element!(document, tag, "h3", HTMLHeadingElement, Heading3);
handle_newable_element!(document, tag, "h4", HTMLHeadingElement, Heading4);
handle_newable_element!(document, tag, "h5", HTMLHeadingElement, Heading5);
handle_newable_element!(document, tag, "h6", HTMLHeadingElement, Heading6);
handle_newable_element!(document, tag, "iframe", HTMLIFrameElement);
handle_newable_element!(document, tag, "img", HTMLImageElement);
handle_newable_element!(document, tag, "p", HTMLParagraphElement);
handle_newable_element!(document, tag, "param", HTMLParamElement);
handle_newable_element!(document, tag, "pre", HTMLPreElement);
handle_newable_element!(document, tag, "progress", HTMLProgressElement);
handle_newable_element!(document, tag, "q", HTMLQuoteElement);
handle_newable_element!(document, tag, "script", HTMLScriptElement);
handle_newable_element!(document, tag, "select", HTMLSelectElement);
handle_newable_element!(document, tag, "source", HTMLSourceElement);
handle_newable_element!(document, tag, "span", HTMLSpanElement);
handle_newable_element!(document, tag, "style", HTMLStyleElement);
handle_newable_element!(document, tag, "table", HTMLTableElement);
handle_newable_element!(document, tag, "tbody", HTMLTableSectionElement);
handle_newable_element!(document, tag, "td", HTMLTableDataCellElement);
handle_newable_element!(document, tag, "template", HTMLTemplateElement);
handle_newable_element!(document, tag, "textarea", HTMLTextAreaElement);
handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement);
handle_newable_element!(document, tag, "time", HTMLTimeElement);
handle_newable_element!(document, tag, "title", HTMLTitleElement);
handle_newable_element!(document, tag, "tr", HTMLTableRowElement);
handle_newable_element!(document, tag, "track", HTMLTrackElement);
handle_newable_element!(document, tag, "ul", HTMLUListElement);
handle_newable_element!(document, tag, "video", HTMLVideoElement);
return HTMLUnknownElement::new(tag.to_str(), document);
return HTMLUnknownElement::new(tag, document);
}
pub fn parse_html(cx: *JSContext,
@ -346,8 +300,7 @@ pub fn parse_html(cx: *JSContext,
}
// Build the root node.
let root = @HTMLHtmlElement { htmlelement: HTMLElement::new(HTMLHtmlElementTypeId, ~"html", document) };
let root = unsafe { Node::as_abstract_node(cx, root) };
let root = HTMLHtmlElement::new(~"html", document);
debug!("created new node");
let mut parser = hubbub::Parser("UTF-8", false);
debug!("created parser");
@ -383,7 +336,7 @@ pub fn parse_html(cx: *JSContext,
},
create_element: |tag: ~hubbub::Tag| {
debug!("create element");
let node = build_element_from_tag(cx, tag.name, document);
let node = build_element_from_tag(tag.name.clone(), document);
debug!("-- attach attrs");
do node.as_mut_element |element| {