Implement JSManaged for DOM objects.

This commit is contained in:
Josh Matthews 2013-11-30 21:04:49 +01:00
parent 061269f963
commit 625325434b
137 changed files with 3644 additions and 2778 deletions

View file

@ -3,27 +3,40 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::HTMLParagraphElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLParagraphElementDerived;
use dom::bindings::js::JS;
use dom::bindings::utils::ErrorResult;
use dom::document::AbstractDocument;
use dom::document::Document;
use dom::element::HTMLParagraphElementTypeId;
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node};
use dom::node::{Node, ElementNodeTypeId};
use servo_util::str::DOMString;
#[deriving(Encodable)]
pub struct HTMLParagraphElement {
htmlelement: HTMLElement
}
impl HTMLParagraphElementDerived for EventTarget {
fn is_htmlparagraphelement(&self) -> bool {
match self.type_id {
NodeTargetTypeId(ElementNodeTypeId(HTMLParagraphElementTypeId)) => true,
_ => false
}
}
}
impl HTMLParagraphElement {
pub fn new_inherited(localName: DOMString, document: AbstractDocument) -> HTMLParagraphElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLParagraphElement {
HTMLParagraphElement {
htmlelement: HTMLElement::new_inherited(HTMLParagraphElementTypeId, localName, document)
}
}
pub fn new(localName: DOMString, document: AbstractDocument) -> AbstractNode {
let element = HTMLParagraphElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLParagraphElementBinding::Wrap)
pub fn new(localName: DOMString, document: &JS<Document>) -> JS<HTMLParagraphElement> {
let element = HTMLParagraphElement::new_inherited(localName, document.clone());
Node::reflect_node(~element, document, HTMLParagraphElementBinding::Wrap)
}
}