diff options
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rw-r--r-- | components/script/dom/htmltextareaelement.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 5e6724d5c63..dc2f89c6122 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -30,6 +30,7 @@ use textinput::{TextInput, Lines, KeyReaction}; use dom::virtualmethods::VirtualMethods; use dom::window::WindowHelpers; use script_task::{ScriptMsg, Runnable}; +use msg::constellation_msg::ConstellationChan; use util::str::DOMString; use string_cache::Atom; @@ -40,7 +41,7 @@ use std::cell::Cell; #[dom_struct] pub struct HTMLTextAreaElement { htmlelement: HTMLElement, - textinput: DOMRefCell<TextInput>, + textinput: DOMRefCell<TextInput<ConstellationChan>>, cols: Cell<u32>, rows: Cell<u32>, // https://html.spec.whatwg.org/multipage/#concept-textarea-dirty @@ -95,7 +96,7 @@ impl HTMLTextAreaElement { let chan = document.window().root().r().constellation_chan(); HTMLTextAreaElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTextAreaElement, localName, prefix, document), - textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), Some(chan))), + textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), chan)), cols: Cell::new(DEFAULT_COLS), rows: Cell::new(DEFAULT_ROWS), value_changed: Cell::new(false), @@ -114,10 +115,8 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { // constraints // https://html.spec.whatwg.org/multipage/#dom-textarea-cols - make_uint_getter!(Cols); - - // https://html.spec.whatwg.org/multipage/#dom-textarea-cols - make_uint_setter!(SetCols, "cols"); + make_uint_getter!(Cols, "cols", DEFAULT_COLS); + make_limited_uint_setter!(SetCols, "cols", DEFAULT_COLS); // https://www.whatwg.org/html/#dom-fe-disabled make_bool_getter!(Disabled); @@ -150,10 +149,8 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { make_bool_setter!(SetRequired, "required"); // https://html.spec.whatwg.org/multipage/#dom-textarea-rows - make_uint_getter!(Rows); - - // https://html.spec.whatwg.org/multipage/#dom-textarea-rows - make_uint_setter!(SetRows, "rows"); + make_uint_getter!(Rows, "rows", DEFAULT_ROWS); + make_limited_uint_setter!(SetRows, "rows", DEFAULT_ROWS); // https://html.spec.whatwg.org/multipage/#dom-textarea-wrap make_getter!(Wrap); @@ -310,8 +307,8 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { 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), + &atom!("cols") => AttrValue::from_limited_u32(value, DEFAULT_COLS), + &atom!("rows") => AttrValue::from_limited_u32(value, DEFAULT_ROWS), _ => self.super_type().unwrap().parse_plain_attribute(name, value), } } |