polished_css/property/layout/
margin.rs

1//! FIXME: Handle shorthands
2
3macro_rules! create_struct {
4    ($property:ident, $atomic:expr) => {
5        $crate::create_property!(
6            $property,
7            display = "",
8            atomic = $atomic,
9            custom = false,
10            data_type = "<length-percentage>",
11            initial_value = Auto,
12            keywords = "auto",
13        );
14    };
15}
16
17create_struct!(Margin, "m");
18create_struct!(MarginBlock, "m-bl");
19create_struct!(MarginBlockStart, "m-bl-s");
20create_struct!(MarginBlockEnd, "m-bl-e");
21create_struct!(MarginInline, "m-in");
22create_struct!(MarginInlineStart, "m-in-s");
23create_struct!(MarginInlineEnd, "m-in-e");
24create_struct!(MarginTop, "m-t");
25create_struct!(MarginBottom, "m-b");
26create_struct!(MarginLeft, "m-l");
27create_struct!(MarginRight, "m-r");
28
29#[cfg(test)]
30mod test {
31    #[test]
32    fn margins() {
33        macro_rules! test_property {
34            ($property:ident, $name:expr, $atomic:expr) => {
35                crate::test_property_initial_value!($property, Auto);
36                crate::test_global_keywords!($property, $name);
37                crate::test_function_var!($property, $name);
38                #[cfg(feature = "atomic")]
39                crate::test_atomic_property!($property, $atomic);
40            };
41        }
42        test_property!(Margin, "margin", "m");
43        test_property!(MarginBlock, "margin-block", "m-bl");
44        test_property!(MarginBlockStart, "margin-block-start", "m-bl-s");
45        test_property!(MarginBlockEnd, "margin-block-end", "m-bl-e");
46        test_property!(MarginInline, "margin-inline", "m-in");
47        test_property!(MarginInlineStart, "margin-inline-start", "m-in-s");
48        test_property!(MarginInlineEnd, "margin-inline-end", "m-in-e");
49        test_property!(MarginTop, "margin-top", "m-t");
50        test_property!(MarginBottom, "margin-bottom", "m-b");
51        test_property!(MarginLeft, "margin-left", "m-l");
52        test_property!(MarginRight, "margin-right", "m-r");
53    }
54}