diff options
author | Matthew Rasmus <mattr@zzntd.com> | 2014-12-12 12:52:46 -0800 |
---|---|---|
committer | Matthew Rasmus <mattr@zzntd.com> | 2014-12-16 11:02:01 -0800 |
commit | fc0748f50e3bc4965ff8a5ada9d352675cdd1778 (patch) | |
tree | 068025f29639d25143f377dd3a4b912ad02832b6 /components/script/dom/htmltextareaelement.rs | |
parent | 2c7f6076d174e9b47bb710031a5b6c427e83320f (diff) | |
download | servo-fc0748f50e3bc4965ff8a5ada9d352675cdd1778.tar.gz servo-fc0748f50e3bc4965ff8a5ada9d352675cdd1778.zip |
Makes layout respect <textarea> rows attribute
review addresssing
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rw-r--r-- | components/script/dom/htmltextareaelement.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 4c3789599be..642feb38b93 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -35,6 +35,7 @@ pub struct HTMLTextAreaElement { htmlelement: HTMLElement, textinput: DOMRefCell<TextInput>, cols: Cell<u32>, + rows: Cell<u32>, // https://html.spec.whatwg.org/multipage/forms.html#concept-textarea-dirty value_changed: Cell<bool>, @@ -52,6 +53,7 @@ pub trait LayoutHTMLTextAreaElementHelpers { pub trait RawLayoutHTMLTextAreaElementHelpers { unsafe fn get_cols_for_layout(&self) -> u32; + unsafe fn get_rows_for_layout(&self) -> u32; } impl LayoutHTMLTextAreaElementHelpers for JS<HTMLTextAreaElement> { @@ -66,6 +68,11 @@ impl RawLayoutHTMLTextAreaElementHelpers for HTMLTextAreaElement { unsafe fn get_cols_for_layout(&self) -> u32 { self.cols.get() } + + #[allow(unrooted_must_root)] + unsafe fn get_rows_for_layout(&self) -> u32 { + self.rows.get() + } } static DEFAULT_COLS: u32 = 20; @@ -77,6 +84,7 @@ impl HTMLTextAreaElement { htmlelement: HTMLElement::new_inherited(HTMLTextAreaElementTypeId, localName, prefix, document), textinput: DOMRefCell::new(TextInput::new(Multiple, "".to_string())), cols: Cell::new(DEFAULT_COLS), + rows: Cell::new(DEFAULT_ROWS), value_changed: Cell::new(false), } } @@ -205,6 +213,12 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { _ => panic!("Expected a UIntAttrValue"), } }, + &atom!("rows") => { + match *attr.value() { + UIntAttrValue(_, value) => self.rows.set(value), + _ => panic!("Expected a UIntAttrValue"), + } + }, _ => () } } @@ -225,6 +239,9 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLTextAreaElement> { &atom!("cols") => { self.cols.set(DEFAULT_COLS); }, + &atom!("rows") => { + self.rows.set(DEFAULT_ROWS); + }, _ => () } } |