polished_css/property/scroll/
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>",
11            initial_value = Initial,
12            keywords = "",
13        );
14    };
15}
16
17create_struct!(ScrollMargin, "scroll-m");
18create_struct!(ScrollMarginBlock, "scroll-m-bl");
19create_struct!(ScrollMarginBlockStart, "scroll-m-bl-s");
20create_struct!(ScrollMarginBlockEnd, "scroll-m-bl-e");
21create_struct!(ScrollMarginInline, "scroll-m-in");
22create_struct!(ScrollMarginInlineStart, "scroll-m-in-s");
23create_struct!(ScrollMarginInlineEnd, "scroll-m-in-e");
24create_struct!(ScrollMarginTop, "scroll-m-t");
25create_struct!(ScrollMarginBottom, "scroll-m-b");
26create_struct!(ScrollMarginLeft, "scroll-m-l");
27create_struct!(ScrollMarginRight, "scroll-m-r");
28
29#[cfg(test)]
30mod test {
31    #[test]
32    fn scroll_margins() {
33        macro_rules! test_property {
34            ($property:ident, $name:expr, $atomic:expr) => {
35                crate::test_property_initial_value!($property, Initial);
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!(ScrollMargin, "scroll-margin", "scroll-m");
43        test_property!(ScrollMarginBlock, "scroll-margin-block", "scroll-m-bl");
44        test_property!(
45            ScrollMarginBlockStart,
46            "scroll-margin-block-start",
47            "scroll-m-bl-s"
48        );
49        test_property!(
50            ScrollMarginBlockEnd,
51            "scroll-margin-block-end",
52            "scroll-m-bl-e"
53        );
54        test_property!(ScrollMarginInline, "scroll-margin-inline", "scroll-m-in");
55        test_property!(
56            ScrollMarginInlineStart,
57            "scroll-margin-inline-start",
58            "scroll-m-in-s"
59        );
60        test_property!(
61            ScrollMarginInlineEnd,
62            "scroll-margin-inline-end",
63            "scroll-m-in-e"
64        );
65        test_property!(ScrollMarginTop, "scroll-margin-top", "scroll-m-t");
66        test_property!(ScrollMarginBottom, "scroll-margin-bottom", "scroll-m-b");
67        test_property!(ScrollMarginLeft, "scroll-margin-left", "scroll-m-l");
68        test_property!(ScrollMarginRight, "scroll-margin-right", "scroll-m-r");
69    }
70}