⎇ 6652882a96948b4d8ee433a176d428cf3c3916bf
benches/generated/grid_absolute_container_negative_position_margin.rs
History
Who touched what
raw
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 position_type: taffy::style::PositionType::Absolute,
8 position: taffy::geometry::Rect {
9 left: auto(),
10 right: taffy::style::LengthPercentageAuto::Points(-15f32),
11 top: taffy::style::LengthPercentageAuto::Points(-5f32),
12 bottom: auto(),
13 },
14 ..Default::default()
15 })
16 .unwrap();
17 let node1 = taffy
18 .new_leaf(taffy::style::Style {
19 position_type: taffy::style::PositionType::Absolute,
20 position: taffy::geometry::Rect {
21 left: taffy::style::LengthPercentageAuto::Points(-35f32),
22 right: auto(),
23 top: auto(),
24 bottom: taffy::style::LengthPercentageAuto::Points(-25f32),
25 },
26 ..Default::default()
27 })
28 .unwrap();
29 let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
30 let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
31 let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
32 let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
33 let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
34 let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
35 let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap();
36 let node = taffy
37 .new_with_children(
38 taffy::style::Style {
39 display: taffy::style::Display::Grid,
40 grid_template_rows: vec![points(40f32), points(40f32), points(40f32)],
41 grid_template_columns: vec![points(40f32), points(40f32), points(40f32)],
42 padding: taffy::geometry::Rect {
43 left: taffy::style::LengthPercentage::Points(40f32),
44 right: taffy::style::LengthPercentage::Points(20f32),
45 top: taffy::style::LengthPercentage::Points(10f32),
46 bottom: taffy::style::LengthPercentage::Points(30f32),
47 },
48 ..Default::default()
49 },
50 &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
51 )
52 .unwrap();
53 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
54}