polished_css/property/layout/
dimension.rs1macro_rules! create_struct {
2 ($property:ident, $atomic:literal) => {
3 $crate::create_property!(
4 $property,
5 display = "",
6 atomic = $atomic,
7 custom = false,
8 data_type = "<length-percentage>",
9 initial_value = Initial,
10 keywords = "auto,fit-content,max-content,min-content",
11 );
12 };
13}
14
15create_struct!(Width, "w");
16create_struct!(MaxWidth, "max-w");
18create_struct!(MinWidth, "min-w");
19
20create_struct!(Height, "h");
21create_struct!(MaxHeight, "max-h");
23create_struct!(MinHeight, "min-h");
24
25#[cfg(test)]
26mod test {
27 #[test]
28 fn widths() {
29 macro_rules! test_property {
30 ($property:ident, $name:expr, $atomic:expr) => {
31 crate::test_property_initial_value!($property, Initial);
32 crate::test_global_keywords!($property, $name);
33 crate::test_function_var!($property, $name);
34 #[cfg(feature = "atomic")]
35 crate::test_atomic_property!($property, $atomic);
36 };
37 }
38 test_property!(Width, "width", "w");
39 test_property!(MaxWidth, "max-width", "max-w");
40 test_property!(MinWidth, "min-width", "min-w");
41 }
42
43 #[test]
44 fn heights() {
45 macro_rules! test_property {
46 ($property:ident, $name:expr, $atomic:expr) => {
47 crate::test_property_initial_value!($property, Initial);
48 crate::test_global_keywords!($property, $name);
49 crate::test_function_var!($property, $name);
50 #[cfg(feature = "atomic")]
51 crate::test_atomic_property!($property, $atomic);
52 };
53 }
54 test_property!(Height, "height", "h");
55 test_property!(MaxHeight, "max-height", "max-h");
56 test_property!(MinHeight, "min-height", "min-h");
57 }
58}