diff options
Diffstat (limited to 'components/script/dom/macros.rs')
-rw-r--r-- | components/script/dom/macros.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 58af2b28ac6..2b29ec8014c 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -47,6 +47,22 @@ macro_rules! make_limited_int_setter( ); #[macro_export] +macro_rules! make_int_setter( + ($attr:ident, $htmlname:tt, $default:expr) => ( + fn $attr(&self, value: i32) { + use dom::bindings::inheritance::Castable; + use dom::element::Element; + + let element = self.upcast::<Element>(); + element.set_int_attribute(&atom!($htmlname), value) + } + ); + ($attr:ident, $htmlname:tt) => { + make_int_setter!($attr, $htmlname, 0); + }; +); + +#[macro_export] macro_rules! make_int_getter( ($attr:ident, $htmlname:tt, $default:expr) => ( fn $attr(&self) -> i32 { |