mirror of
https://github.com/servo/servo.git
synced 2025-06-18 05:14:28 +00:00
Generate bindings for HTMLFormElement.
This commit is contained in:
parent
65c6435902
commit
c9f9d29ff3
6 changed files with 160 additions and 2 deletions
|
@ -570,7 +570,7 @@ addHTMLElement('HTMLElement')
|
|||
addHTMLElement('HTMLEmbedElement')
|
||||
addHTMLElement('HTMLFieldSetElement')
|
||||
addHTMLElement('HTMLFontElement')
|
||||
#addHTMLElement('HTMLFormElement')
|
||||
addHTMLElement('HTMLFormElement')
|
||||
addHTMLElement('HTMLFrameElement')
|
||||
addHTMLElement('HTMLFrameSetElement')
|
||||
addHTMLElement('HTMLHeadElement')
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
interface HTMLFormElement;
|
||||
// FIXME: servo#707
|
||||
//interface HTMLFormElement;
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#the-button-element
|
||||
interface HTMLButtonElement : HTMLElement {
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/#htmlformelement
|
||||
*
|
||||
* ⓒ Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
[OverrideBuiltins]
|
||||
interface HTMLFormElement : HTMLElement {
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString acceptCharset;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString action;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString autocomplete;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString enctype;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString encoding;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString method;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString name;
|
||||
[Pure, SetterThrows]
|
||||
attribute boolean noValidate;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString target;
|
||||
|
||||
[Constant]
|
||||
readonly attribute HTMLCollection elements;
|
||||
[Pure]
|
||||
readonly attribute long length;
|
||||
|
||||
getter Element (unsigned long index);
|
||||
// TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name);
|
||||
// getter nsISupports (DOMString name);
|
||||
|
||||
[Throws]
|
||||
void submit();
|
||||
void reset();
|
||||
boolean checkValidity();
|
||||
};
|
|
@ -361,6 +361,8 @@ generate_cacheable_wrapper!(HTMLDataListElement, HTMLDataListElementBinding::Wra
|
|||
generate_binding_object!(HTMLDataListElement)
|
||||
generate_cacheable_wrapper!(HTMLDListElement, HTMLDListElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLDListElement)
|
||||
generate_cacheable_wrapper!(HTMLFormElement, HTMLFormElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLFormElement)
|
||||
generate_cacheable_wrapper!(HTMLFrameElement, HTMLFrameElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLFrameElement)
|
||||
generate_cacheable_wrapper!(HTMLFrameSetElement, HTMLFrameSetElementBinding::Wrap)
|
||||
|
|
|
@ -88,6 +88,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
|||
ElementNodeTypeId(HTMLEmbedElementTypeId) => generate_element!(HTMLEmbedElement),
|
||||
ElementNodeTypeId(HTMLFieldSetElementTypeId) => generate_element!(HTMLFieldSetElement),
|
||||
ElementNodeTypeId(HTMLFontElementTypeId) => generate_element!(HTMLFontElement),
|
||||
ElementNodeTypeId(HTMLFormElementTypeId) => generate_element!(HTMLFormElement),
|
||||
ElementNodeTypeId(HTMLFrameElementTypeId) => generate_element!(HTMLFrameElement),
|
||||
ElementNodeTypeId(HTMLFrameSetElementTypeId) => generate_element!(HTMLFrameSetElement),
|
||||
ElementNodeTypeId(HTMLHeadElementTypeId) => generate_element!(HTMLHeadElement),
|
||||
|
|
|
@ -2,8 +2,114 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::utils::{CacheableWrapper, DOMString, ErrorResult, null_string};
|
||||
use dom::element::HTMLFormElementTypeId;
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{AbstractNode, ElementNodeTypeId, Node, ScriptView};
|
||||
|
||||
use js::jsapi::{JSObject, JSContext};
|
||||
|
||||
pub struct HTMLFormElement {
|
||||
parent: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLFormElement {
|
||||
fn get_scope_and_cx(&self) -> (*JSObject, *JSContext) {
|
||||
let doc = self.parent.parent.parent.owner_doc.unwrap();
|
||||
let win = doc.with_base(|doc| doc.window.unwrap());
|
||||
let cx = unsafe {(*win.page).js_info.get_ref().js_compartment.cx.ptr};
|
||||
let cache = win.get_wrappercache();
|
||||
let scope = cache.get_wrapper();
|
||||
(scope, cx)
|
||||
}
|
||||
|
||||
pub fn AcceptCharset(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetAcceptCharset(&mut self, _accept_charset: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Action(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetAction(&mut self, _action: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Autocomplete(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetAutocomplete(&mut self, _autocomplete: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Enctype(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetEnctype(&mut self, _enctype: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Encoding(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetEncoding(&mut self, _encoding: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Method(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetMethod(&mut self, _method: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Name(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn NoValidate(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn SetNoValidate(&mut self, _no_validate: bool, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Target(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetTarget(&mut self, _target: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Elements(&self) -> @mut HTMLCollection {
|
||||
let (scope, cx) = self.get_scope_and_cx();
|
||||
HTMLCollection::new(~[], cx, scope)
|
||||
}
|
||||
|
||||
pub fn Length(&self) -> i32 {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn Submit(&self, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Reset(&self) {
|
||||
}
|
||||
|
||||
pub fn CheckValidity(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> AbstractNode<ScriptView> {
|
||||
let (_scope, cx) = self.get_scope_and_cx();
|
||||
// FIXME: This should be replaced with a proper value according to the index
|
||||
let node = @Node::new(ElementNodeTypeId(HTMLFormElementTypeId));
|
||||
unsafe { return Node::as_abstract_node(cx, node) }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue