mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement JSManaged for DOM objects.
This commit is contained in:
parent
061269f963
commit
625325434b
137 changed files with 3644 additions and 2778 deletions
|
@ -3,28 +3,41 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::HTMLMapElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLMapElementDerived;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::ErrorResult;
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::document::AbstractDocument;
|
||||
use dom::document::Document;
|
||||
use dom::element::HTMLMapElementTypeId;
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{AbstractNode, Node};
|
||||
use dom::node::{Node, ElementNodeTypeId};
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLMapElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLMapElementDerived for EventTarget {
|
||||
fn is_htmlmapelement(&self) -> bool {
|
||||
match self.type_id {
|
||||
NodeTargetTypeId(ElementNodeTypeId(HTMLMapElementTypeId)) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLMapElement {
|
||||
pub fn new_inherited(localName: DOMString, document: AbstractDocument) -> HTMLMapElement {
|
||||
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLMapElement {
|
||||
HTMLMapElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLMapElementTypeId, localName, document)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(localName: DOMString, document: AbstractDocument) -> AbstractNode {
|
||||
let element = HTMLMapElement::new_inherited(localName, document);
|
||||
Node::reflect_node(@mut element, document, HTMLMapElementBinding::Wrap)
|
||||
pub fn new(localName: DOMString, document: &JS<Document>) -> JS<HTMLMapElement> {
|
||||
let element = HTMLMapElement::new_inherited(localName, document.clone());
|
||||
Node::reflect_node(~element, document, HTMLMapElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,8 +50,9 @@ impl HTMLMapElement {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn Areas(&self) -> @mut HTMLCollection {
|
||||
let window = self.htmlelement.element.node.owner_doc().document().window;
|
||||
HTMLCollection::new(window, ~[])
|
||||
pub fn Areas(&self) -> JS<HTMLCollection> {
|
||||
let doc = self.htmlelement.element.node.owner_doc();
|
||||
let doc = doc.get();
|
||||
HTMLCollection::new(&doc.window, ~[])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue