⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a
benches/generated/align_baseline_child_margin_percent.rs
History
Who touched what
raw
Fix flexbox baseline alignment (#325)
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 size: taffy::geometry::Size {
8 width: taffy::style::Dimension::Points(50f32),
9 height: taffy::style::Dimension::Points(50f32),
10 },
11 margin: taffy::geometry::Rect {
12 left: taffy::style::LengthPercentageAuto::Percent(0.05f32),
13 right: taffy::style::LengthPercentageAuto::Percent(0.05f32),
14 top: taffy::style::LengthPercentageAuto::Percent(0.05f32),
15 bottom: taffy::style::LengthPercentageAuto::Percent(0.05f32),
16 },
17 ..Default::default()
18 })
19 .unwrap();
20 let node10 = taffy
21 .new_leaf(taffy::style::Style {
22 size: taffy::geometry::Size {
23 width: taffy::style::Dimension::Points(50f32),
24 height: taffy::style::Dimension::Points(10f32),
25 },
26 margin: taffy::geometry::Rect {
27 left: taffy::style::LengthPercentageAuto::Percent(0.01f32),
28 right: taffy::style::LengthPercentageAuto::Percent(0.01f32),
29 top: taffy::style::LengthPercentageAuto::Percent(0.01f32),
30 bottom: taffy::style::LengthPercentageAuto::Percent(0.01f32),
31 },
32 ..Default::default()
33 })
34 .unwrap();
35 let node1 = taffy
36 .new_with_children(
37 taffy::style::Style {
38 flex_direction: taffy::style::FlexDirection::Column,
39 size: taffy::geometry::Size {
40 width: taffy::style::Dimension::Points(50f32),
41 height: taffy::style::Dimension::Points(20f32),
42 },
43 ..Default::default()
44 },
45 &[node10],
46 )
47 .unwrap();
48 let node = taffy
49 .new_with_children(
50 taffy::style::Style {
51 align_items: Some(taffy::style::AlignItems::Baseline),
52 size: taffy::geometry::Size {
53 width: taffy::style::Dimension::Points(100f32),
54 height: taffy::style::Dimension::Points(100f32),
55 },
56 ..Default::default()
57 },
58 &[node0, node1],
59 )
60 .unwrap();
61 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
62}