mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
parent
dafdc856ac
commit
ba659cb99c
13 changed files with 227 additions and 291 deletions
|
@ -236,6 +236,19 @@ macro_rules! make_dimension_setter(
|
|||
);
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! make_nonzero_dimension_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
let value = AttrValue::from_nonzero_dimension(value);
|
||||
element.set_attribute(&atom!($htmlname), value)
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
/// For use on non-jsmanaged types
|
||||
/// Use #[derive(JSTraceable)] on JS managed types
|
||||
macro_rules! no_jsmanaged_fields(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue