Adds support for input element's maxlength attr

servo/servo#7320
servo/servo#7004
This commit is contained in:
Sam Gibson 2015-08-23 16:11:04 +12:00
parent 2be60be062
commit d26c555e2a
6 changed files with 196 additions and 13 deletions

View file

@ -30,6 +30,7 @@ use script_task::ScriptTaskEventCategory::InputEvent;
use script_task::{CommonScriptMsg, Runnable};
use selectors::states::*;
use std::cell::Cell;
use std::i32;
use string_cache::Atom;
use textinput::{KeyReaction, Lines, TextInput};
use util::str::DOMString;
@ -89,6 +90,7 @@ impl<'a> RawLayoutHTMLTextAreaElementHelpers for &'a HTMLTextAreaElement {
static DEFAULT_COLS: u32 = 20;
static DEFAULT_ROWS: u32 = 2;
static DEFAULT_MAX_LENGTH: i32 = i32::MAX;
impl HTMLTextAreaElement {
fn new_inherited(localName: DOMString,
@ -99,7 +101,7 @@ impl HTMLTextAreaElement {
htmlelement:
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
localName, prefix, document),
textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, DOMString::new(), chan)),
textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, DOMString::new(), chan, None)),
cols: Cell::new(DEFAULT_COLS),
rows: Cell::new(DEFAULT_ROWS),
value_changed: Cell::new(false),