aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltextareaelement.rs
diff options
context:
space:
mode:
authorMatthew Rasmus <mattr@zzntd.com>2014-12-05 09:48:35 -0800
committerMatthew Rasmus <mattr@zzntd.com>2014-12-05 12:31:32 -0800
commitc97a4d999ec31b107b69ce22fd7738603c04d111 (patch)
treeea283e91e954f607998c33472e74b94db9043b3d /components/script/dom/htmltextareaelement.rs
parentf5bd8f830acd54617b74a7eed25992119e449462 (diff)
downloadservo-c97a4d999ec31b107b69ce22fd7738603c04d111.tar.gz
servo-c97a4d999ec31b107b69ce22fd7738603c04d111.zip
Handle default uint attributes properly
...and passing a whole bunch of new tests.
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rw-r--r--components/script/dom/htmltextareaelement.rs13
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),