aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/components/script/html/hubbub_html_parser.rs5
-rw-r--r--src/components/script/script.rc2
-rw-r--r--src/test/html/test_bindings.html1
-rw-r--r--src/test/html/test_bindings.js7
11 files changed, 281 insertions, 3 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) {
+ }
+}
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 8cc7089027a..cc85135a967 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -14,7 +14,8 @@ use dom::element::{HTMLElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
- HTMLTableRowElementTypeId, HTMLTitleElementTypeId, HTMLUListElementTypeId,
+ HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
+ HTMLTitleElementTypeId, HTMLUListElementTypeId,
UnknownElementTypeId};
use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement,
HTMLHeadElement, HTMLHeadingElement, HTMLHtmlElement,
@@ -39,6 +40,7 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
+use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::element::{Element, Attr};
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Comment, Doctype, ElementNodeTypeId, Node, ScriptView};
@@ -237,6 +239,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
handle_element!(cx, tag, "td", HTMLTableCellElementTypeId, HTMLTableCellElement, []);
handle_element!(cx, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []);
+ handle_element!(cx, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []);
handle_element!(cx, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []);
handle_element!(cx, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []);
handle_element!(cx, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []);
diff --git a/src/components/script/script.rc b/src/components/script/script.rc
index a0f5f62fd04..2a9d0d3fd1b 100644
--- a/src/components/script/script.rc
+++ b/src/components/script/script.rc
@@ -63,6 +63,7 @@ pub mod dom {
pub mod HTMLTableElementBinding;
pub mod HTMLTableRowElementBinding;
pub mod HTMLTableSectionElementBinding;
+ pub mod HTMLTextAreaElementBinding;
pub mod MouseEventBinding;
pub mod NodeBinding;
pub mod PrototypeList;
@@ -99,6 +100,7 @@ pub mod dom {
pub mod htmltableelement;
pub mod htmltablerowelement;
pub mod htmltablesectionelement;
+ pub mod htmltextareaelement;
pub mod mouseevent;
pub mod node;
pub mod uievent;
diff --git a/src/test/html/test_bindings.html b/src/test/html/test_bindings.html
index c2d7e90fe32..b6aae39899b 100644
--- a/src/test/html/test_bindings.html
+++ b/src/test/html/test_bindings.html
@@ -29,5 +29,6 @@
<aside>aside</aside>
<b>b</b>
<i>i</i>
+ <textarea>textarea</textarea>
</body>
</html>
diff --git a/src/test/html/test_bindings.js b/src/test/html/test_bindings.js
index 952aedc51b9..dc2800a1799 100644
--- a/src/test/html/test_bindings.js
+++ b/src/test/html/test_bindings.js
@@ -151,6 +151,13 @@ for (let i = 0, l = tagList.length; i < l; ++i) {
window.alert(tags[0] instanceof HTMLElement);
}
+window.alert("HTMLTextAreaElement:");
+let tags = document.getElementsByTagName("textarea");
+window.alert(tags);
+window.alert(tags.length);
+window.alert(tags[0].tagName);
+window.alert(tags[0] instanceof HTMLTextAreaElement);
+
//TODO: Doesn't work until we throw proper exceptions instead of returning 0 on
// unwrap failure.
/*try {