⎇ 0596475afda99229de96976e73b2d637c78fdb8b
benches/generated/grid_fit_content_percent_indefinite_max_content.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Fix grid track sizing for `fit-content(percentage)` and for items spanning percentage gaps (#335)
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_with_measure(
7 taffy::style::Style { ..Default::default() },
8 taffy::node::MeasureFunc::Raw(|known_dimensions, available_space| {
9 const TEXT: &str = "HH";
10 super::measure_standard_text(
11 known_dimensions,
12 available_space,
13 TEXT,
14 super::WritingMode::Horizontal,
15 None,
16 )
17 }),
18 )
19 .unwrap();
20 let node = taffy
21 .new_with_children(
22 taffy::style::Style {
23 display: taffy::style::Display::Grid,
24 grid_template_rows: vec![points(40f32)],
25 grid_template_columns: vec![fit_content(percent(0.5f32))],
26 ..Default::default()
27 },
28 &[node0],
29 )
30 .unwrap();
31 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
32}