mirror of
https://github.com/servo/servo.git
synced 2025-06-10 01:23:13 +00:00
Generate bindings for HTMLButtonElement.
This commit is contained in:
parent
5647ca6966
commit
b36ae3b0df
10 changed files with 291 additions and 3 deletions
|
@ -370,6 +370,9 @@ DOMInterfaces = {
|
|||
'UIEvent': {
|
||||
},
|
||||
|
||||
'ValidityState': {
|
||||
},
|
||||
|
||||
'WebGLRenderingContext': {
|
||||
'nativeType': 'mozilla::WebGLContext',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
|
@ -548,6 +551,7 @@ def addHTMLElement(element):
|
|||
addHTMLElement('HTMLAnchorElement')
|
||||
addHTMLElement('HTMLAppletElement')
|
||||
addHTMLElement('HTMLAreaElement')
|
||||
addHTMLElement('HTMLButtonElement')
|
||||
addHTMLElement('HTMLBaseElement')
|
||||
addHTMLElement('HTMLBodyElement')
|
||||
addHTMLElement('HTMLBRElement')
|
||||
|
@ -556,6 +560,7 @@ addHTMLElement('HTMLDataElement')
|
|||
addHTMLElement('HTMLDivElement')
|
||||
addHTMLElement('HTMLDListElement')
|
||||
addHTMLElement('HTMLElement')
|
||||
addHTMLElement('HTMLFormElement')
|
||||
addHTMLElement('HTMLHeadElement')
|
||||
addHTMLElement('HTMLHtmlElement')
|
||||
addHTMLElement('HTMLHRElement')
|
||||
|
|
|
@ -4623,6 +4623,7 @@ class CGBindingRoot(CGThing):
|
|||
'dom::htmlbaseelement::HTMLBaseElement', #XXXjune0cho
|
||||
'dom::htmlbodyelement::HTMLBodyElement', #XXXjune0cho
|
||||
'dom::htmlbrelement::HTMLBRElement', #XXXrecrack
|
||||
'dom::htmlbuttonelement::HTMLButtonElement', #XXXjdm
|
||||
'dom::htmlcanvaselement::HTMLCanvasElement',
|
||||
'dom::htmldataelement::HTMLDataElement', #XXXjune0cho
|
||||
'dom::htmldlistelement::HTMLDListElement',
|
||||
|
@ -4664,6 +4665,7 @@ class CGBindingRoot(CGThing):
|
|||
'dom::formdata::*', #XXXjdm
|
||||
'dom::mouseevent::*', #XXXjdm
|
||||
'dom::uievent::*', #XXXjdm
|
||||
'dom::validitystate::*', #XXXjdm
|
||||
'dom::windowproxy::*', #XXXjdm
|
||||
'dom::window::Window', #XXXjdm
|
||||
'dom::bindings::codegen::*', #XXXjdm
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- 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/#the-button-element
|
||||
* © 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.
|
||||
*/
|
||||
|
||||
interface HTMLFormElement;
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#the-button-element
|
||||
interface HTMLButtonElement : HTMLElement {
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean autofocus;
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean disabled;
|
||||
[Pure]
|
||||
readonly attribute HTMLFormElement? form;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString formAction;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString formEnctype;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString formMethod;
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean formNoValidate;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString formTarget;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString name;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString type;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString value;
|
||||
// Not yet implemented:
|
||||
// attribute HTMLMenuElement? menu;
|
||||
|
||||
readonly attribute boolean willValidate;
|
||||
readonly attribute ValidityState validity;
|
||||
readonly attribute DOMString validationMessage;
|
||||
boolean checkValidity();
|
||||
void setCustomValidity(DOMString error);
|
||||
|
||||
// Not yet implemented:
|
||||
// readonly attribute NodeList labels;
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
/* -*- 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/#validitystate
|
||||
* © 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.
|
||||
*/
|
||||
|
||||
interface ValidityState {
|
||||
readonly attribute boolean valueMissing;
|
||||
readonly attribute boolean typeMismatch;
|
||||
readonly attribute boolean patternMismatch;
|
||||
readonly attribute boolean tooLong;
|
||||
readonly attribute boolean rangeUnderflow;
|
||||
readonly attribute boolean rangeOverflow;
|
||||
readonly attribute boolean stepMismatch;
|
||||
// readonly attribute boolean badInput;
|
||||
readonly attribute boolean customError;
|
||||
readonly attribute boolean valid;
|
||||
};
|
||||
|
|
@ -9,7 +9,7 @@ use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
|
|||
use dom::element::{HTMLElementTypeId,
|
||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
|
||||
HTMLAreaElementTypeId, HTMLBaseElementTypeId,
|
||||
HTMLBodyElementTypeId, HTMLBRElementTypeId,
|
||||
HTMLBodyElementTypeId, HTMLBRElementTypeId, HTMLButtonElementTypeId,
|
||||
HTMLCanvasElementTypeId, HTMLDataElementTypeId,
|
||||
HTMLDivElementTypeId, HTMLHeadElementTypeId, HTMLHRElementTypeId,
|
||||
HTMLHtmlElementTypeId, HTMLIframeElementTypeId, HTMLImageElementTypeId,
|
||||
|
@ -30,6 +30,7 @@ use dom::htmlappletelement::HTMLAppletElement;
|
|||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbaseelement::HTMLBaseElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlbuttonelement::HTMLButtonElement;
|
||||
use dom::htmlhrelement::HTMLHRElement;
|
||||
use dom::htmlbrelement::HTMLBRElement;
|
||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
|
@ -128,6 +129,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
|||
ElementNodeTypeId(HTMLBaseElementTypeId) => generate_element!(HTMLBaseElement),
|
||||
ElementNodeTypeId(HTMLBodyElementTypeId) => generate_element!(HTMLBodyElement),
|
||||
ElementNodeTypeId(HTMLBRElementTypeId) => generate_element!(HTMLBRElement),
|
||||
ElementNodeTypeId(HTMLButtonElementTypeId) => generate_element!(HTMLButtonElement),
|
||||
ElementNodeTypeId(HTMLCanvasElementTypeId) => generate_element!(HTMLCanvasElement),
|
||||
ElementNodeTypeId(HTMLDataElementTypeId) => generate_element!(HTMLDataElement),
|
||||
ElementNodeTypeId(HTMLDListElementTypeId) => generate_element!(HTMLDListElement),
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
|
||||
HTMLAreaElementBinding, HTMLBaseElementBinding,
|
||||
HTMLBodyElementBinding, HTMLBRElementBinding,
|
||||
HTMLButtonElementBinding,
|
||||
HTMLCanvasElementBinding, HTMLDataElementBinding,
|
||||
HTMLDListElementBinding, HTMLDivElementBinding,
|
||||
HTMLHeadElementBinding, HTMLHRElementBinding,
|
||||
|
@ -32,6 +33,7 @@ use dom::htmlareaelement::HTMLAreaElement;
|
|||
use dom::htmlbaseelement::HTMLBaseElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlbrelement::HTMLBRElement;
|
||||
use dom::htmlbuttonelement::HTMLButtonElement;
|
||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::htmldataelement::HTMLDataElement;
|
||||
|
@ -104,6 +106,7 @@ pub enum ElementTypeId {
|
|||
HTMLBaseElementTypeId,
|
||||
HTMLBRElementTypeId,
|
||||
HTMLBodyElementTypeId,
|
||||
HTMLButtonElementTypeId,
|
||||
HTMLCanvasElementTypeId,
|
||||
HTMLDataElementTypeId,
|
||||
HTMLDListElementTypeId,
|
||||
|
@ -224,6 +227,8 @@ generate_cacheable_wrapper!(HTMLBaseElement, HTMLBaseElementBinding::Wrap)
|
|||
generate_binding_object!(HTMLBaseElement)
|
||||
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLBodyElement)
|
||||
generate_cacheable_wrapper!(HTMLButtonElement, HTMLButtonElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLButtonElement)
|
||||
generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLCanvasElement)
|
||||
generate_cacheable_wrapper!(HTMLDListElement, HTMLDListElementBinding::Wrap)
|
||||
|
|
116
src/components/script/dom/htmlbuttonelement.rs
Normal file
116
src/components/script/dom/htmlbuttonelement.rs
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* 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/. */
|
||||
|
||||
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{AbstractNode, ScriptView};
|
||||
use dom::validitystate::ValidityState;
|
||||
|
||||
pub struct HTMLButtonElement {
|
||||
parent: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLButtonElement {
|
||||
pub fn Autofocus(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn SetAutofocus(&mut self, _autofocus: bool, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Disabled(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn GetForm(&self) -> Option<AbstractNode<ScriptView>> {
|
||||
None
|
||||
}
|
||||
|
||||
pub fn FormAction(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetFormAction(&mut self, _formaction: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn FormEnctype(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetFormEnctype(&mut self, _formenctype: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn FormMethod(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetFormMethod(&mut self, _formmethod: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn FormNoValidate(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn SetFormNoValidate(&mut self, _novalidate: bool, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn FormTarget(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetFormTarget(&mut self, _formtarget: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Name(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Type(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetType(&mut self, _type: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn Value(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetValue(&mut self, _value: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn WillValidate(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn SetWillValidate(&mut self, _will_validate: bool) {
|
||||
}
|
||||
|
||||
pub fn Validity(&self) -> @mut ValidityState {
|
||||
@mut ValidityState::valid()
|
||||
}
|
||||
|
||||
pub fn SetValidity(&mut self, _validity: @mut ValidityState) {
|
||||
}
|
||||
|
||||
pub fn ValidationMessage(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetValidationMessage(&mut self, _message: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
|
||||
pub fn CheckValidity(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn SetCustomValidity(&mut self, _error: &DOMString) {
|
||||
}
|
||||
}
|
77
src/components/script/dom/validitystate.rs
Normal file
77
src/components/script/dom/validitystate.rs
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* 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/. */
|
||||
|
||||
use dom::bindings::utils::{WrapperCache, BindingObject, CacheableWrapper};
|
||||
use dom::bindings::codegen::ValidityStateBinding;
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use std::cast;
|
||||
|
||||
pub struct ValidityState {
|
||||
wrapper: WrapperCache,
|
||||
state: u8
|
||||
}
|
||||
|
||||
impl ValidityState {
|
||||
pub fn valid() -> ValidityState {
|
||||
ValidityState {
|
||||
wrapper: WrapperCache::new(),
|
||||
state: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ValidityState {
|
||||
pub fn ValueMissing(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn TypeMismatch(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn PatternMismatch(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn TooLong(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn RangeUnderflow(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn RangeOverflow(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn StepMismatch(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn CustomError(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn Valid(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheableWrapper for ValidityState {
|
||||
fn get_wrappercache(&mut self) -> &mut WrapperCache {
|
||||
unsafe { cast::transmute(&self.wrapper) }
|
||||
}
|
||||
|
||||
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
|
||||
let mut unused = false;
|
||||
ValidityStateBinding::Wrap(cx, scope, self, &mut unused)
|
||||
}
|
||||
}
|
||||
|
||||
impl BindingObject for ValidityState {
|
||||
fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut CacheableWrapper> {
|
||||
None
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
use dom::element::{HTMLElementTypeId,
|
||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
|
||||
HTMLAreaElementTypeId, HTMLBaseElementTypeId, HTMLBodyElementTypeId,
|
||||
HTMLBRElementTypeId, HTMLCanvasElementTypeId, HTMLDataElementTypeId,
|
||||
HTMLDivElementTypeId, HTMLDListElementTypeId,
|
||||
HTMLBRElementTypeId, HTMLButtonElementTypeId, HTMLCanvasElementTypeId,
|
||||
HTMLDataElementTypeId, HTMLDivElementTypeId, HTMLDListElementTypeId,
|
||||
HTMLFontElementTypeId, HTMLFormElementTypeId, HTMLHRElementTypeId,
|
||||
HTMLHeadElementTypeId, HTMLHtmlElementTypeId,
|
||||
HTMLImageElementTypeId, HTMLIframeElementTypeId, HTMLInputElementTypeId,
|
||||
|
@ -34,6 +34,7 @@ use dom::htmlappletelement::HTMLAppletElement;
|
|||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbaseelement::HTMLBaseElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlbuttonelement::HTMLButtonElement;
|
||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use dom::htmldataelement::HTMLDataElement;
|
||||
use dom::htmldlistelement::HTMLDListElement;
|
||||
|
@ -246,6 +247,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
|||
handle_element!(cx, tag, "base", HTMLBaseElementTypeId, HTMLBaseElement, []);
|
||||
handle_element!(cx, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []);
|
||||
handle_element!(cx, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
|
||||
handle_element!(cx, tag, "button", HTMLButtonElementTypeId, HTMLButtonElement, []);
|
||||
handle_element!(cx, tag, "canvas", HTMLCanvasElementTypeId, HTMLCanvasElement, []);
|
||||
handle_element!(cx, tag, "data", HTMLDataElementTypeId, HTMLDataElement, []);
|
||||
handle_element!(cx, tag, "div", HTMLDivElementTypeId, HTMLDivElement, []);
|
||||
|
|
|
@ -48,6 +48,7 @@ pub mod dom {
|
|||
pub mod HTMLBaseElementBinding;
|
||||
pub mod HTMLBodyElementBinding;
|
||||
pub mod HTMLBRElementBinding;
|
||||
pub mod HTMLButtonElementBinding;
|
||||
pub mod HTMLCanvasElementBinding;
|
||||
pub mod HTMLCollectionBinding;
|
||||
pub mod HTMLDataElementBinding;
|
||||
|
@ -88,6 +89,7 @@ pub mod dom {
|
|||
pub mod RegisterBindings;
|
||||
pub mod TextBinding;
|
||||
pub mod UIEventBinding;
|
||||
pub mod ValidityStateBinding;
|
||||
pub mod WindowBinding;
|
||||
pub mod WindowProxyBinding;
|
||||
}
|
||||
|
@ -108,6 +110,7 @@ pub mod dom {
|
|||
pub mod htmlbaseelement;
|
||||
pub mod htmlbodyelement;
|
||||
pub mod htmlbrelement;
|
||||
pub mod htmlbuttonelement;
|
||||
pub mod htmlcanvaselement;
|
||||
pub mod htmlcollection;
|
||||
pub mod htmldataelement;
|
||||
|
@ -140,6 +143,7 @@ pub mod dom {
|
|||
pub mod mouseevent;
|
||||
pub mod node;
|
||||
pub mod uievent;
|
||||
pub mod validitystate;
|
||||
pub mod window;
|
||||
pub mod windowproxy;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue