diff options
author | Tetsuharu OHZEKI <saneyuki.s.snyk@gmail.com> | 2013-08-14 21:13:56 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.s.snyk@gmail.com> | 2013-08-24 00:25:26 +0900 |
commit | 14bdd21ed8dfc54ab6da61456c970e790ad72b95 (patch) | |
tree | 3e3fed9819537e446bd4f1193c6aab99b8b194c6 /src/components/script/dom | |
parent | c2391fe5ffe421004c8b0906301a19379bf238ab (diff) | |
download | servo-14bdd21ed8dfc54ab6da61456c970e790ad72b95.tar.gz servo-14bdd21ed8dfc54ab6da61456c970e790ad72b95.zip |
Generate bindings for HTMLInputElement.
Diffstat (limited to 'src/components/script/dom')
6 files changed, 484 insertions, 4 deletions
diff --git a/src/components/script/dom/bindings/codegen/Bindings.conf b/src/components/script/dom/bindings/codegen/Bindings.conf index 9af23acc26e..8c3b002c33d 100644 --- a/src/components/script/dom/bindings/codegen/Bindings.conf +++ b/src/components/script/dom/bindings/codegen/Bindings.conf @@ -561,6 +561,7 @@ addHTMLElement('HTMLHtmlElement') addHTMLElement('HTMLHRElement') addHTMLElement('HTMLIFrameElement') addHTMLElement('HTMLImageElement') +addHTMLElement('HTMLInputElement') addHTMLElement('HTMLLinkElement') addHTMLElement('HTMLMetaElement') addHTMLElement('HTMLOListElement') diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index ae1d4beaac4..c1fe734e1cd 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -4631,6 +4631,7 @@ class CGBindingRoot(CGThing): 'dom::htmlhrelement::HTMLHRElement', 'dom::htmliframeelement::HTMLIFrameElement', #XXXjdm 'dom::htmlimageelement::HTMLImageElement', #XXXjdm + 'dom::htmlinputelement::HTMLInputElement', 'dom::htmllinkelement::HTMLLinkElement', #XXXrecrack 'dom::htmlmetaelement::HTMLMetaElement', 'dom::htmlolistelement::HTMLOListElement', diff --git a/src/components/script/dom/bindings/codegen/HTMLInputElement.webidl b/src/components/script/dom/bindings/codegen/HTMLInputElement.webidl new file mode 100644 index 00000000000..d55241ef4fc --- /dev/null +++ b/src/components/script/dom/bindings/codegen/HTMLInputElement.webidl @@ -0,0 +1,189 @@ +/* -*- 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-input-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © 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. + */ + +// original import from: +// http://hg.mozilla.org/mozilla-central/filelog/8c240c67f76c/dom/webidl/HTMLInputElement.webidl + +/* +interface nsIControllers; +*/ + +interface HTMLInputElement : HTMLElement { + [Pure, SetterThrows] + attribute DOMString accept; + [Pure, SetterThrows] + attribute DOMString alt; + [Pure, SetterThrows] + attribute DOMString autocomplete; + [Pure, SetterThrows] + attribute boolean autofocus; + [Pure, SetterThrows] + attribute boolean defaultChecked; + [Pure] + attribute boolean checked; +/* + attribute DOMString dirName; +*/ + [Pure, SetterThrows] + attribute boolean disabled; +/* + readonly attribute HTMLFormElement? form; + [Pure] + readonly attribute FileList? files; +*/ + [Pure, SetterThrows] + attribute DOMString formAction; + [Pure, SetterThrows] + attribute DOMString formEnctype; + [Pure, SetterThrows] + attribute DOMString formMethod; + [Pure, SetterThrows] + attribute boolean formNoValidate; + [Pure, SetterThrows] + attribute DOMString formTarget; + [Pure, SetterThrows] + attribute unsigned long height; + [Pure] + attribute boolean indeterminate; + [Pure, SetterThrows] + attribute DOMString inputMode; +/* + [Pure] + readonly attribute HTMLElement? list; +*/ + [Pure, SetterThrows] + attribute DOMString max; + [Pure, SetterThrows] + attribute long maxLength; + [Pure, SetterThrows] + attribute DOMString min; + [Pure, SetterThrows] + attribute boolean multiple; + [Pure, SetterThrows] + attribute DOMString name; + [Pure, SetterThrows] + attribute DOMString pattern; + [Pure, SetterThrows] + attribute DOMString placeholder; + [Pure, SetterThrows] + attribute boolean readOnly; + [Pure, SetterThrows] + attribute boolean required; + [Pure, SetterThrows] + attribute unsigned long size; + [Pure, SetterThrows] + attribute DOMString src; + [Pure, SetterThrows] + attribute DOMString step; + [Pure, SetterThrows] + attribute DOMString type; + [Pure, SetterThrows] + attribute DOMString defaultValue; + [Pure, TreatNullAs=EmptyString, SetterThrows] + attribute DOMString value; +/* + [Throws, Pref="dom.experimental_forms"] + attribute Date? valueAsDate; + [Pure, SetterThrows] + attribute unrestricted double valueAsNumber; +*/ + attribute unsigned long width; +/* + [Throws] + void stepUp(optional long n = 1); + [Throws] + void stepDown(optional long n = 1); +*/ + + [Pure] + readonly attribute boolean willValidate; +/* + [Pure] + readonly attribute ValidityState validity; +*/ + [GetterThrows] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(DOMString error); + +/* + readonly attribute NodeList labels; +*/ + + void select(); + + [Throws] + // TODO: unsigned vs signed + attribute long selectionStart; + [Throws] + attribute long selectionEnd; + [Throws] + attribute DOMString selectionDirection; +/* + // Bug 850364 void setRangeText(DOMString replacement); + // Bug 850364 setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode); +*/ + // also has obsolete members +}; + +partial interface HTMLInputElement { + [Pure, SetterThrows] + attribute DOMString align; + [Pure, SetterThrows] + attribute DOMString useMap; +}; + +/* +// Mozilla extensions +partial interface HTMLInputElement { + [Throws] + void setSelectionRange(long start, long end, optional DOMString direction); + + [GetterThrows] + readonly attribute nsIControllers controllers; + [GetterThrows] + readonly attribute long textLength; + + [ChromeOnly] + sequence<DOMString> mozGetFileNameArray(); + + [ChromeOnly] + void mozSetFileNameArray(sequence<DOMString> fileNames); + + boolean mozIsTextField(boolean aExcludePassword); +}; + +partial interface HTMLInputElement { + // Mirrored chrome-only nsIDOMNSEditableElement methods. Please make sure + // to update this list if nsIDOMNSEditableElement changes. + + [Pure, ChromeOnly] + readonly attribute nsIEditor? editor; + + // This is similar to set .value on nsIDOMInput/TextAreaElements, but handling + // of the value change is closer to the normal user input, so 'change' event + // for example will be dispatched when focusing out the element. + [ChromeOnly] + void setUserInput(DOMString input); +}; + +[NoInterfaceObject] +interface MozPhonetic { + [Pure, ChromeOnly] + readonly attribute DOMString phonetic; +}; + +HTMLInputElement implements MozImageLoadingContent; +HTMLInputElement implements MozPhonetic; +*/ diff --git a/src/components/script/dom/bindings/node.rs b/src/components/script/dom/bindings/node.rs index b6ebc545ca8..f3fd0f6d1ea 100644 --- a/src/components/script/dom/bindings/node.rs +++ b/src/components/script/dom/bindings/node.rs @@ -13,7 +13,7 @@ use dom::element::{HTMLElementTypeId, HTMLCanvasElementTypeId, HTMLDataElementTypeId, HTMLDivElementTypeId, HTMLHeadElementTypeId, HTMLHRElementTypeId, HTMLHtmlElementTypeId, HTMLIframeElementTypeId, HTMLImageElementTypeId, - HTMLLinkElementTypeId, + HTMLInputElementTypeId, HTMLLinkElementTypeId, HTMLMetaElementTypeId, HTMLOListElementTypeId, HTMLParagraphElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId, HTMLSpanElementTypeId, HTMLSourceElementTypeId, @@ -36,6 +36,7 @@ use dom::htmldataelement::HTMLDataElement; use dom::htmldlistelement::HTMLDListElement; use dom::htmliframeelement::HTMLIFrameElement; use dom::htmlimageelement::HTMLImageElement; +use dom::htmlinputelement::HTMLInputElement; use dom::htmllinkelement::HTMLLinkElement; use dom::htmlmetaelement::HTMLMetaElement; use dom::htmlolistelement::HTMLOListElement; @@ -133,6 +134,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject ElementNodeTypeId(HTMLHtmlElementTypeId) => generate_element!(HTMLHtmlElement), ElementNodeTypeId(HTMLIframeElementTypeId) => generate_element!(HTMLIFrameElement), ElementNodeTypeId(HTMLImageElementTypeId) => generate_element!(HTMLImageElement), + ElementNodeTypeId(HTMLInputElementTypeId) => generate_element!(HTMLInputElement), ElementNodeTypeId(HTMLLinkElementTypeId) => generate_element!(HTMLLinkElement), ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement), ElementNodeTypeId(HTMLOListElementTypeId) => generate_element!(HTMLOListElement), diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 64d0772ce75..4737aafdb3d 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -11,8 +11,8 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding, HTMLDListElementBinding, HTMLDivElementBinding, HTMLHeadElementBinding, HTMLHRElementBinding, HTMLHtmlElementBinding, HTMLIFrameElementBinding, - HTMLImageElementBinding, HTMLMetaElementBinding, - HTMLLinkElementBinding, + HTMLImageElementBinding, HTMLInputElementBinding, + HTMLLinkElementBinding, HTMLMetaElementBinding, HTMLOListElementBinding, HTMLParagraphElementBinding, HTMLQuoteElementBinding, HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding, @@ -39,6 +39,7 @@ use dom::htmlelement::HTMLElement; use dom::htmlhrelement::HTMLHRElement; use dom::htmliframeelement::HTMLIFrameElement; use dom::htmlimageelement::HTMLImageElement; +use dom::htmlinputelement::HTMLInputElement; use dom::htmllinkelement::HTMLLinkElement; use dom::htmlmetaelement::HTMLMetaElement; use dom::htmlolistelement::HTMLOListElement; @@ -148,7 +149,6 @@ pub struct HTMLFontElement { parent: HTMLElement } pub struct HTMLFormElement { parent: HTMLElement } pub struct HTMLHeadElement { parent: HTMLElement } pub struct HTMLHtmlElement { parent: HTMLElement } -pub struct HTMLInputElement { parent: HTMLElement } pub struct HTMLListItemElement { parent: HTMLElement } pub struct HTMLOptionElement { parent: HTMLElement } pub struct HTMLParagraphElement { parent: HTMLElement } @@ -239,6 +239,8 @@ generate_cacheable_wrapper!(HTMLIFrameElement, HTMLIFrameElementBinding::Wrap) generate_binding_object!(HTMLIFrameElement) generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap) generate_binding_object!(HTMLImageElement) +generate_cacheable_wrapper!(HTMLInputElement, HTMLInputElementBinding::Wrap) +generate_binding_object!(HTMLInputElement) generate_cacheable_wrapper!(HTMLLinkElement, HTMLLinkElementBinding::Wrap) generate_binding_object!(HTMLLinkElement) generate_cacheable_wrapper!(HTMLMetaElement, HTMLMetaElementBinding::Wrap) diff --git a/src/components/script/dom/htmlinputelement.rs b/src/components/script/dom/htmlinputelement.rs new file mode 100644 index 00000000000..8dbcc1826e9 --- /dev/null +++ b/src/components/script/dom/htmlinputelement.rs @@ -0,0 +1,285 @@ +/* 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; + +pub struct HTMLInputElement { + parent: HTMLElement, +} + +impl HTMLInputElement { + pub fn Accept(&self) -> DOMString { + null_string + } + + pub fn SetAccept(&mut self, _accept: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Alt(&self) -> DOMString { + null_string + } + + pub fn SetAlt(&mut self, _alt: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Autocomplete(&self) -> DOMString { + null_string + } + + pub fn SetAutocomplete(&mut self, _autocomple: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Autofocus(&self) -> bool { + false + } + + pub fn SetAutofocus(&mut self, _autofocus: bool, _rv: &mut ErrorResult) { + } + + pub fn DefaultChecked(&self) -> bool { + false + } + + pub fn SetDefaultChecked(&mut self, _default_checked: bool, _rv: &mut ErrorResult) { + } + + pub fn Checked(&self) -> bool { + false + } + + pub fn SetChecked(&mut self, _checked: bool) { + } + + pub fn Disabled(&self) -> bool { + false + } + + pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) { + } + + pub fn FormAction(&self) -> DOMString { + null_string + } + + pub fn SetFormAction(&mut self, _form_action: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn FormEnctype(&self) -> DOMString { + null_string + } + + pub fn SetFormEnctype(&mut self, _form_enctype: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn FormMethod(&self) -> DOMString { + null_string + } + + pub fn SetFormMethod(&mut self, _form_method: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn FormNoValidate(&self) -> bool { + false + } + + pub fn SetFormNoValidate(&mut self, _form_no_validate: bool, _rv: &mut ErrorResult) { + } + + pub fn FormTarget(&self) -> DOMString { + null_string + } + + pub fn SetFormTarget(&mut self, _form_target: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Height(&self) -> u32 { + 0 + } + + pub fn SetHeight(&mut self, _height: u32, _rv: &mut ErrorResult) { + } + + pub fn Indeterminate(&self) -> bool { + false + } + + pub fn SetIndeterminate(&mut self, _indeterminate: bool) { + } + + pub fn InputMode(&self) -> DOMString { + null_string + } + + pub fn SetInputMode(&mut self, _input_mode: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Max(&self) -> DOMString { + null_string + } + + pub fn SetMax(&mut self, _max: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn MaxLength(&self) -> i32 { + 0 + } + + pub fn SetMaxLength(&mut self, _max_length: i32, _rv: &mut ErrorResult) { + } + + pub fn Min(&self) -> DOMString { + null_string + } + + pub fn SetMin(&mut self, _min: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Multiple(&self) -> bool { + false + } + + pub fn SetMultiple(&mut self, _multiple: bool, _rv: &mut ErrorResult) { + } + + pub fn Name(&self) -> DOMString { + null_string + } + + pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Pattern(&self) -> DOMString { + null_string + } + + pub fn SetPattern(&mut self, _pattern: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Placeholder(&self) -> DOMString { + null_string + } + + pub fn SetPlaceholder(&mut self, _placeholder: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn ReadOnly(&self) -> bool { + false + } + + pub fn SetReadOnly(&mut self, _read_only: bool, _rv: &mut ErrorResult) { + } + + pub fn Required(&self) -> bool { + false + } + + pub fn SetRequired(&mut self, _required: bool, _rv: &mut ErrorResult) { + } + + pub fn Size(&self) -> u32 { + 0 + } + + pub fn SetSize(&mut self, _size: u32, _rv: &mut ErrorResult) { + } + + pub fn Src(&self) -> DOMString { + null_string + } + + pub fn SetSrc(&mut self, _src: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Step(&self) -> DOMString { + null_string + } + + pub fn SetStep(&mut self, _step: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Type(&self) -> DOMString { + null_string + } + + pub fn SetType(&mut self, _type: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn DefaultValue(&self) -> DOMString { + null_string + } + + pub fn SetDefaultValue(&mut self, _default_value: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Value(&self) -> DOMString { + null_string + } + + pub fn SetValue(&mut self, _value: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Width(&self) -> u32 { + 0 + } + + pub fn SetWidth(&mut self, _width: u32) { + } + + pub fn WillValidate(&self) -> bool { + false + } + + pub fn SetWillValidate(&self, _will_validate: bool) { + } + + pub fn GetValidationMessage(&self, _rv: &mut ErrorResult) -> DOMString { + null_string + } + + pub fn CheckValidity(&self) -> bool { + false + } + + pub fn SetCustomValidity(&self, _error: &DOMString) { + } + + pub fn Select(&self) { + } + + pub fn GetSelectionStart(&self, _rv: &mut ErrorResult) -> i32 { + 0 + } + + pub fn SetSelectionStart(&mut self, _selection_start: i32, _rv: &mut ErrorResult) { + } + + pub fn GetSelectionEnd(&self, _rv: &mut ErrorResult) -> i32 { + 0 + } + + pub fn SetSelectionEnd(&mut self, _selection_end: i32, _rv: &mut ErrorResult) { + } + + pub fn GetSelectionDirection(&self, _rv: &mut ErrorResult) -> DOMString { + null_string + } + + pub fn SetSelectionDirection(&mut self, _selection_direction: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Align(&self) -> DOMString { + null_string + } + + pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn UseMap(&self) -> DOMString { + null_string + } + + pub fn SetUseMap(&mut self, _align: &DOMString, _rv: &mut ErrorResult) { + } +} |