euv_core/style/layout_prop/struct.rs
1use super::*;
2
3/// Compact layout-affecting properties packed into 112 bytes using bit-packed enums, tagged lengths, and `f32::NAN` sentinels.
4#[derive(Clone, Copy, Data, Debug)]
5pub struct LayoutStyle {
6 /// Bit-packed layout enums (`display`, `position`, `flex_direction`, `flex_wrap`, `justify_content`, `align_items`, `align_self`, `overflow`).
7 #[get(pub(crate), type(copy))]
8 #[get_mut(skip)]
9 #[set(pub(crate))]
10 pub(crate) flags: u32,
11 /// Packed 3-bit unit tags for the seven `Length` slots (`flex_basis`, `width`, `height`, `min_*`, `max_*`).
12 #[get(pub(crate), type(copy))]
13 #[get_mut(skip)]
14 #[set(pub(crate))]
15 pub(crate) length_tags: u32,
16 /// Numeric payloads for the seven packed `Length` slots (`0.0` when `Length::Auto`).
17 #[get(pub(crate), type(copy))]
18 #[get_mut(pub(crate))]
19 #[set(skip)]
20 pub(crate) length_vals: [f32; 7],
21 /// Flex grow factor (`>= 0.0`).
22 #[get(type(copy))]
23 pub(crate) flex_grow: f32,
24 /// Flex shrink factor (`>= 0.0`).
25 #[get(type(copy))]
26 pub(crate) flex_shrink: f32,
27 /// Outer margin insets.
28 #[get(type(copy))]
29 pub(crate) margin: Edges,
30 /// Inner padding insets.
31 #[get(type(copy))]
32 pub(crate) padding: Edges,
33 /// Row gap between children in logical pixels.
34 #[get(type(copy))]
35 pub(crate) row_gap: f32,
36 /// Column gap between children in logical pixels.
37 #[get(type(copy))]
38 pub(crate) column_gap: f32,
39 /// Optional explicit top offset encoded with `f32::NAN` sentinel for `None`.
40 #[get(pub(crate), type(copy))]
41 #[get_mut(skip)]
42 #[set(pub(crate))]
43 pub(crate) top_val: f32,
44 /// Optional explicit right offset encoded with `f32::NAN` sentinel for `None`.
45 #[get(pub(crate), type(copy))]
46 #[get_mut(skip)]
47 #[set(pub(crate))]
48 pub(crate) right_val: f32,
49 /// Optional explicit bottom offset encoded with `f32::NAN` sentinel for `None`.
50 #[get(pub(crate), type(copy))]
51 #[get_mut(skip)]
52 #[set(pub(crate))]
53 pub(crate) bottom_val: f32,
54 /// Optional explicit left offset encoded with `f32::NAN` sentinel for `None`.
55 #[get(pub(crate), type(copy))]
56 #[get_mut(skip)]
57 #[set(pub(crate))]
58 pub(crate) left_val: f32,
59 /// Optional fixed aspect ratio (`width / height`) encoded with `f32::NAN` sentinel for `None`.
60 #[get(pub(crate), type(copy))]
61 #[get_mut(skip)]
62 #[set(pub(crate))]
63 pub(crate) aspect_ratio_val: f32,
64 /// Stacking order for painting and hit-testing.
65 #[get(type(copy))]
66 pub(crate) z_index: i32,
67 /// Explicit grid column count when `display == Display::Grid`.
68 #[get(type(copy))]
69 pub(crate) grid_columns: u16,
70}