Fix wrong size propogation for absolute elements (#878)
* Fix wrong size propogation for absolute elements
* Add fix+test for grid and test block
---------
Co-authored-by: Nico Burns <nico@nicoburns.com>
f99b57fbad456aa2756b374ff40c876e4b9574c2 · by Lutetium-Vanadium · (1 year ago) · parent df1ba340c · browse the tree at this commit
Semantic delta · 14
src/compute/grid/alignment.rs
tests/generated/block/absolute_correct_cross_child_size_with_percentage.rs
tests/generated/block/mod.rs
tests/generated/flex/absolute_correct_cross_child_size_with_percentage.rs
tests/generated/flex/mod.rs
tests/generated/grid/absolute_correct_cross_child_size_with_percentage.rs
tests/generated/grid/mod.rs
diff --git a/src/compute/block.rs b/src/compute/block.rs
index 35f5be89f..64792de93 100644
--- a/src/compute/block.rs
+++ b/src/compute/block.rs
@@ -653,7 +653,7 @@ fn perform_absolute_layout_on_absolute_children(
known_dimensions = known_dimensions.maybe_apply_aspect_ratio(aspect_ratio).maybe_clamp(min_size, max_size);
}
- let layout_output = tree.perform_child_layout(
+ let measured_size = tree.measure_child_size_both(
item.node_id,
known_dimensions,
area_size.map(Some),
@@ -664,9 +664,21 @@ fn perform_absolute_layout_on_absolute_children(
SizingMode::ContentSize,
Line::FALSE,
);
- let measured_size = layout_output.size;
+
let final_size = known_dimensions.unwrap_or(measured_size).maybe_clamp(min_size, max_size);
+ let layout_output = tree.perform_child_layout(
+ item.node_id,
+ final_size.map(Some),
+ area_size.map(Some),
+ Size {
+ width: AvailableSpace::Definite(area_width.maybe_clamp(min_size.width, max_size.width)),
+ height: AvailableSpace::Definite(area_height.maybe_clamp(min_size.height, max_size.height)),
+ },
+ SizingMode::ContentSize,
+ Line::FALSE,
+ );
+
let non_auto_margin = Rect {
left: if left.is_some() { margin.left.unwrap_or(0.0) } else { 0.0 },
right: if right.is_some() { margin.right.unwrap_or(0.0) } else { 0.0 },
diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs
index 384e9f530..2cf25ae4b 100644
--- a/src/compute/flexbox.rs
+++ b/src/compute/flexbox.rs
@@ -2145,7 +2145,7 @@ fn perform_absolute_layout_on_absolute_children(
known_dimensions.height = Some(f32_max(new_height_raw, 0.0));
known_dimensions = known_dimensions.maybe_apply_aspect_ratio(aspect_ratio).maybe_clamp(min_size, max_size);
}
- let layout_output = tree.perform_child_layout(
+ let measured_size = tree.measure_child_size_both(
child,
known_dimensions,
constants.node_inner_size,
@@ -2156,9 +2156,20 @@ fn perform_absolute_layout_on_absolute_children(
SizingMode::InherentSize,
Line::FALSE,
);
- let measured_size = layout_output.size;
let final_size = known_dimensions.unwrap_or(measured_size).maybe_clamp(min_size, max_size);
+ let layout_output = tree.perform_child_layout(
+ child,
+ final_size.map(Some),
+ constants.node_inner_size,
+ Size {
+ width: AvailableSpace::Definite(container_width.maybe_clamp(min_size.width, max_size.width)),
+ height: AvailableSpace::Definite(container_height.maybe_clamp(min_size.height, max_size.height)),
+ },
+ SizingMode::InherentSize,
+ Line::FALSE,
+ );
+
let non_auto_margin = margin.map(|m| m.unwrap_or(0.0));
let free_space = Size {
diff --git a/src/compute/grid/alignment.rs b/src/compute/grid/alignment.rs
index 68303f9bc..9ec256adb 100644
--- a/src/compute/grid/alignment.rs
+++ b/src/compute/grid/alignment.rs
@@ -199,9 +199,24 @@ pub(super) fn align_and_position_item(
// Layout node
drop(style);
+
+ let size = if position == Position::Absolute && (width.is_none() || height.is_none()) {
+ tree.measure_child_size_both(
+ node,
+ Size { width, height },
+ grid_area_size.map(Option::Some),
+ grid_area_minus_item_margins_size.map(AvailableSpace::Definite),
+ SizingMode::InherentSize,
+ Line::FALSE,
+ )
+ .map(Some)
+ } else {
+ Size { width, height }
+ };
+
let layout_output = tree.perform_child_layout(
node,
- Size { width, height },
+ size,
grid_area_size.map(Option::Some),
grid_area_minus_item_margins_size.map(AvailableSpace::Definite),
SizingMode::InherentSize,
@@ -209,7 +224,7 @@ pub(super) fn align_and_position_item(
);
// Resolve final size
- let Size { width, height } = Size { width, height }.unwrap_or(layout_output.size).maybe_clamp(min_size, max_size);
+ let Size { width, height } = size.unwrap_or(layout_output.size).maybe_clamp(min_size, max_size);
let (x, x_margin) = align_item_within_area(
Line { start: grid_area.left, end: grid_area.right },
diff --git a/src/tree/traits.rs b/src/tree/traits.rs
index d90d1e9e0..f4548cb4b 100644
--- a/src/tree/traits.rs
+++ b/src/tree/traits.rs
@@ -349,6 +349,33 @@ pub(crate) trait LayoutPartialTreeExt: LayoutPartialTree {
.get_abs(axis)
}
+ /// Compute the size of the node given the specified constraints
+ #[inline(always)]
+ #[allow(clippy::too_many_arguments)]
+ fn measure_child_size_both(
+ &mut self,
+ node_id: NodeId,
+ known_dimensions: Size<Option<f32>>,
+ parent_size: Size<Option<f32>>,
+ available_space: Size<AvailableSpace>,
+ sizing_mode: SizingMode,
+ vertical_margins_are_collapsible: Line<bool>,
+ ) -> Size<f32> {
+ self.compute_child_layout(
+ node_id,
+ LayoutInput {
+ known_dimensions,
+ parent_size,
+ available_space,
+ sizing_mode,
+ axis: RequestedAxis::Both,
+ run_mode: RunMode::ComputeSize,
+ vertical_margins_are_collapsible,
+ },
+ )
+ .size
+ }
+
/// Perform a full layout on the node given the specified constraints
#[inline(always)]
fn perform_child_layout(
diff --git a/test_fixtures/block/absolute_correct_cross_child_size_with_percentage.html b/test_fixtures/block/absolute_correct_cross_child_size_with_percentage.html
new file mode 100644
index 000000000..f992efc47
--- /dev/null
+++ b/test_fixtures/block/absolute_correct_cross_child_size_with_percentage.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="width: 300px; height: 110px; position: relative; display: block;">
+ <div style="position: absolute; top: 40px; left: 50px; display: flex; flex-direction: column;">
+ <div style="width: 200px; height: 10px;"></div>
+ <div style="width: 100%; height: 10px;"></div>
+ <div style="width: 100%; height: 10px; display: flex;">
+ <div style="width: 10px; height: 10px;"></div>
+ </div>
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/flex/absolute_correct_cross_child_size_with_percentage.html b/test_fixtures/flex/absolute_correct_cross_child_size_with_percentage.html
new file mode 100644
index 000000000..5e7cf3e1f
--- /dev/null
+++ b/test_fixtures/flex/absolute_correct_cross_child_size_with_percentage.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="width: 300px; height: 110px; position: relative;">
+ <div style="position: absolute; top: 40px; left: 50px; display: flex; flex-direction: column;">
+ <div style="width: 200px; height: 10px;"></div>
+ <div style="width: 100%; height: 10px;"></div>
+ <div style="width: 100%; height: 10px; display: flex;">
+ <div style="width: 10px; height: 10px;"></div>
+ </div>
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/grid/absolute_correct_cross_child_size_with_percentage.html b/test_fixtures/grid/absolute_correct_cross_child_size_with_percentage.html
new file mode 100644
index 000000000..b4a9a1014
--- /dev/null
+++ b/test_fixtures/grid/absolute_correct_cross_child_size_with_percentage.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="width: 300px; height: 110px; position: relative; display: grid;">
+ <div style="position: absolute; top: 40px; left: 50px; display: flex; flex-direction: column;">
+ <div style="width: 200px; height: 10px;"></div>
+ <div style="width: 100%; height: 10px;"></div>
+ <div style="width: 100%; height: 10px; display: flex;">
+ <div style="width: 10px; height: 10px;"></div>
+ </div>
+ </div>
+</div>
+
+</body>
+</html>
diff --git a/tests/generated/block/absolute_correct_cross_child_size_with_percentage.rs b/tests/generated/block/absolute_correct_cross_child_size_with_percentage.rs
new file mode 100644
index 000000000..320065f8e
--- /dev/null
+++ b/tests/generated/block/absolute_correct_cross_child_size_with_percentage.rs
@@ -0,0 +1,231 @@
+#[test]
+#[allow(non_snake_case)]
+fn absolute_correct_cross_child_size_with_percentage__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node020 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(10f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ },
+ &[node020],
+ )
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ position: taffy::style::Position::Absolute,
+ flex_direction: taffy::style::FlexDirection::Column,
+ inset: taffy::geometry::Rect { left: length(50f32), right: auto(), top: length(40f32), bottom: auto() },
+ ..Default::default()
+ },
+ &[node00, node01, node02],
+ )
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Block,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(300f32),
+ height: taffy::style::Dimension::from_length(110f32),
+ },
+ ..Default::default()
+ },
+ &[node0],
+ )
+ .unwrap();
+ taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
+ println!("\nComputed tree:");
+ taffy.print_tree(node);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width);
+ assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ let layout = taffy.layout(node0).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y);
+ let layout = taffy.layout(node00).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y);
+ let layout = taffy.layout(node01).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node01, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x);
+ assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y);
+ let layout = taffy.layout(node02).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node02, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y);
+ let layout = taffy.layout(node020).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node020, 10f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node020, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node020, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node020, 0f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn absolute_correct_cross_child_size_with_percentage__content_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node020 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(10f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ },
+ &[node020],
+ )
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ position: taffy::style::Position::Absolute,
+ flex_direction: taffy::style::FlexDirection::Column,
+ inset: taffy::geometry::Rect { left: length(50f32), right: auto(), top: length(40f32), bottom: auto() },
+ ..Default::default()
+ },
+ &[node00, node01, node02],
+ )
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Block,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(300f32),
+ height: taffy::style::Dimension::from_length(110f32),
+ },
+ ..Default::default()
+ },
+ &[node0],
+ )
+ .unwrap();
+ taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
+ println!("\nComputed tree:");
+ taffy.print_tree(node);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width);
+ assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ let layout = taffy.layout(node0).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y);
+ let layout = taffy.layout(node00).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y);
+ let layout = taffy.layout(node01).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node01, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x);
+ assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y);
+ let layout = taffy.layout(node02).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node02, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y);
+ let layout = taffy.layout(node020).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node020, 10f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node020, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node020, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node020, 0f32, location.y);
+}
diff --git a/tests/generated/block/mod.rs b/tests/generated/block/mod.rs
index 621d0358a..3c788be2b 100644
--- a/tests/generated/block/mod.rs
+++ b/tests/generated/block/mod.rs
@@ -1,3 +1,4 @@
+mod absolute_correct_cross_child_size_with_percentage;
mod block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset;
mod block_absolute_aspect_ratio_fill_height;
mod block_absolute_aspect_ratio_fill_height_from_inset;
diff --git a/tests/generated/flex/absolute_correct_cross_child_size_with_percentage.rs b/tests/generated/flex/absolute_correct_cross_child_size_with_percentage.rs
new file mode 100644
index 000000000..56047ed52
--- /dev/null
+++ b/tests/generated/flex/absolute_correct_cross_child_size_with_percentage.rs
@@ -0,0 +1,229 @@
+#[test]
+#[allow(non_snake_case)]
+fn absolute_correct_cross_child_size_with_percentage__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node020 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(10f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ },
+ &[node020],
+ )
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ position: taffy::style::Position::Absolute,
+ flex_direction: taffy::style::FlexDirection::Column,
+ inset: taffy::geometry::Rect { left: length(50f32), right: auto(), top: length(40f32), bottom: auto() },
+ ..Default::default()
+ },
+ &[node00, node01, node02],
+ )
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(300f32),
+ height: taffy::style::Dimension::from_length(110f32),
+ },
+ ..Default::default()
+ },
+ &[node0],
+ )
+ .unwrap();
+ taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
+ println!("\nComputed tree:");
+ taffy.print_tree(node);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width);
+ assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ let layout = taffy.layout(node0).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y);
+ let layout = taffy.layout(node00).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y);
+ let layout = taffy.layout(node01).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node01, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x);
+ assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y);
+ let layout = taffy.layout(node02).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node02, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y);
+ let layout = taffy.layout(node020).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node020, 10f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node020, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node020, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node020, 0f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn absolute_correct_cross_child_size_with_percentage__content_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node020 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(10f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ },
+ &[node020],
+ )
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ position: taffy::style::Position::Absolute,
+ flex_direction: taffy::style::FlexDirection::Column,
+ inset: taffy::geometry::Rect { left: length(50f32), right: auto(), top: length(40f32), bottom: auto() },
+ ..Default::default()
+ },
+ &[node00, node01, node02],
+ )
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(300f32),
+ height: taffy::style::Dimension::from_length(110f32),
+ },
+ ..Default::default()
+ },
+ &[node0],
+ )
+ .unwrap();
+ taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
+ println!("\nComputed tree:");
+ taffy.print_tree(node);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width);
+ assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ let layout = taffy.layout(node0).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y);
+ let layout = taffy.layout(node00).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y);
+ let layout = taffy.layout(node01).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node01, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x);
+ assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y);
+ let layout = taffy.layout(node02).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node02, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y);
+ let layout = taffy.layout(node020).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node020, 10f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node020, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node020, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node020, 0f32, location.y);
+}
diff --git a/tests/generated/flex/mod.rs b/tests/generated/flex/mod.rs
index 2da7e914e..aabd9865a 100644
--- a/tests/generated/flex/mod.rs
+++ b/tests/generated/flex/mod.rs
@@ -13,6 +13,7 @@ mod absolute_child_with_cross_margin;
mod absolute_child_with_main_margin;
mod absolute_child_with_max_height;
mod absolute_child_with_max_height_larger_shrinkable_grandchild;
+mod absolute_correct_cross_child_size_with_percentage;
mod absolute_layout_align_items_and_justify_content_center;
mod absolute_layout_align_items_and_justify_content_center_and_bottom_position;
mod absolute_layout_align_items_and_justify_content_center_and_left_position;
diff --git a/tests/generated/grid/absolute_correct_cross_child_size_with_percentage.rs b/tests/generated/grid/absolute_correct_cross_child_size_with_percentage.rs
new file mode 100644
index 000000000..3aa8fb5a7
--- /dev/null
+++ b/tests/generated/grid/absolute_correct_cross_child_size_with_percentage.rs
@@ -0,0 +1,231 @@
+#[test]
+#[allow(non_snake_case)]
+fn absolute_correct_cross_child_size_with_percentage__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node020 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(10f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ },
+ &[node020],
+ )
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ position: taffy::style::Position::Absolute,
+ flex_direction: taffy::style::FlexDirection::Column,
+ inset: taffy::geometry::Rect { left: length(50f32), right: auto(), top: length(40f32), bottom: auto() },
+ ..Default::default()
+ },
+ &[node00, node01, node02],
+ )
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(300f32),
+ height: taffy::style::Dimension::from_length(110f32),
+ },
+ ..Default::default()
+ },
+ &[node0],
+ )
+ .unwrap();
+ taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
+ println!("\nComputed tree:");
+ taffy.print_tree(node);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width);
+ assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ let layout = taffy.layout(node0).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y);
+ let layout = taffy.layout(node00).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y);
+ let layout = taffy.layout(node01).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node01, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x);
+ assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y);
+ let layout = taffy.layout(node02).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node02, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y);
+ let layout = taffy.layout(node020).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node020, 10f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node020, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node020, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node020, 0f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn absolute_correct_cross_child_size_with_percentage__content_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node020 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(10f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_percent(1f32),
+ height: taffy::style::Dimension::from_length(10f32),
+ },
+ ..Default::default()
+ },
+ &[node020],
+ )
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ position: taffy::style::Position::Absolute,
+ flex_direction: taffy::style::FlexDirection::Column,
+ inset: taffy::geometry::Rect { left: length(50f32), right: auto(), top: length(40f32), bottom: auto() },
+ ..Default::default()
+ },
+ &[node00, node01, node02],
+ )
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(300f32),
+ height: taffy::style::Dimension::from_length(110f32),
+ },
+ ..Default::default()
+ },
+ &[node0],
+ )
+ .unwrap();
+ taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
+ println!("\nComputed tree:");
+ taffy.print_tree(node);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width);
+ assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ let layout = taffy.layout(node0).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y);
+ let layout = taffy.layout(node00).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y);
+ let layout = taffy.layout(node01).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node01, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x);
+ assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y);
+ let layout = taffy.layout(node02).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node02, 200f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y);
+ let layout = taffy.layout(node020).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node020, 10f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node020, 10f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node020, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node020, 0f32, location.y);
+}
diff --git a/tests/generated/grid/mod.rs b/tests/generated/grid/mod.rs
index f2f16558b..9583228e4 100644
--- a/tests/generated/grid/mod.rs
+++ b/tests/generated/grid/mod.rs
@@ -1,3 +1,4 @@
+mod absolute_correct_cross_child_size_with_percentage;
mod chrome_issue_325928327;
#[cfg(feature = "grid")]
mod grid_absolute_align_self_sized_all;