mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +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,42 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::HTMLButtonElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLButtonElementDerived;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::ErrorResult;
|
||||
use dom::document::AbstractDocument;
|
||||
use dom::document::Document;
|
||||
use dom::element::HTMLButtonElementTypeId;
|
||||
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 HTMLButtonElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLButtonElementDerived for EventTarget {
|
||||
fn is_htmlbuttonelement(&self) -> bool {
|
||||
match self.type_id {
|
||||
NodeTargetTypeId(ElementNodeTypeId(HTMLButtonElementTypeId)) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLButtonElement {
|
||||
pub fn new_inherited(localName: DOMString, document: AbstractDocument) -> HTMLButtonElement {
|
||||
pub fn new_inherited(localName: DOMString, document: JS<Document>) -> HTMLButtonElement {
|
||||
HTMLButtonElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLButtonElementTypeId, localName, document)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(localName: DOMString, document: AbstractDocument) -> AbstractNode {
|
||||
let element = HTMLButtonElement::new_inherited(localName, document);
|
||||
Node::reflect_node(@mut element, document, HTMLButtonElementBinding::Wrap)
|
||||
pub fn new(localName: DOMString, document: &JS<Document>) -> JS<HTMLButtonElement> {
|
||||
let element = HTMLButtonElement::new_inherited(localName, document.clone());
|
||||
Node::reflect_node(~element, document, HTMLButtonElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +59,7 @@ impl HTMLButtonElement {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn GetForm(&self) -> Option<AbstractNode> {
|
||||
pub fn GetForm(&self) -> Option<JS<HTMLFormElement>> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -120,12 +134,13 @@ impl HTMLButtonElement {
|
|||
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