⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a
benches/generated/grid_percent_items_width_and_margin.rs
History
Who touched what
raw
Fix percent sized tracks (#314)
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 { width: taffy::style::Dimension::Percent(0.45f32), height: auto() },
8 margin: taffy::geometry::Rect {
9 left: taffy::style::LengthPercentageAuto::Percent(0.05f32),
10 right: taffy::style::LengthPercentageAuto::Percent(0.05f32),
11 top: taffy::style::LengthPercentageAuto::Percent(0.05f32),
12 bottom: taffy::style::LengthPercentageAuto::Percent(0.05f32),
13 },
14 padding: taffy::geometry::Rect {
15 left: taffy::style::LengthPercentage::Points(3f32),
16 right: taffy::style::LengthPercentage::Points(3f32),
17 top: taffy::style::LengthPercentage::Points(3f32),
18 bottom: taffy::style::LengthPercentage::Points(3f32),
19 },
20 ..Default::default()
21 })
22 .unwrap();
23 let node = taffy
24 .new_with_children(
25 taffy::style::Style {
26 display: taffy::style::Display::Grid,
27 size: taffy::geometry::Size { width: taffy::style::Dimension::Points(200f32), height: auto() },
28 padding: taffy::geometry::Rect {
29 left: taffy::style::LengthPercentage::Points(3f32),
30 right: taffy::style::LengthPercentage::Points(3f32),
31 top: taffy::style::LengthPercentage::Points(3f32),
32 bottom: taffy::style::LengthPercentage::Points(3f32),
33 },
34 ..Default::default()
35 },
36 &[node0],
37 )
38 .unwrap();
39 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
40}