aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom
diff options
context:
space:
mode:
authorsaneyuki_s <saneyuki.s.snyk@gmail.com>2013-08-09 22:59:57 +0900
committerJosh Matthews <josh@joshmatthews.net>2013-08-09 12:11:53 -0400
commitc1f9f438086dc171a6321bc2d7af773f56cb444b (patch)
treece174634a8f90e6b3639c6bf04178b5d7bc8a574 /src/components/script/dom
parentd0e0a16ee601df516d00605efcff1fab71fdca27 (diff)
downloadservo-c1f9f438086dc171a6321bc2d7af773f56cb444b.tar.gz
servo-c1f9f438086dc171a6321bc2d7af773f56cb444b.zip
Generate bindings for HTMLTextAreaElement.
Diffstat (limited to 'src/components/script/dom')
-rw-r--r--src/components/script/dom/bindings/codegen/Bindings.conf1
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py1
-rw-r--r--src/components/script/dom/bindings/codegen/HTMLTextAreaElement.webidl101
-rw-r--r--src/components/script/dom/bindings/node.rs3
-rw-r--r--src/components/script/dom/bindings/utils.rs2
-rw-r--r--src/components/script/dom/element.rs6
-rw-r--r--src/components/script/dom/htmltextareaelement.rs155
7 files changed, 267 insertions, 2 deletions
diff --git a/src/components/script/dom/bindings/codegen/Bindings.conf b/src/components/script/dom/bindings/codegen/Bindings.conf
index 031d78557b9..62766045344 100644
--- a/src/components/script/dom/bindings/codegen/Bindings.conf
+++ b/src/components/script/dom/bindings/codegen/Bindings.conf
@@ -564,6 +564,7 @@ addHTMLElement('HTMLStyleElement')
addHTMLElement('HTMLTableElement')
addHTMLElement('HTMLTableRowElement')
addHTMLElement('HTMLTableSectionElement')
+addHTMLElement('HTMLTextAreaElement')
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
# macros added for it
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 4666f05b91d..0622c0ec415 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -4632,6 +4632,7 @@ class CGBindingRoot(CGThing):
'dom::htmltableelement::HTMLTableElement',
'dom::htmltablerowelement::HTMLTableRowElement',
'dom::htmltablesectionelement::HTMLTableSectionElement',
+ 'dom::htmltextareaelement::HTMLTextAreaElement',
'dom::bindings::utils::*',
'dom::bindings::conversions::*',
'dom::blob::*', #XXXjdm
diff --git a/src/components/script/dom/bindings/codegen/HTMLTextAreaElement.webidl b/src/components/script/dom/bindings/codegen/HTMLTextAreaElement.webidl
new file mode 100644
index 00000000000..10c32c989fc
--- /dev/null
+++ b/src/components/script/dom/bindings/codegen/HTMLTextAreaElement.webidl
@@ -0,0 +1,101 @@
+/* -*- 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-textarea-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.
+ */
+/*
+interface nsIEditor;
+interface MozControllers;
+*/
+interface HTMLTextAreaElement : HTMLElement {
+ // attribute DOMString autocomplete;
+ [SetterThrows, Pure]
+ attribute boolean autofocus;
+ [SetterThrows, Pure]
+ attribute unsigned long cols;
+ // attribute DOMString dirName;
+ [SetterThrows, Pure]
+ attribute boolean disabled;
+/*
+ [Pure]
+ readonly attribute HTMLFormElement? form;
+*/
+ // attribute DOMString inputMode;
+ [SetterThrows, Pure]
+ attribute long maxLength;
+ [SetterThrows, Pure]
+ attribute DOMString name;
+ [SetterThrows, Pure]
+ attribute DOMString placeholder;
+ [SetterThrows, Pure]
+ attribute boolean readOnly;
+ [SetterThrows, Pure]
+ attribute boolean required;
+ [SetterThrows, Pure]
+ attribute unsigned long rows;
+ [SetterThrows, Pure]
+ attribute DOMString wrap;
+
+ [Constant]
+ readonly attribute DOMString type;
+ [SetterThrows, Pure]
+ attribute DOMString defaultValue;
+ [TreatNullAs=EmptyString] attribute DOMString value;
+ readonly attribute unsigned long textLength;
+
+ readonly attribute boolean willValidate;
+/*
+ readonly attribute ValidityState validity;
+*/
+ readonly attribute DOMString validationMessage;
+ boolean checkValidity();
+ void setCustomValidity(DOMString error);
+/*
+ readonly attribute NodeList labels;
+*/
+ void select();
+ [Throws]
+ attribute unsigned long selectionStart;
+ [Throws]
+ attribute unsigned long selectionEnd;
+ [Throws]
+ attribute DOMString selectionDirection;
+ void setRangeText(DOMString replacement);
+/*
+ void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
+
+ [Throws]
+ void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
+*/
+};
+/*
+partial interface HTMLTextAreaElement {
+ // Mirrored chrome-only Mozilla extensions to nsIDOMHTMLTextAreaElement.
+ // Please make sure to update this list of nsIDOMHTMLTextAreaElement changes.
+
+ [Throws, ChromeOnly]
+ readonly attribute MozControllers controllers;
+};
+
+partial interface HTMLTextAreaElement {
+ // Mirrored chrome-only nsIDOMNSEditableElement methods. Please make sure
+ // to update this list if nsIDOMNSEditableElement changes.
+
+ [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);
+};
+*/
diff --git a/src/components/script/dom/bindings/node.rs b/src/components/script/dom/bindings/node.rs
index ee228f90e58..0b2289d9f12 100644
--- a/src/components/script/dom/bindings/node.rs
+++ b/src/components/script/dom/bindings/node.rs
@@ -14,6 +14,7 @@ use dom::element::{HTMLBRElementTypeId};
use dom::element::{HTMLParagraphElementTypeId, HTMLScriptElementTypeId, HTMLMetaElementTypeId};
use dom::element::{HTMLOListElementTypeId, HTMLStyleElementTypeId, HTMLTableElementTypeId};
use dom::element::{HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId};
+use dom::element::{HTMLTextAreaElementTypeId};
use dom::element::{HTMLHeadElement, HTMLHtmlElement, HTMLDivElement, HTMLSpanElement};
use dom::element::{HTMLParagraphElement};
use dom::htmlelement::HTMLElement;
@@ -30,6 +31,7 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
+use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
use dom::node::{DoctypeNodeTypeId, ScriptView, Text};
@@ -114,6 +116,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLTableElementTypeId) => generate_element!(HTMLTableElement),
ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement),
ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement),
+ ElementNodeTypeId(HTMLTextAreaElementTypeId) => generate_element!(HTMLTextAreaElement),
ElementNodeTypeId(_) => element::create(cx, node).ptr,
CommentNodeTypeId |
DoctypeNodeTypeId => text::create(cx, node).ptr,
diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs
index 5b4aec76baa..1732692a2c4 100644
--- a/src/components/script/dom/bindings/utils.rs
+++ b/src/components/script/dom/bindings/utils.rs
@@ -617,7 +617,7 @@ pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: uint, _vp: *JSVal) ->
}
pub fn initialize_global(global: *JSObject) {
- let protoArray = @mut ([0 as *JSObject, ..48]);
+ let protoArray = @mut ([0 as *JSObject, ..49]);
assert!(protoArray.len() == PrototypeList::id::_ID_Count as uint);
unsafe {
//XXXjdm we should be storing the box pointer instead of the inner
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs
index 87e437d81a3..3b9681da8d2 100644
--- a/src/components/script/dom/element.rs
+++ b/src/components/script/dom/element.rs
@@ -12,7 +12,7 @@ use dom::bindings::codegen::{HTMLParagraphElementBinding, HTMLScriptElementBindi
use dom::bindings::codegen::{HTMLImageElementBinding, HTMLOListElementBinding};
use dom::bindings::codegen::{HTMLMetaElementBinding, HTMLStyleElementBinding};
use dom::bindings::codegen::{HTMLTableElementBinding, HTMLTableRowElementBinding};
-use dom::bindings::codegen::{HTMLTableSectionElementBinding};
+use dom::bindings::codegen::{HTMLTableSectionElementBinding, HTMLTextAreaElementBinding};
use dom::bindings::utils::{null_string, str};
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, WrapperCache};
use dom::clientrect::ClientRect;
@@ -32,6 +32,7 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
+use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};
@@ -97,6 +98,7 @@ pub enum ElementTypeId {
HTMLTableCellElementTypeId,
HTMLTableElementTypeId,
HTMLTableRowElementTypeId,
+ HTMLTextAreaElementTypeId,
HTMLTitleElementTypeId,
HTMLUListElementTypeId,
UnknownElementTypeId,
@@ -212,6 +214,8 @@ generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wra
generate_binding_object!(HTMLTableRowElement)
generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap)
generate_binding_object!(HTMLTableSectionElement)
+generate_cacheable_wrapper!(HTMLTextAreaElement, HTMLTextAreaElementBinding::Wrap)
+generate_binding_object!(HTMLTextAreaElement)
//
// Fancier elements
diff --git a/src/components/script/dom/htmltextareaelement.rs b/src/components/script/dom/htmltextareaelement.rs
new file mode 100644
index 00000000000..55bbb9ee4da
--- /dev/null
+++ b/src/components/script/dom/htmltextareaelement.rs
@@ -0,0 +1,155 @@
+/* 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 HTMLTextAreaElement {
+ parent: HTMLElement,
+}
+
+impl HTMLTextAreaElement {
+ pub fn Autofocus(&self) -> bool {
+ false
+ }
+
+ pub fn SetAutofocus(&mut self, _autofocus: bool, _rv: &mut ErrorResult) {
+ }
+
+ pub fn Cols(&self) -> u32 {
+ 0
+ }
+
+ pub fn SetCols(&self, _cols: u32, _rv: &mut ErrorResult) {
+ }
+
+ pub fn Disabled(&self) -> bool {
+ false
+ }
+
+ pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) {
+ }
+
+ pub fn MaxLength(&self) -> i32 {
+ 0
+ }
+
+ pub fn SetMaxLength(&self, _max_length: i32, _rv: &mut ErrorResult) {
+ }
+
+ pub fn Name(&self) -> DOMString {
+ null_string
+ }
+
+ pub fn SetName(&mut self, _name: &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 Rows(&self) -> u32 {
+ 0
+ }
+
+ pub fn SetRows(&self, _rows: u32, _rv: &mut ErrorResult) {
+ }
+
+ pub fn Wrap(&self) -> DOMString {
+ null_string
+ }
+
+ pub fn SetWrap(&mut self, _wrap: &DOMString, _rv: &mut ErrorResult) {
+ }
+
+ pub fn Type(&self) -> DOMString {
+ null_string
+ }
+
+ pub fn SetType(&mut self, _type: &DOMString) {
+ }
+
+ 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) {
+ }
+
+ pub fn TextLength(&self) -> u32 {
+ 0
+ }
+
+ pub fn SetTextLength(&self, _text_length: u32, _rv: &mut ErrorResult) {
+ }
+
+ pub fn WillValidate(&self) -> bool {
+ false
+ }
+
+ pub fn SetWillValidate(&mut self, _will_validate: bool, _rv: &mut ErrorResult) {
+ }
+
+ pub fn ValidationMessage(&self) -> 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) -> u32 {
+ 0
+ }
+
+ pub fn SetSelectionStart(&self, _selection_start: u32, _rv: &mut ErrorResult) {
+ }
+
+ pub fn GetSelectionEnd(&self, _rv: &mut ErrorResult) -> u32 {
+ 0
+ }
+
+ pub fn SetSelectionEnd(&self, _selection_end: u32, _rv: &mut ErrorResult) {
+ }
+
+ pub fn GetSelectionDirection(&self, _rv: &mut ErrorResult) -> DOMString {
+ null_string
+ }
+
+ pub fn SetSelectionDirection(&self, _selection_direction: &DOMString, _rv: &mut ErrorResult) {
+ }
+
+ pub fn SetRangeText(&self, _replacement: &DOMString) {
+ }
+}