⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e
benches/generated/grid_align_items_baseline_multiline_row_and_column.rs
History
Who touched what
raw
Grid: baseline alignment support (#344)
1pub fn compute() {
2 #[allow(unused_imports)]
3 use taffy::prelude::*;
4 let mut taffy = taffy::Taffy::new();
5 let node0 = taffy
6 .new_leaf(taffy::style::Style {
7 display: taffy::style::Display::Grid,
8 size: taffy::geometry::Size {
9 width: taffy::style::Dimension::Points(50f32),
10 height: taffy::style::Dimension::Points(50f32),
11 },
12 ..Default::default()
13 })
14 .unwrap();
15 let node10 = taffy
16 .new_leaf(taffy::style::Style {
17 display: taffy::style::Display::Grid,
18 size: taffy::geometry::Size {
19 width: taffy::style::Dimension::Points(50f32),
20 height: taffy::style::Dimension::Points(10f32),
21 },
22 ..Default::default()
23 })
24 .unwrap();
25 let node1 = taffy
26 .new_with_children(
27 taffy::style::Style {
28 display: taffy::style::Display::Grid,
29 size: taffy::geometry::Size {
30 width: taffy::style::Dimension::Points(50f32),
31 height: taffy::style::Dimension::Points(50f32),
32 },
33 ..Default::default()
34 },
35 &[node10],
36 )
37 .unwrap();
38 let node20 = taffy
39 .new_leaf(taffy::style::Style {
40 display: taffy::style::Display::Grid,
41 size: taffy::geometry::Size {
42 width: taffy::style::Dimension::Points(50f32),
43 height: taffy::style::Dimension::Points(10f32),
44 },
45 ..Default::default()
46 })
47 .unwrap();
48 let node2 = taffy
49 .new_with_children(
50 taffy::style::Style {
51 display: taffy::style::Display::Grid,
52 size: taffy::geometry::Size {
53 width: taffy::style::Dimension::Points(50f32),
54 height: taffy::style::Dimension::Points(20f32),
55 },
56 ..Default::default()
57 },
58 &[node20],
59 )
60 .unwrap();
61 let node3 = taffy
62 .new_leaf(taffy::style::Style {
63 display: taffy::style::Display::Grid,
64 size: taffy::geometry::Size {
65 width: taffy::style::Dimension::Points(50f32),
66 height: taffy::style::Dimension::Points(20f32),
67 },
68 ..Default::default()
69 })
70 .unwrap();
71 let node = taffy
72 .new_with_children(
73 taffy::style::Style {
74 display: taffy::style::Display::Grid,
75 align_items: Some(taffy::style::AlignItems::Baseline),
76 grid_template_columns: vec![auto(), auto()],
77 size: taffy::geometry::Size {
78 width: taffy::style::Dimension::Points(100f32),
79 height: taffy::style::Dimension::Points(100f32),
80 },
81 ..Default::default()
82 },
83 &[node0, node1, node2, node3],
84 )
85 .unwrap();
86 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
87}