diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 80aad8c136c..8888178df5f 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -7,6 +7,7 @@ use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast}; +use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementDerived, HTMLFieldSetElementDerived}; use dom::bindings::js::{JSRef, Temporary}; use dom::bindings::utils::{Reflectable, Reflector}; @@ -46,16 +47,67 @@ impl HTMLTextAreaElement { } impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { + // TODO A few of these attributes have default values and additional + // constraints + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-cols + make_uint_getter!(Cols) + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-cols + make_uint_setter!(SetCols, "cols") + // http://www.whatwg.org/html/#dom-fe-disabled make_bool_getter!(Disabled) // http://www.whatwg.org/html/#dom-fe-disabled make_bool_setter!(SetDisabled, "disabled") + // https://html.spec.whatwg.org/multipage/forms.html#attr-fe-name + make_getter!(Name) + + // https://html.spec.whatwg.org/multipage/forms.html#attr-fe-name + make_setter!(SetName, "name") + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-placeholder + make_getter!(Placeholder) + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-placeholder + make_setter!(SetPlaceholder, "placeholder") + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-required + make_bool_getter!(Required) + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-required + make_bool_setter!(SetRequired, "required") + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-rows + make_uint_getter!(Rows) + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-rows + make_uint_setter!(SetRows, "rows") + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-wrap + make_getter!(Wrap) + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-wrap + make_setter!(SetWrap, "wrap") + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-type fn Type(self) -> DOMString { "textarea".to_string() } + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-defaultvalue + fn DefaultValue(self) -> DOMString { + let node: JSRef = NodeCast::from_ref(self); + node.GetTextContent().unwrap() + } + + // https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-defaultvalue + fn SetDefaultValue(self, value: DOMString) { + let node: JSRef = NodeCast::from_ref(self); + node.SetTextContent(Some(value)) + } } impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index f3fb5b3cf40..124de2015f1 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -7,22 +7,22 @@ interface HTMLTextAreaElement : HTMLElement { // attribute DOMString autocomplete; // attribute boolean autofocus; - // attribute unsigned long cols; + attribute unsigned long cols; // attribute DOMString dirName; attribute boolean disabled; //readonly attribute HTMLFormElement? form; // attribute DOMString inputMode; // attribute long maxLength; // attribute long minLength; - // attribute DOMString name; - // attribute DOMString placeholder; + attribute DOMString name; + attribute DOMString placeholder; // attribute boolean readOnly; - // attribute boolean required; - // attribute unsigned long rows; - // attribute DOMString wrap; + attribute boolean required; + attribute unsigned long rows; + attribute DOMString wrap; readonly attribute DOMString type; - // attribute DOMString defaultValue; + attribute DOMString defaultValue; //[TreatNullAs=EmptyString] attribute DOMString value; //readonly attribute unsigned long textLength;