mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Handle default uint attributes properly
...and passing a whole bunch of new tests.
This commit is contained in:
parent
f5bd8f830a
commit
c97a4d999e
2 changed files with 12 additions and 760 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue