diff options
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rw-r--r-- | components/script/dom/htmltextareaelement.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 59cbf9e6dd7..c169a169cf9 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -2,7 +2,7 @@ * 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::attr::Attr; +use dom::attr::{Attr, AttrValue}; use dom::attr::AttrHelpers; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; @@ -55,6 +55,9 @@ impl LayoutHTMLTextAreaElementHelpers for JS<HTMLTextAreaElement> { } } +static DEFAULT_COLS: u32 = 20; +static DEFAULT_ROWS: u32 = 2; + impl HTMLTextAreaElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTextAreaElement { HTMLTextAreaElement { @@ -213,6 +216,14 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { node.check_ancestors_disabled_state_for_form_control(); } + fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { + match name { + &atom!("cols") => AttrValue::from_u32(value, DEFAULT_COLS), + &atom!("rows") => AttrValue::from_u32(value, DEFAULT_ROWS), + _ => self.super_type().unwrap().parse_plain_attribute(name, value), + } + } + fn unbind_from_tree(&self, tree_in_doc: bool) { match self.super_type() { Some(ref s) => s.unbind_from_tree(tree_in_doc), |