mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +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,33 +3,47 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::HTMLOutputElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLOutputElementDerived;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::ErrorResult;
|
||||
use dom::document::AbstractDocument;
|
||||
use dom::document::Document;
|
||||
use dom::element::HTMLOutputElementTypeId;
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{AbstractNode, Node};
|
||||
use dom::htmlformelement::HTMLFormElement;
|
||||
use dom::node::{Node, ElementNodeTypeId};
|
||||
use dom::validitystate::ValidityState;
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLOutputElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLOutputElementDerived for EventTarget {
|
||||
fn is_htmloutputelement(&self) -> bool {
|
||||
match self.type_id {
|
||||
NodeTargetTypeId(ElementNodeTypeId(HTMLOutputElementTypeId)) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLOutputElement {
|
||||
pub fn new_inherited(localName: DOMString, document: AbstractDocument) -> HTMLOutputElement {
|
||||
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLOutputElement {
|
||||
HTMLOutputElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLOutputElementTypeId, localName, document)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(localName: DOMString, document: AbstractDocument) -> AbstractNode {
|
||||
let element = HTMLOutputElement::new_inherited(localName, document);
|
||||
Node::reflect_node(@mut element, document, HTMLOutputElementBinding::Wrap)
|
||||
pub fn new(localName: DOMString, document: &JS<Document>) -> JS<HTMLOutputElement> {
|
||||
let element = HTMLOutputElement::new_inherited(localName, document.clone());
|
||||
Node::reflect_node(~element, document, HTMLOutputElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLOutputElement {
|
||||
pub fn GetForm(&self) -> Option<AbstractNode> {
|
||||
pub fn GetForm(&self) -> Option<JS<HTMLFormElement>> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -68,12 +82,13 @@ impl HTMLOutputElement {
|
|||
pub fn SetWillValidate(&mut self, _will_validate: bool) {
|
||||
}
|
||||
|
||||
pub fn Validity(&self) -> @mut ValidityState {
|
||||
let global = self.htmlelement.element.node.owner_doc().document().window;
|
||||
ValidityState::new(global)
|
||||
pub fn Validity(&self) -> JS<ValidityState> {
|
||||
let doc = self.htmlelement.element.node.owner_doc();
|
||||
let doc = doc.get();
|
||||
ValidityState::new(&doc.window)
|
||||
}
|
||||
|
||||
pub fn SetValidity(&mut self, _validity: @mut ValidityState) {
|
||||
pub fn SetValidity(&mut self, _validity: JS<ValidityState>) {
|
||||
}
|
||||
|
||||
pub fn ValidationMessage(&self) -> DOMString {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue