Introduce HTMLCanvasElement::new.

This commit is contained in:
Ms2ger 2013-11-02 18:18:29 +01:00
parent 4d706984e1
commit 74312da1ba
2 changed files with 18 additions and 1 deletions

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(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

@ -216,7 +216,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum
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_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement);
@ -225,6 +224,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, "canvas", HTMLCanvasElement);
handle_newable_element!(document, tag, "caption", HTMLTableCaptionElement);
handle_newable_element!(document, tag, "col", HTMLTableColElement);
handle_newable_element!(document, tag, "colgroup", HTMLTableColElement);