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::HTMLBRElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBRElementDerived;
use dom::bindings::utils::ErrorResult;
use dom::document::AbstractDocument;
use dom::bindings::js::JS;
use dom::document::Document;
use dom::element::HTMLBRElementTypeId;
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 HTMLBRElement {
htmlelement: HTMLElement,
}
impl HTMLBRElementDerived for EventTarget {
fn is_htmlbrelement(&self) -> bool {
match self.type_id {
NodeTargetTypeId(ElementNodeTypeId(HTMLBRElementTypeId)) => true,
_ => false
}
}
}
impl HTMLBRElement {
pub fn new_inherited(localName: DOMString, document: AbstractDocument) -> HTMLBRElement {
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLBRElement {
HTMLBRElement {
htmlelement: HTMLElement::new_inherited(HTMLBRElementTypeId, localName, document)
}
}
pub fn new(localName: DOMString, document: AbstractDocument) -> AbstractNode {
let element = HTMLBRElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLBRElementBinding::Wrap)
pub fn new(localName: DOMString, document: &JS<Document>) -> JS<HTMLBRElement> {
let element = HTMLBRElement::new_inherited(localName, document.clone());
Node::reflect_node(~element, document, HTMLBRElementBinding::Wrap)
}
}