Implement non-zero dimension attribute parsing

Fixes #8445

The only attributes I found that we have implemented that uses non-zero
dimenion attributes:

* `width` for `<td>` and `<th>` (table cells)
* `width` for `<table>`

I updated these implementations to use the new non-zero dimension
attribute parsing and added associated regression tests.
This commit is contained in:
Corey Farwell 2015-12-21 19:49:30 -08:00
parent dafdc856ac
commit ba659cb99c
13 changed files with 227 additions and 291 deletions

View file

@ -120,7 +120,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
make_getter!(Width, "width");
// https://html.spec.whatwg.org/multipage/#dom-table-width
make_dimension_setter!(SetWidth, "width");
make_nonzero_dimension_setter!(SetWidth, "width");
}
pub trait HTMLTableElementLayoutHelpers {
@ -195,7 +195,7 @@ impl VirtualMethods for HTMLTableElement {
fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue {
match *local_name {
atom!("border") => AttrValue::from_u32(value, 1),
atom!("width") => AttrValue::from_dimension(value),
atom!("width") => AttrValue::from_nonzero_dimension(value),
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
}
}