Skip to content

Commit

Permalink
Generate bindings for HTMLInputElement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetsuharu OHZEKI committed Aug 23, 2013
1 parent c2391fe commit 14bdd21
Show file tree
Hide file tree
Showing 10 changed files with 495 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/script/dom/bindings/codegen/Bindings.conf
Expand Up @@ -561,6 +561,7 @@ addHTMLElement('HTMLHtmlElement')
addHTMLElement('HTMLHRElement')
addHTMLElement('HTMLIFrameElement')
addHTMLElement('HTMLImageElement')
addHTMLElement('HTMLInputElement')
addHTMLElement('HTMLLinkElement')
addHTMLElement('HTMLMetaElement')
addHTMLElement('HTMLOListElement')
Expand Down
1 change: 1 addition & 0 deletions src/components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -4631,6 +4631,7 @@ def makeEnumTypedef(e):
'dom::htmlhrelement::HTMLHRElement',
'dom::htmliframeelement::HTMLIFrameElement', #XXXjdm
'dom::htmlimageelement::HTMLImageElement', #XXXjdm
'dom::htmlinputelement::HTMLInputElement',
'dom::htmllinkelement::HTMLLinkElement', #XXXrecrack
'dom::htmlmetaelement::HTMLMetaElement',
'dom::htmlolistelement::HTMLOListElement',
Expand Down
189 changes: 189 additions & 0 deletions 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;
*/
4 changes: 3 additions & 1 deletion src/components/script/dom/bindings/node.rs
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
8 changes: 5 additions & 3 deletions src/components/script/dom/element.rs
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 14bdd21

Please sign in to comment.