mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #8434 - frewsxcv:dimension-attrvalue, r=eefriedman
Add Dimension member to AttrValue Fixes #8417 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8434) <!-- Reviewable:end -->
This commit is contained in:
commit
cd6813ea39
4 changed files with 44 additions and 13 deletions
|
@ -231,6 +231,21 @@ macro_rules! make_legacy_color_setter(
|
|||
);
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! make_dimension_setter(
|
||||
( $attr:ident, $htmlname:expr ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::element::Element;
|
||||
use string_cache::Atom;
|
||||
let element = self.upcast::<Element>();
|
||||
let value = AttrValue::from_dimension(value);
|
||||
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
||||
element.set_attribute(&Atom::from_slice($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