From 618447445f8af2be4a4f2aaed5e586d9c02c3137 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 15:22:15 +0100 Subject: [PATCH 01/26] Introduce HTML{Audio,Video}Element::new. --- src/components/script/dom/htmlaudioelement.rs | 14 +++++++++++++ src/components/script/dom/htmlmediaelement.rs | 2 +- src/components/script/dom/htmlvideoelement.rs | 17 ++++++++++++++++ .../script/html/hubbub_html_parser.rs | 20 +++++++++---------- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/components/script/dom/htmlaudioelement.rs b/src/components/script/dom/htmlaudioelement.rs index dbb33a42331..6ece4235c7c 100644 --- a/src/components/script/dom/htmlaudioelement.rs +++ b/src/components/script/dom/htmlaudioelement.rs @@ -2,11 +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::HTMLAudioElementBinding; +use dom::document::AbstractDocument; +use dom::element::HTMLAudioElementTypeId; use dom::htmlmediaelement::HTMLMediaElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLAudioElement { htmlmediaelement: HTMLMediaElement } impl HTMLAudioElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLAudioElement { + HTMLAudioElement { + htmlmediaelement: HTMLMediaElement::new_inherited(HTMLAudioElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLAudioElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLAudioElementBinding::Wrap) + } } diff --git a/src/components/script/dom/htmlmediaelement.rs b/src/components/script/dom/htmlmediaelement.rs index 39c45a3585d..683ae7bf2e1 100644 --- a/src/components/script/dom/htmlmediaelement.rs +++ b/src/components/script/dom/htmlmediaelement.rs @@ -12,7 +12,7 @@ pub struct HTMLMediaElement { } impl HTMLMediaElement { - pub fn new(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLMediaElement { + pub fn new_inherited(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLMediaElement { HTMLMediaElement { htmlelement: HTMLElement::new(type_id, tag_name, document) } diff --git a/src/components/script/dom/htmlvideoelement.rs b/src/components/script/dom/htmlvideoelement.rs index a485480ad04..b78e13947e8 100644 --- a/src/components/script/dom/htmlvideoelement.rs +++ b/src/components/script/dom/htmlvideoelement.rs @@ -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::HTMLVideoElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLVideoElementTypeId; use dom::htmlmediaelement::HTMLMediaElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLVideoElement { htmlmediaelement: HTMLMediaElement } +impl HTMLVideoElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLVideoElement { + HTMLVideoElement { + htmlmediaelement: HTMLMediaElement::new_inherited(HTMLVideoElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLVideoElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLVideoElementBinding::Wrap) + } +} + impl HTMLVideoElement { pub fn Width(&self) -> u32 { 0 diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index d6883cb8acc..a8587de354e 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -56,15 +56,15 @@ macro_rules! handle_htmlelement( $cx, $document, $tag, $string, $type_id, $ctor, []); ) ) -macro_rules! handle_htmlmediaelement( - ($cx: expr, - $document: expr, - $tag: expr, +macro_rules! handle_newable_element( + ($document: expr, + $localName: expr, $string: expr, - $type_id: expr, - $ctor: ident) => ( - handle_element_base!(htmlmediaelement, HTMLMediaElement, - $cx, $document, $tag, $string, $type_id, $ctor, []); + $ctor: ident + $(, $arg:expr )*) => ( + if eq_slice($localName, $string) { + return $ctor::new(($localName).to_str(), $document $(, $arg)*); + } ) ) macro_rules! handle_htmltablecellelement( @@ -298,8 +298,8 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_htmlelement!(cx, document, tag, "section", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "small", HTMLElementTypeId, HTMLElement); - handle_htmlmediaelement!(cx, document, tag, "audio", HTMLAudioElementTypeId, HTMLAudioElement); - handle_htmlmediaelement!(cx, document, tag, "video", HTMLVideoElementTypeId, HTMLVideoElement); + handle_newable_element!(document, tag, "audio", HTMLAudioElement); + handle_newable_element!(document, tag, "video", HTMLVideoElement); handle_htmltablecellelement!(cx, document, tag, "td", HTMLTableDataCellElementTypeId, HTMLTableDataCellElement); handle_htmltablecellelement!(cx, document, tag, "th", HTMLTableHeaderCellElementTypeId, HTMLTableHeaderCellElement); From a972c470a772c27d4a999aca65ad5e40d7dea035 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 15:31:15 +0100 Subject: [PATCH 02/26] Introduce HTMLTable{Data,Header}CellElement::new. --- .../script/dom/htmltablecellelement.rs | 2 +- .../script/dom/htmltabledatacellelement.rs | 17 +++++++++++++++++ .../script/dom/htmltableheadercellelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 16 ++-------------- 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/components/script/dom/htmltablecellelement.rs b/src/components/script/dom/htmltablecellelement.rs index 365030b90be..771cd389ecb 100644 --- a/src/components/script/dom/htmltablecellelement.rs +++ b/src/components/script/dom/htmltablecellelement.rs @@ -12,7 +12,7 @@ pub struct HTMLTableCellElement { } impl HTMLTableCellElement { - pub fn new(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLTableCellElement { + pub fn new_inherited(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> HTMLTableCellElement { HTMLTableCellElement { htmlelement: HTMLElement::new(type_id, tag_name, document) } diff --git a/src/components/script/dom/htmltabledatacellelement.rs b/src/components/script/dom/htmltabledatacellelement.rs index f0a69d97409..4b3dda09745 100644 --- a/src/components/script/dom/htmltabledatacellelement.rs +++ b/src/components/script/dom/htmltabledatacellelement.rs @@ -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::HTMLTableDataCellElementBinding; +use dom::document::AbstractDocument; +use dom::element::HTMLTableDataCellElementTypeId; use dom::htmltablecellelement::HTMLTableCellElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableDataCellElement { htmltablecellelement: HTMLTableCellElement, } + +impl HTMLTableDataCellElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableDataCellElement { + HTMLTableDataCellElement { + htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableDataCellElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableDataCellElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableDataCellElementBinding::Wrap) + } +} diff --git a/src/components/script/dom/htmltableheadercellelement.rs b/src/components/script/dom/htmltableheadercellelement.rs index e7bb4b0fa38..59a9d596aea 100644 --- a/src/components/script/dom/htmltableheadercellelement.rs +++ b/src/components/script/dom/htmltableheadercellelement.rs @@ -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::HTMLTableHeaderCellElementBinding; +use dom::document::AbstractDocument; +use dom::element::HTMLTableHeaderCellElementTypeId; use dom::htmltablecellelement::HTMLTableCellElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableHeaderCellElement { htmltablecellelement: HTMLTableCellElement, } + +impl HTMLTableHeaderCellElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableHeaderCellElement { + HTMLTableHeaderCellElement { + htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableHeaderCellElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableHeaderCellElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableHeaderCellElementBinding::Wrap) + } +} diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index a8587de354e..57053657185 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -67,17 +67,6 @@ macro_rules! handle_newable_element( } ) ) -macro_rules! handle_htmltablecellelement( - ($cx: expr, - $document: expr, - $tag: expr, - $string: expr, - $type_id: expr, - $ctor: ident) => ( - handle_element_base!(htmltablecellelement, HTMLTableCellElement, - $cx, $document, $tag, $string, $type_id, $ctor, []); - ) -) macro_rules! handle_element_base( ($parent: ident, $parent_init: ident, @@ -299,11 +288,10 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_htmlelement!(cx, document, tag, "small", HTMLElementTypeId, HTMLElement); handle_newable_element!(document, tag, "audio", HTMLAudioElement); + handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); + handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); handle_newable_element!(document, tag, "video", HTMLVideoElement); - handle_htmltablecellelement!(cx, document, tag, "td", HTMLTableDataCellElementTypeId, HTMLTableDataCellElement); - handle_htmltablecellelement!(cx, document, tag, "th", HTMLTableHeaderCellElementTypeId, HTMLTableHeaderCellElement); - return HTMLUnknownElement::new(tag.to_str(), document); } From 8e5cd9f3a86798ab382e3cfdefe37e06ed121544 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 15:37:37 +0100 Subject: [PATCH 03/26] Introduce HTMLHeadingElement::new. --- .../script/dom/htmlheadingelement.rs | 18 ++++++++++++++++++ .../script/html/hubbub_html_parser.rs | 14 ++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/script/dom/htmlheadingelement.rs b/src/components/script/dom/htmlheadingelement.rs index e9f470f7e8a..13370230c8b 100644 --- a/src/components/script/dom/htmlheadingelement.rs +++ b/src/components/script/dom/htmlheadingelement.rs @@ -2,8 +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::HTMLHeadingElementBinding; use dom::bindings::utils::DOMString; +use dom::document::AbstractDocument; +use dom::element::HTMLHeadingElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub enum HeadingLevel { Heading1, @@ -19,6 +23,20 @@ pub struct HTMLHeadingElement { level: HeadingLevel, } +impl HTMLHeadingElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument, level: HeadingLevel) -> HTMLHeadingElement { + HTMLHeadingElement { + htmlelement: HTMLElement::new(HTMLHeadingElementTypeId, localName, document), + level: level, + } + } + + pub fn new(localName: ~str, document: AbstractDocument, level: HeadingLevel) -> AbstractNode { + let element = HTMLHeadingElement::new_inherited(localName, document, level); + Node::reflect_node(@mut element, document, HTMLHeadingElementBinding::Wrap) + } +} + impl HTMLHeadingElement { pub fn Align(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 57053657185..7d8553b6099 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -273,14 +273,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "img", HTMLImageElementTypeId, HTMLImageElement, [(image: None)]); handle_element!(cx, document, tag, "iframe", HTMLIframeElementTypeId, HTMLIFrameElement, [(frame: None), (size: None), (sandbox: None)]); - handle_element!(cx, document, tag, "h1", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading1)]); - handle_element!(cx, document, tag, "h2", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading2)]); - handle_element!(cx, document, tag, "h3", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading3)]); - handle_element!(cx, document, tag, "h4", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading4)]); - handle_element!(cx, document, tag, "h5", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading5)]); - handle_element!(cx, document, tag, "h6", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading6)]); - - handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "i", HTMLElementTypeId, HTMLElement); @@ -288,6 +280,12 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_htmlelement!(cx, document, tag, "small", HTMLElementTypeId, HTMLElement); handle_newable_element!(document, tag, "audio", HTMLAudioElement); + 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, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); handle_newable_element!(document, tag, "video", HTMLVideoElement); From 7c17970c216fb1f3d2b5d56b973de8043a044de7 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 15:53:43 +0100 Subject: [PATCH 04/26] Introduce HTMLIFrameElement::new. --- .../script/dom/htmliframeelement.rs | 20 ++++++++++++++++++- .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/script/dom/htmliframeelement.rs b/src/components/script/dom/htmliframeelement.rs index bbe98d4565e..efb47baaf48 100644 --- a/src/components/script/dom/htmliframeelement.rs +++ b/src/components/script/dom/htmliframeelement.rs @@ -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::HTMLIFrameElementBinding; use dom::bindings::utils::{DOMString, ErrorResult, null_str_as_empty}; use dom::document::AbstractDocument; +use dom::element::HTMLIframeElementTypeId; use dom::htmlelement::HTMLElement; -use dom::node::{AbstractNode, ScriptView}; +use dom::node::{AbstractNode, Node, ScriptView}; use dom::windowproxy::WindowProxy; use geom::size::Size2D; use geom::rect::Rect; @@ -58,6 +60,22 @@ impl HTMLIFrameElement { } } +impl HTMLIFrameElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLIFrameElement { + HTMLIFrameElement { + htmlelement: HTMLElement::new(HTMLIframeElementTypeId, localName, document), + frame: None, + size: None, + sandbox: None, + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLIFrameElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLIFrameElementBinding::Wrap) + } +} + impl HTMLIFrameElement { pub fn Src(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 7d8553b6099..ff7b17d5997 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -271,7 +271,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []); handle_element!(cx, document, tag, "img", HTMLImageElementTypeId, HTMLImageElement, [(image: None)]); - handle_element!(cx, document, tag, "iframe", HTMLIframeElementTypeId, HTMLIFrameElement, [(frame: None), (size: None), (sandbox: None)]); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -286,6 +285,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); handle_newable_element!(document, tag, "video", HTMLVideoElement); From c9bc5f64094ed52a344fcb0c9b1b83809102c3fa Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:01:54 +0100 Subject: [PATCH 05/26] Introduce HTMLImageElement::new. --- src/components/script/dom/htmlimageelement.rs | 19 ++++++++++++++++++- .../script/html/hubbub_html_parser.rs | 3 +-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/script/dom/htmlimageelement.rs b/src/components/script/dom/htmlimageelement.rs index 49010ee0f62..f10dccf28d4 100644 --- a/src/components/script/dom/htmlimageelement.rs +++ b/src/components/script/dom/htmlimageelement.rs @@ -2,9 +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::HTMLImageElementBinding; use dom::bindings::utils::{DOMString, ErrorResult, null_str_as_empty}; +use dom::document::AbstractDocument; +use dom::element::HTMLImageElementTypeId; use dom::htmlelement::HTMLElement; -use dom::node::{ScriptView, AbstractNode}; +use dom::node::{AbstractNode, Node, ScriptView}; use extra::url::Url; use servo_util::geometry::to_px; use layout_interface::{ContentBoxQuery, ContentBoxResponse}; @@ -18,6 +21,20 @@ pub struct HTMLImageElement { image: Option, } +impl HTMLImageElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLImageElement { + HTMLImageElement { + htmlelement: HTMLElement::new(HTMLImageElementTypeId, localName, document), + image: None, + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLImageElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLImageElementBinding::Wrap) + } +} + impl HTMLImageElement { /// Makes the local `image` member match the status of the `src` attribute and starts /// prefetching the image. This method must be called after `src` is changed. diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index ff7b17d5997..200c101ef9e 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -270,8 +270,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "track", HTMLTrackElementTypeId, HTMLTrackElement, []); handle_element!(cx, document, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []); - handle_element!(cx, document, tag, "img", HTMLImageElementTypeId, HTMLImageElement, [(image: None)]); - handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "i", HTMLElementTypeId, HTMLElement); @@ -286,6 +284,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); handle_newable_element!(document, tag, "video", HTMLVideoElement); From 82e3f71750083b73c4b8bbdbc1d301e388123ea8 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:09:50 +0100 Subject: [PATCH 06/26] Introduce HTMLUListElement::new. --- src/components/script/dom/htmlulistelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlulistelement.rs b/src/components/script/dom/htmlulistelement.rs index 5883687b653..478d34681f9 100644 --- a/src/components/script/dom/htmlulistelement.rs +++ b/src/components/script/dom/htmlulistelement.rs @@ -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::HTMLUListElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLUListElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLUListElement { htmlelement: HTMLElement } +impl HTMLUListElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLUListElement { + HTMLUListElement { + htmlelement: HTMLElement::new(HTMLUListElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLUListElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLUListElementBinding::Wrap) + } +} + impl HTMLUListElement { pub fn Compact(&self) -> bool { false diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 200c101ef9e..1dd5b4f88dc 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -268,7 +268,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []); handle_element!(cx, document, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []); handle_element!(cx, document, tag, "track", HTMLTrackElementTypeId, HTMLTrackElement, []); - handle_element!(cx, document, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -287,6 +286,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "img", HTMLImageElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); + handle_newable_element!(document, tag, "ul", HTMLUListElement); handle_newable_element!(document, tag, "video", HTMLVideoElement); return HTMLUnknownElement::new(tag.to_str(), document); From 5f0e8471e343cedd9c8c259b4288db16a1094564 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:11:27 +0100 Subject: [PATCH 07/26] Introduce HTMLTrackElement::new. --- src/components/script/dom/htmltrackelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltrackelement.rs b/src/components/script/dom/htmltrackelement.rs index 4c3e7cb055c..9b6fae79360 100644 --- a/src/components/script/dom/htmltrackelement.rs +++ b/src/components/script/dom/htmltrackelement.rs @@ -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::HTMLTrackElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTrackElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTrackElement { htmlelement: HTMLElement, } +impl HTMLTrackElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTrackElement { + HTMLTrackElement { + htmlelement: HTMLElement::new(HTMLTrackElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTrackElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTrackElementBinding::Wrap) + } +} + impl HTMLTrackElement { pub fn Kind(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 1dd5b4f88dc..43ffca78e9b 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -267,7 +267,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "time", HTMLTimeElementTypeId, HTMLTimeElement, []); handle_element!(cx, document, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []); handle_element!(cx, document, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []); - handle_element!(cx, document, tag, "track", HTMLTrackElementTypeId, HTMLTrackElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -286,6 +285,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "img", HTMLImageElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); + handle_newable_element!(document, tag, "track", HTMLTrackElement); handle_newable_element!(document, tag, "ul", HTMLUListElement); handle_newable_element!(document, tag, "video", HTMLVideoElement); From 53562090dc83bae4ccd29950836765bbd81a344e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:29:17 +0100 Subject: [PATCH 08/26] Introduce HTMLTableRowElement::new. --- .../script/dom/htmltablerowelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltablerowelement.rs b/src/components/script/dom/htmltablerowelement.rs index c86899c238a..5d61f0e7fb5 100644 --- a/src/components/script/dom/htmltablerowelement.rs +++ b/src/components/script/dom/htmltablerowelement.rs @@ -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::HTMLTableRowElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTableRowElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableRowElement { htmlelement: HTMLElement, } +impl HTMLTableRowElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableRowElement { + HTMLTableRowElement { + htmlelement: HTMLElement::new(HTMLTableRowElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableRowElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableRowElementBinding::Wrap) + } +} + impl HTMLTableRowElement { pub fn RowIndex(&self) -> i32 { 0 diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 43ffca78e9b..aa75449fb1a 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -266,7 +266,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []); handle_element!(cx, document, tag, "time", HTMLTimeElementTypeId, HTMLTimeElement, []); handle_element!(cx, document, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []); - handle_element!(cx, document, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -285,6 +284,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "img", HTMLImageElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); + 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); From 9518754faeb5367a4261e0a6f335d8317c25bcc3 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:32:50 +0100 Subject: [PATCH 09/26] Introduce HTMLTitleElement::new. --- src/components/script/dom/htmltitleelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltitleelement.rs b/src/components/script/dom/htmltitleelement.rs index 5a3aed5f4ff..e54ebdebb22 100644 --- a/src/components/script/dom/htmltitleelement.rs +++ b/src/components/script/dom/htmltitleelement.rs @@ -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::HTMLTitleElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTitleElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTitleElement { htmlelement: HTMLElement, } +impl HTMLTitleElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTitleElement { + HTMLTitleElement { + htmlelement: HTMLElement::new(HTMLTitleElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTitleElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTitleElementBinding::Wrap) + } +} + impl HTMLTitleElement { pub fn Text(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index aa75449fb1a..7f871750407 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -265,7 +265,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "template",HTMLTemplateElementTypeId, HTMLTemplateElement, []); handle_element!(cx, document, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []); handle_element!(cx, document, tag, "time", HTMLTimeElementTypeId, HTMLTimeElement, []); - handle_element!(cx, document, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -284,6 +283,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "img", HTMLImageElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement); + 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); From 90fed8e53d181cc15e5db52f0ed6761e082e3b6b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:38:36 +0100 Subject: [PATCH 10/26] Introduce HTMLTimeElement::new. --- src/components/script/dom/htmltimeelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltimeelement.rs b/src/components/script/dom/htmltimeelement.rs index d0a685de3a3..ec615d60b8c 100644 --- a/src/components/script/dom/htmltimeelement.rs +++ b/src/components/script/dom/htmltimeelement.rs @@ -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::HTMLTimeElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTimeElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTimeElement { htmlelement: HTMLElement } +impl HTMLTimeElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTimeElement { + HTMLTimeElement { + htmlelement: HTMLElement::new(HTMLTimeElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTimeElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTimeElementBinding::Wrap) + } +} + impl HTMLTimeElement { pub fn DateTime(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 7f871750407..6bf0a932eeb 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -264,7 +264,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []); handle_element!(cx, document, tag, "template",HTMLTemplateElementTypeId, HTMLTemplateElement, []); handle_element!(cx, document, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []); - handle_element!(cx, document, tag, "time", HTMLTimeElementTypeId, HTMLTimeElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -283,6 +282,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "img", HTMLImageElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); 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); From 8f2b9ac413b6784315d1c5501187a2255e0050f0 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:44:47 +0100 Subject: [PATCH 11/26] Introduce HTMLTextAreaElement::new. --- .../script/dom/htmltextareaelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltextareaelement.rs b/src/components/script/dom/htmltextareaelement.rs index 07531e87a6f..67f8d8d5bba 100644 --- a/src/components/script/dom/htmltextareaelement.rs +++ b/src/components/script/dom/htmltextareaelement.rs @@ -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::HTMLTextAreaElementBinding; use dom::bindings::utils::{DOMString, ErrorResult, Fallible}; +use dom::document::AbstractDocument; +use dom::element::HTMLTextAreaElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTextAreaElement { htmlelement: HTMLElement, } +impl HTMLTextAreaElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTextAreaElement { + HTMLTextAreaElement { + htmlelement: HTMLElement::new(HTMLTextAreaElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTextAreaElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTextAreaElementBinding::Wrap) + } +} + impl HTMLTextAreaElement { pub fn Autofocus(&self) -> bool { false diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 6bf0a932eeb..2c54b020289 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -263,7 +263,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []); handle_element!(cx, document, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []); handle_element!(cx, document, tag, "template",HTMLTemplateElementTypeId, HTMLTemplateElement, []); - handle_element!(cx, document, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -281,6 +280,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "iframe", HTMLIFrameElement); handle_newable_element!(document, tag, "img", HTMLImageElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); + 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); From e48a8d1e3082fc3d7cc3d2622458e67cc4c1a1b8 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 16:57:36 +0100 Subject: [PATCH 12/26] Introduce HTMLTemplateElement::new. --- src/components/script/dom/htmltemplateelement.rs | 14 ++++++++++++++ src/components/script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltemplateelement.rs b/src/components/script/dom/htmltemplateelement.rs index 11e4e399948..8ccea37c420 100644 --- a/src/components/script/dom/htmltemplateelement.rs +++ b/src/components/script/dom/htmltemplateelement.rs @@ -2,11 +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::HTMLTemplateElementBinding; +use dom::document::AbstractDocument; +use dom::element::HTMLTemplateElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTemplateElement { htmlelement: HTMLElement, } impl HTMLTemplateElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTemplateElement { + HTMLTemplateElement { + htmlelement: HTMLElement::new(HTMLTemplateElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTemplateElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTemplateElementBinding::Wrap) + } } diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 2c54b020289..42826b1dd4d 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -262,7 +262,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []); handle_element!(cx, document, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []); handle_element!(cx, document, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []); - handle_element!(cx, document, tag, "template",HTMLTemplateElementTypeId, HTMLTemplateElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -280,6 +279,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "iframe", HTMLIFrameElement); handle_newable_element!(document, tag, "img", HTMLImageElement); 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); From 3a6d6b9a71ccec706eb24b6fb7a17d1e78d08df2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 17:02:13 +0100 Subject: [PATCH 13/26] Introduce HTMLTableSectionElement::new. --- .../script/dom/htmltablesectionelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltablesectionelement.rs b/src/components/script/dom/htmltablesectionelement.rs index 91579e252e5..08951af578a 100644 --- a/src/components/script/dom/htmltablesectionelement.rs +++ b/src/components/script/dom/htmltablesectionelement.rs @@ -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::HTMLTableSectionElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTableSectionElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableSectionElement { htmlelement: HTMLElement, } +impl HTMLTableSectionElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableSectionElement { + HTMLTableSectionElement { + htmlelement: HTMLElement::new(HTMLTableSectionElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableSectionElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableSectionElementBinding::Wrap) + } +} + impl HTMLTableSectionElement { pub fn DeleteRow(&mut self, _index: i32) -> ErrorResult { Ok(()) diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 42826b1dd4d..93173ceb582 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -261,7 +261,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "caption", HTMLTableCaptionElementTypeId, HTMLTableCaptionElement, []); handle_element!(cx, document, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []); handle_element!(cx, document, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []); - handle_element!(cx, document, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -278,6 +277,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "tbody", HTMLTableSectionElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "template", HTMLTemplateElement); handle_newable_element!(document, tag, "textarea", HTMLTextAreaElement); From e5786422780c6e622849b16df1f7acba8660e0cd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 19:20:37 +0100 Subject: [PATCH 14/26] Introduce HTMLTableColElement::new. --- .../script/dom/htmltablecolelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/script/dom/htmltablecolelement.rs b/src/components/script/dom/htmltablecolelement.rs index 78ad9867e0e..27817306a2c 100644 --- a/src/components/script/dom/htmltablecolelement.rs +++ b/src/components/script/dom/htmltablecolelement.rs @@ -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::HTMLTableColElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTableColElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableColElement { htmlelement: HTMLElement, } +impl HTMLTableColElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableColElement { + HTMLTableColElement { + htmlelement: HTMLElement::new(HTMLTableColElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableColElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableColElementBinding::Wrap) + } +} + impl HTMLTableColElement { pub fn Span(&self) -> u32 { 0 diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 93173ceb582..23aea912365 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -259,8 +259,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []); handle_element!(cx, document, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []); handle_element!(cx, document, tag, "caption", HTMLTableCaptionElementTypeId, HTMLTableCaptionElement, []); - handle_element!(cx, document, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []); - handle_element!(cx, document, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -269,6 +267,8 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_htmlelement!(cx, document, tag, "small", HTMLElementTypeId, HTMLElement); handle_newable_element!(document, tag, "audio", HTMLAudioElement); + 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); From a54e8046bbd0cde2a1f363b31c39f484daf7a7f4 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 19:49:11 +0100 Subject: [PATCH 15/26] Introduce HTMLTableCaptionElement::new. --- .../script/dom/htmltablecaptionelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltablecaptionelement.rs b/src/components/script/dom/htmltablecaptionelement.rs index f812e512ebc..405e59cf272 100644 --- a/src/components/script/dom/htmltablecaptionelement.rs +++ b/src/components/script/dom/htmltablecaptionelement.rs @@ -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::HTMLTableCaptionElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTableCaptionElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableCaptionElement { htmlelement: HTMLElement } +impl HTMLTableCaptionElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableCaptionElement { + HTMLTableCaptionElement { + htmlelement: HTMLElement::new(HTMLTableCaptionElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableCaptionElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableCaptionElementBinding::Wrap) + } +} + impl HTMLTableCaptionElement { pub fn Align(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 23aea912365..e4763c4b8b0 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -258,7 +258,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []); handle_element!(cx, document, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []); handle_element!(cx, document, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []); - handle_element!(cx, document, tag, "caption", HTMLTableCaptionElementTypeId, HTMLTableCaptionElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -267,6 +266,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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); From bee5f1be1115a4249702531ad1a987019e1e8ecc Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 19:53:52 +0100 Subject: [PATCH 16/26] Introduce HTMLTableElement::new. --- src/components/script/dom/htmltableelement.rs | 16 ++++++++++++++++ src/components/script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmltableelement.rs b/src/components/script/dom/htmltableelement.rs index 3d7d2bf9146..8cdf888440e 100644 --- a/src/components/script/dom/htmltableelement.rs +++ b/src/components/script/dom/htmltableelement.rs @@ -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::HTMLTableElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTableElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableElement { htmlelement: HTMLElement, } impl HTMLTableElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableElement { + HTMLTableElement { + htmlelement: HTMLElement::new(HTMLTableElementTypeId, localName, document) + } + } + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableElementBinding::Wrap) + } +} + +impl HTMLTableElement { pub fn DeleteCaption(&self) { } diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index e4763c4b8b0..32a231b0e87 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -257,7 +257,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "source", HTMLSourceElementTypeId, HTMLSourceElement, []); handle_element!(cx, document, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []); handle_element!(cx, document, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []); - handle_element!(cx, document, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -277,6 +276,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "table", HTMLTableElement); handle_newable_element!(document, tag, "tbody", HTMLTableSectionElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); handle_newable_element!(document, tag, "template", HTMLTemplateElement); From 8cba205c82300a6f6f1506ff8eec5dfb6a7385e5 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 19:58:42 +0100 Subject: [PATCH 17/26] Introduce HTMLStyleElement::new. --- src/components/script/dom/htmlstyleelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlstyleelement.rs b/src/components/script/dom/htmlstyleelement.rs index 3d1e0cc95f2..d6817a7d2b9 100644 --- a/src/components/script/dom/htmlstyleelement.rs +++ b/src/components/script/dom/htmlstyleelement.rs @@ -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::HTMLStyleElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLStyleElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLStyleElement { htmlelement: HTMLElement, } +impl HTMLStyleElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLStyleElement { + HTMLStyleElement { + htmlelement: HTMLElement::new(HTMLStyleElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLStyleElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLStyleElementBinding::Wrap) + } +} + impl HTMLStyleElement { pub fn Disabled(&self) -> bool { false diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 32a231b0e87..68133c3230a 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -256,7 +256,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []); handle_element!(cx, document, tag, "source", HTMLSourceElementTypeId, HTMLSourceElement, []); handle_element!(cx, document, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []); - handle_element!(cx, document, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -276,6 +275,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "style", HTMLStyleElement); handle_newable_element!(document, tag, "table", HTMLTableElement); handle_newable_element!(document, tag, "tbody", HTMLTableSectionElement); handle_newable_element!(document, tag, "td", HTMLTableDataCellElement); From 64de428d79a2eb162fc32f5997b5cbdccc608c54 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 20:03:14 +0100 Subject: [PATCH 18/26] Introduce HTMLSpanElement::new. --- src/components/script/dom/htmlspanelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlspanelement.rs b/src/components/script/dom/htmlspanelement.rs index 9c3ed92f402..78eb18323b1 100644 --- a/src/components/script/dom/htmlspanelement.rs +++ b/src/components/script/dom/htmlspanelement.rs @@ -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::HTMLSpanElementBinding; +use dom::document::AbstractDocument; +use dom::element::HTMLSpanElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLSpanElement { htmlelement: HTMLElement } + +impl HTMLSpanElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLSpanElement { + HTMLSpanElement { + htmlelement: HTMLElement::new(HTMLSpanElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLSpanElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLSpanElementBinding::Wrap) + } +} diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 68133c3230a..a0a9b7d7f30 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -255,7 +255,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []); handle_element!(cx, document, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []); handle_element!(cx, document, tag, "source", HTMLSourceElementTypeId, HTMLSourceElement, []); - handle_element!(cx, document, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -275,6 +274,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "span", HTMLSpanElement); handle_newable_element!(document, tag, "style", HTMLStyleElement); handle_newable_element!(document, tag, "table", HTMLTableElement); handle_newable_element!(document, tag, "tbody", HTMLTableSectionElement); From c32ec7bf65ec05763bec44132ee8f84f75689827 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 20:08:10 +0100 Subject: [PATCH 19/26] Introduce HTMLSourceElement::new. --- src/components/script/dom/htmlsourceelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlsourceelement.rs b/src/components/script/dom/htmlsourceelement.rs index 0fe7bfdf57a..4168f891835 100644 --- a/src/components/script/dom/htmlsourceelement.rs +++ b/src/components/script/dom/htmlsourceelement.rs @@ -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::HTMLSourceElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLSourceElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLSourceElement { htmlelement: HTMLElement } +impl HTMLSourceElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLSourceElement { + HTMLSourceElement { + htmlelement: HTMLElement::new(HTMLSourceElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLSourceElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLSourceElementBinding::Wrap) + } +} + impl HTMLSourceElement { pub fn Src(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index a0a9b7d7f30..92348928a72 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -254,7 +254,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []); handle_element!(cx, document, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []); handle_element!(cx, document, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []); - handle_element!(cx, document, tag, "source", HTMLSourceElementTypeId, HTMLSourceElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -274,6 +273,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "source", HTMLSourceElement); handle_newable_element!(document, tag, "span", HTMLSpanElement); handle_newable_element!(document, tag, "style", HTMLStyleElement); handle_newable_element!(document, tag, "table", HTMLTableElement); From 9cf5bbbfecb7061f02d0acef24399250001bad99 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 20:11:52 +0100 Subject: [PATCH 20/26] Introduce HTMLSelectElement::new. --- src/components/script/dom/htmlselectelement.rs | 18 +++++++++++++++++- .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/script/dom/htmlselectelement.rs b/src/components/script/dom/htmlselectelement.rs index 14b5de595d1..38c3da4292a 100644 --- a/src/components/script/dom/htmlselectelement.rs +++ b/src/components/script/dom/htmlselectelement.rs @@ -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::HTMLSelectElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLSelectElementTypeId; use dom::htmlelement::HTMLElement; -use dom::node::{AbstractNode, ScriptView}; +use dom::node::{AbstractNode, Node, ScriptView}; use dom::validitystate::ValidityState; pub struct HTMLSelectElement { htmlelement: HTMLElement } +impl HTMLSelectElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLSelectElement { + HTMLSelectElement { + htmlelement: HTMLElement::new(HTMLSelectElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLSelectElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLSelectElementBinding::Wrap) + } +} + impl HTMLSelectElement { pub fn Autofocus(&self) -> bool { false diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 92348928a72..e8f5fc714a9 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -253,7 +253,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []); handle_element!(cx, document, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []); handle_element!(cx, document, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []); - handle_element!(cx, document, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -273,6 +272,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "select", HTMLSelectElement); handle_newable_element!(document, tag, "source", HTMLSourceElement); handle_newable_element!(document, tag, "span", HTMLSpanElement); handle_newable_element!(document, tag, "style", HTMLStyleElement); From 152f44db522774f0a681e2d55f1cb6806fee0665 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 20:18:09 +0100 Subject: [PATCH 21/26] Introduce HTMLScriptElement::new. --- src/components/script/dom/htmlscriptelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlscriptelement.rs b/src/components/script/dom/htmlscriptelement.rs index f3de42eae26..0925a0109f5 100644 --- a/src/components/script/dom/htmlscriptelement.rs +++ b/src/components/script/dom/htmlscriptelement.rs @@ -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::HTMLScriptElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLScriptElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; use servo_util::tree::ElementLike; pub struct HTMLScriptElement { htmlelement: HTMLElement, } +impl HTMLScriptElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLScriptElement { + HTMLScriptElement { + htmlelement: HTMLElement::new(HTMLScriptElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLScriptElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLScriptElementBinding::Wrap) + } +} + impl HTMLScriptElement { pub fn Src(&self) -> DOMString { self.htmlelement.element.get_attr("src").map(|s| s.to_str()) diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index e8f5fc714a9..6e7f6e5b2d5 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -252,7 +252,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "pre", HTMLPreElementTypeId, HTMLPreElement, []); handle_element!(cx, document, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []); handle_element!(cx, document, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []); - handle_element!(cx, document, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -272,6 +271,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "script", HTMLScriptElement); handle_newable_element!(document, tag, "select", HTMLSelectElement); handle_newable_element!(document, tag, "source", HTMLSourceElement); handle_newable_element!(document, tag, "span", HTMLSpanElement); From e3ac4c9e007d2432836b37c5264c72bc49b990a3 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 20:24:27 +0100 Subject: [PATCH 22/26] Introduce HTMLQuoteElement::new. --- src/components/script/dom/htmlquoteelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlquoteelement.rs b/src/components/script/dom/htmlquoteelement.rs index 107603aa1d5..682b4e68b20 100644 --- a/src/components/script/dom/htmlquoteelement.rs +++ b/src/components/script/dom/htmlquoteelement.rs @@ -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::HTMLQuoteElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLQuoteElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLQuoteElement { htmlelement: HTMLElement, } +impl HTMLQuoteElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLQuoteElement { + HTMLQuoteElement { + htmlelement: HTMLElement::new(HTMLQuoteElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLQuoteElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLQuoteElementBinding::Wrap) + } +} + impl HTMLQuoteElement { pub fn Cite(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 6e7f6e5b2d5..52c532f3bbb 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -251,7 +251,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "param", HTMLParamElementTypeId, HTMLParamElement, []); handle_element!(cx, document, tag, "pre", HTMLPreElementTypeId, HTMLPreElement, []); handle_element!(cx, document, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []); - handle_element!(cx, document, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -271,6 +270,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "q", HTMLQuoteElement); handle_newable_element!(document, tag, "script", HTMLScriptElement); handle_newable_element!(document, tag, "select", HTMLSelectElement); handle_newable_element!(document, tag, "source", HTMLSourceElement); From d4d9395c908cec2878fc9280521572738b73c48a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 20:47:57 +0100 Subject: [PATCH 23/26] Introduce HTMLProgressElement::new. --- .../script/dom/htmlprogresselement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlprogresselement.rs b/src/components/script/dom/htmlprogresselement.rs index 3ef1011a1dc..9983d71a0dd 100644 --- a/src/components/script/dom/htmlprogresselement.rs +++ b/src/components/script/dom/htmlprogresselement.rs @@ -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::HTMLProgressElementBinding; use dom::bindings::utils::{ErrorResult, Fallible}; +use dom::document::AbstractDocument; +use dom::element::HTMLProgressElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLProgressElement { htmlelement: HTMLElement, } +impl HTMLProgressElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLProgressElement { + HTMLProgressElement { + htmlelement: HTMLElement::new(HTMLProgressElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLProgressElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLProgressElementBinding::Wrap) + } +} + impl HTMLProgressElement { pub fn Value(&self) -> f64 { 0f64 diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 52c532f3bbb..4d46bcd3559 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -250,7 +250,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []); handle_element!(cx, document, tag, "param", HTMLParamElementTypeId, HTMLParamElement, []); handle_element!(cx, document, tag, "pre", HTMLPreElementTypeId, HTMLPreElement, []); - handle_element!(cx, document, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -270,6 +269,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "progress", HTMLProgressElement); handle_newable_element!(document, tag, "q", HTMLQuoteElement); handle_newable_element!(document, tag, "script", HTMLScriptElement); handle_newable_element!(document, tag, "select", HTMLSelectElement); From ec2fd955aa37a381360bd910d401bf4dbbae0c63 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 21:00:19 +0100 Subject: [PATCH 24/26] Introduce HTMLPreElement::new. --- src/components/script/dom/htmlpreelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlpreelement.rs b/src/components/script/dom/htmlpreelement.rs index b866d360e60..2a2a9d64841 100644 --- a/src/components/script/dom/htmlpreelement.rs +++ b/src/components/script/dom/htmlpreelement.rs @@ -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::HTMLPreElementBinding; use dom::bindings::utils::{ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLPreElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLPreElement { htmlelement: HTMLElement, } +impl HTMLPreElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLPreElement { + HTMLPreElement { + htmlelement: HTMLElement::new(HTMLPreElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLPreElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLPreElementBinding::Wrap) + } +} + impl HTMLPreElement { pub fn Width(&self) -> i32 { 0 diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 4d46bcd3559..9038f827699 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -249,7 +249,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "output", HTMLOutputElementTypeId, HTMLOutputElement, []); handle_element!(cx, document, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []); handle_element!(cx, document, tag, "param", HTMLParamElementTypeId, HTMLParamElement, []); - handle_element!(cx, document, tag, "pre", HTMLPreElementTypeId, HTMLPreElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -269,6 +268,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "pre", HTMLPreElement); handle_newable_element!(document, tag, "progress", HTMLProgressElement); handle_newable_element!(document, tag, "q", HTMLQuoteElement); handle_newable_element!(document, tag, "script", HTMLScriptElement); From 09b840c7ed1afae50409d036a4132232d93aa154 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 21:06:37 +0100 Subject: [PATCH 25/26] Introduce HTMLParamElement::new. --- src/components/script/dom/htmlparamelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlparamelement.rs b/src/components/script/dom/htmlparamelement.rs index c50ca16cb9e..38f48a22c5c 100644 --- a/src/components/script/dom/htmlparamelement.rs +++ b/src/components/script/dom/htmlparamelement.rs @@ -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::HTMLParamElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLParamElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLParamElement { htmlelement: HTMLElement } +impl HTMLParamElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLParamElement { + HTMLParamElement { + htmlelement: HTMLElement::new(HTMLParamElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLParamElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLParamElementBinding::Wrap) + } +} + impl HTMLParamElement { pub fn Name(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 9038f827699..64a09c6eb60 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -248,7 +248,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "optgroup",HTMLOptGroupElementTypeId, HTMLOptGroupElement, []); handle_element!(cx, document, tag, "output", HTMLOutputElementTypeId, HTMLOutputElement, []); handle_element!(cx, document, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []); - handle_element!(cx, document, tag, "param", HTMLParamElementTypeId, HTMLParamElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -268,6 +267,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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, "param", HTMLParamElement); handle_newable_element!(document, tag, "pre", HTMLPreElement); handle_newable_element!(document, tag, "progress", HTMLProgressElement); handle_newable_element!(document, tag, "q", HTMLQuoteElement); From 78010f96bcb757bdd2118bb9a0d0629104624766 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 21:11:00 +0100 Subject: [PATCH 26/26] Introduce HTMLParagraphElement::new. --- .../script/dom/htmlparagraphelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlparagraphelement.rs b/src/components/script/dom/htmlparagraphelement.rs index d8ed198e402..bfd39a240f9 100644 --- a/src/components/script/dom/htmlparagraphelement.rs +++ b/src/components/script/dom/htmlparagraphelement.rs @@ -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::HTMLParagraphElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLParagraphElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLParagraphElement { htmlelement: HTMLElement } +impl HTMLParagraphElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLParagraphElement { + HTMLParagraphElement { + htmlelement: HTMLElement::new(HTMLParagraphElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLParagraphElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLParagraphElementBinding::Wrap) + } +} + impl HTMLParagraphElement { pub fn Align(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 64a09c6eb60..c0da70de983 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -247,7 +247,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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!(cx, document, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -267,6 +266,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum 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);