Absolute Insets should be resolved against the container size minus border (#666)
* Insets are resolved against the container size minus border
* Absolute children with relative size should resolve it against parent size minus border in flex layout
* Account for scrollbar_width in grid absolute children nodes
* Resolve block layout absolute children with auto insets against static position
* Add tests for resolved absolute insets
* format fixtures
477ff4aff498cbae4cdfbf0cda1ee5b04c784f08 · por Julia Ortiz · 2024-07-11T22:30:50Z (hace 2 años) · padre 8512b90cf · ver el árbol en este commit
Delta semántico · 12
tests/generated/block/block_absolute_resolved_insets.rs
tests/generated/block/mod.rs
tests/generated/flex/absolute_resolved_insets.rs
tests/generated/flex/mod.rs
tests/generated/grid/grid_absolute_resolved_insets.rs
tests/generated/grid/mod.rs
diff --git a/src/compute/block.rs b/src/compute/block.rs
index 0183b90e8..8112e889c 100644
--- a/src/compute/block.rs
+++ b/src/compute/block.rs
@@ -340,13 +340,13 @@ fn perform_final_layout_on_in_flow_children(
#[cfg_attr(not(feature = "content_size"), allow(unused_mut))]
let mut inflow_content_size = Size::ZERO;
- let mut committed_y_offset = resolved_content_box_inset.top;
+ let mut committed_offset = Point { x: resolved_content_box_inset.left, y: resolved_content_box_inset.top };
let mut first_child_top_margin_set = CollapsibleMarginSet::ZERO;
let mut active_collapsible_margin_set = CollapsibleMarginSet::ZERO;
let mut is_collapsing_with_first_margin_set = true;
for item in items.iter_mut() {
if item.position == Position::Absolute {
- item.static_position.y = committed_y_offset;
+ item.static_position = committed_offset
} else {
let item_margin = item.margin.map(|margin| margin.resolve_to_option(container_outer_width));
let item_non_auto_margin = item_margin.map(|m| m.unwrap_or(0.0));
@@ -414,11 +414,11 @@ fn perform_final_layout_on_in_flow_children(
item.can_be_collapsed_through = item_layout.margins_can_collapse_through;
item.static_position = Point {
x: resolved_content_box_inset.left,
- y: committed_y_offset + active_collapsible_margin_set.resolve(),
+ y: committed_offset.y + active_collapsible_margin_set.resolve(),
};
let location = Point {
x: resolved_content_box_inset.left + inset_offset.x + resolved_margin.left,
- y: committed_y_offset + inset_offset.y + y_margin_offset,
+ y: committed_offset.y + inset_offset.y + y_margin_offset,
};
let scrollbar_size = Size {
@@ -469,7 +469,7 @@ fn perform_final_layout_on_in_flow_children(
.collapse_with_set(top_margin_set)
.collapse_with_set(bottom_margin_set);
} else {
- committed_y_offset += item_layout.size.height + y_margin_offset;
+ committed_offset.y += item_layout.size.height + y_margin_offset;
active_collapsible_margin_set = bottom_margin_set;
}
}
@@ -479,8 +479,8 @@ fn perform_final_layout_on_in_flow_children(
let bottom_y_margin_offset =
if own_margins_collapse_with_children.end { 0.0 } else { last_child_bottom_margin_set.resolve() };
- committed_y_offset += resolved_content_box_inset.bottom + bottom_y_margin_offset;
- let content_height = f32_max(0.0, committed_y_offset);
+ committed_offset.y += resolved_content_box_inset.bottom + bottom_y_margin_offset;
+ let content_height = f32_max(0.0, committed_offset.y);
(inflow_content_size, content_height, first_child_top_margin_set, last_child_bottom_margin_set)
}
@@ -633,17 +633,18 @@ fn perform_absolute_layout_on_absolute_children(
bottom: margin.bottom.unwrap_or(auto_margin.bottom),
};
- let item_offset = Point {
+ let location = Point {
x: left
.map(|left| left + resolved_margin.left)
.or(right.map(|right| area_size.width - final_size.width - right - resolved_margin.right))
- .unwrap_or(resolved_margin.left),
+ .maybe_add(area_offset.x)
+ .unwrap_or(item.static_position.x + resolved_margin.left),
y: top
.map(|top| top + resolved_margin.top)
.or(bottom.map(|bottom| area_size.height - final_size.height - bottom - resolved_margin.bottom))
+ .maybe_add(area_offset.y)
.unwrap_or(item.static_position.y + resolved_margin.top),
};
-
// Note: axis intentionally switched here as scrollbars take up space in the opposite axis
// to the axis in which scrolling is enabled.
let scrollbar_size = Size {
@@ -651,7 +652,6 @@ fn perform_absolute_layout_on_absolute_children(
height: if item.overflow.x == Overflow::Scroll { item.scrollbar_width } else { 0.0 },
};
- let location = area_offset + item_offset;
tree.set_unrounded_layout(
item.node_id,
&Layout {
diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs
index 14f280c41..1c0252c63 100644
--- a/src/compute/flexbox.rs
+++ b/src/compute/flexbox.rs
@@ -1935,6 +1935,8 @@ fn perform_absolute_layout_on_absolute_children(
) -> Size<f32> {
let container_width = constants.container_size.width;
let container_height = constants.container_size.height;
+ let inset_relative_size =
+ constants.container_size - constants.border.sum_axes() - constants.scrollbar_gutter.into();
#[cfg_attr(not(feature = "content_size"), allow(unused_mut))]
let mut content_size = Size::ZERO;
@@ -1958,22 +1960,23 @@ fn perform_absolute_layout_on_absolute_children(
let padding_border_sum = (padding + border).sum_axes();
// Resolve inset
- let left = child_style.inset.left.maybe_resolve(container_width);
- let right = child_style.inset.right.maybe_resolve(container_width);
- let top = child_style.inset.top.maybe_resolve(container_height);
- let bottom = child_style.inset.bottom.maybe_resolve(container_height);
+ // Insets are resolved against the container size minus border
+ let left = child_style.inset.left.maybe_resolve(inset_relative_size.width);
+ let right =
+ child_style.inset.right.maybe_resolve(inset_relative_size.width).maybe_add(constants.scrollbar_gutter.x);
+ let top = child_style.inset.top.maybe_resolve(inset_relative_size.height);
+ let bottom =
+ child_style.inset.bottom.maybe_resolve(inset_relative_size.height).maybe_add(constants.scrollbar_gutter.y);
// Compute known dimensions from min/max/inherent size styles
- let style_size =
- child_style.size.maybe_resolve(constants.container_size).maybe_apply_aspect_ratio(aspect_ratio);
+ let style_size = child_style.size.maybe_resolve(inset_relative_size).maybe_apply_aspect_ratio(aspect_ratio);
let min_size = child_style
.min_size
- .maybe_resolve(constants.container_size)
+ .maybe_resolve(inset_relative_size)
.maybe_apply_aspect_ratio(aspect_ratio)
.or(padding_border_sum.map(Some))
.maybe_max(padding_border_sum);
- let max_size =
- child_style.max_size.maybe_resolve(constants.container_size).maybe_apply_aspect_ratio(aspect_ratio);
+ let max_size = child_style.max_size.maybe_resolve(inset_relative_size).maybe_apply_aspect_ratio(aspect_ratio);
let mut known_dimensions = style_size.maybe_clamp(min_size, max_size);
// Fill in width from left/right and reapply aspect ratio if:
@@ -2199,9 +2202,10 @@ mod tests {
use crate::{
geometry::Size,
+ prelude::{auto, length, percent, TaffyMaxContent},
style::{FlexWrap, Style},
util::{MaybeMath, ResolveOrZero},
- TaffyTree,
+ Overflow, Point, Position, PrintTree, Rect, TaffyTree,
};
// Make sure we get correct constants
@@ -2240,4 +2244,121 @@ mod tests {
assert_eq!(constants.container_size, Size::zero());
assert_eq!(constants.inner_container_size, Size::zero());
}
+
+ #[test]
+ pub fn test_padding_and_border_larger_than_definite_size() {
+ let mut tree: TaffyTree<()> = TaffyTree::with_capacity(16);
+
+ let child = tree.new_leaf(Style::default()).unwrap();
+
+ let root = tree
+ .new_with_children(
+ Style {
+ size: Size { width: length(10.0), height: length(10.0) },
+ padding: Rect { left: length(10.0), right: length(10.0), top: length(10.0), bottom: length(10.0) },
+
+ border: Rect { left: length(10.0), right: length(10.0), top: length(10.0), bottom: length(10.0) },
+ ..Default::default()
+ },
+ &[child],
+ )
+ .unwrap();
+
+ tree.compute_layout(root, Size::MAX_CONTENT).unwrap();
+
+ let layout = tree.layout(root).unwrap();
+
+ assert_eq!(layout.size.width, 40.0);
+ assert_eq!(layout.size.height, 40.0);
+ }
+
+ #[test]
+ fn test_resolve_insets_against_container_size_minus_border() {
+ let mut tree: TaffyTree<()> = TaffyTree::with_capacity(16);
+
+ let child_style = Style {
+ size: Size { width: length(30.0), height: length(30.0) },
+ inset: Rect { left: percent(1.0), right: auto(), top: percent(0.5), bottom: auto() },
+ position: Position::Absolute,
+ ..Default::default()
+ };
+ let child = tree.new_leaf(child_style.clone()).unwrap();
+
+ let root_style = Style {
+ size: Size { width: length(100.0), height: length(100.0) },
+ padding: Rect { left: length(10.0), right: length(10.0), top: length(10.0), bottom: length(10.0) },
+ border: Rect { left: length(15.0), right: length(15.0), top: length(15.0), bottom: length(15.0) },
+ ..Default::default()
+ };
+ let root = tree.new_with_children(root_style.clone(), &[child]).unwrap();
+
+ tree.compute_layout(root, Size::MAX_CONTENT).unwrap();
+
+ assert_eq!(
+ tree.get_final_layout(child).location,
+ // parent padding has no effect
+ Point {
+ // left-inset * (parent_width - l_border - r_border) + l_border
+ // -> 1 * (100 - 15 - 15) + 15 = 85
+ x: 85.0,
+ // top-inset * (parent_height - t_border - b_border) + t_border
+ // -> 0.5 * (100 - 15 - 15) + 15 = 50
+ y: 50.0,
+ }
+ );
+
+ tree.set_style(
+ root,
+ Style {
+ scrollbar_width: 5.0,
+ // Let's grow the container by the scrollbar width so math is cleaner.
+ // That means results should stay the same because the inner area of the container is the same when scrollbar is visible.
+ size: Size { width: length(100.0 + 5.0), height: length(100.0 + 5.0) },
+ overflow: Point { x: Overflow::Scroll, y: Overflow::Scroll },
+ ..root_style
+ },
+ )
+ .unwrap();
+
+ tree.compute_layout(root, Size::MAX_CONTENT).unwrap();
+
+ assert_eq!(
+ tree.get_final_layout(child).location,
+ // assumes scrollbar is always on the right or bottom
+ Point {
+ // left-inset * (parent_width - l_border - r_border - r_scrollbar) + l_border
+ // -> 1 * (105 - 15 - 15 - 5) + 15 = 85
+ x: 85.0,
+ // top-inset * (parent_height - t_border - b_border - b_scrollbar) + t_border
+ // -> 0.5 * (105 - 15 - 15 - 5) + 15 = 50
+ y: 50.0,
+ }
+ );
+
+ // Now let's set the inset relative to the right and bottom, to be sure the scrollbar is taken into account.
+ tree.set_style(
+ child,
+ Style {
+ inset: Rect { left: auto(), right: percent(1.0), top: auto(), bottom: percent(0.5) },
+ ..child_style
+ },
+ )
+ .unwrap();
+
+ tree.compute_layout(root, Size::MAX_CONTENT).unwrap();
+
+ assert_eq!(
+ tree.get_final_layout(child).location,
+ Point {
+ // relative_area_width = parent_width - l_border - r_border - r_scrollbar = 105 - 15 - 15 - 5 = 70
+ // resolved_right = right-inset * relative_area_width = 1 * 70 = 70
+ // parent_width - (resolved_right + r_border + r_scrollbar + child_width) = 105 - (70 + 15 + 5 + 30) = -15
+ x: -15.0,
+ // relative_area_height = parent_height - t_border - b_border - b_scrollbar = 105 - 15 - 15 - 5 = 70
+ // resolved_bottom = bottom-inset * relative_area_height = 0.5 * 70 = 35
+ // parent_height - (resolved_bottom + b_border + b_scrollbar + child_height) = 105 - (35 + 15 + 5 + 30) = 20
+ y: 20.0,
+ }
+ );
+ }
}
diff --git a/src/compute/grid/mod.rs b/src/compute/grid/mod.rs
index cc755769e..656613d34 100644
--- a/src/compute/grid/mod.rs
+++ b/src/compute/grid/mod.rs
@@ -482,12 +482,12 @@ pub fn compute_grid_layout(tree: &mut impl LayoutPartialTree, node: NodeId, inpu
bottom: maybe_row_indexes
.end
.map(|index| rows[index].offset)
- .unwrap_or(container_border_box.height - border.bottom),
+ .unwrap_or(container_border_box.height - border.bottom - scrollbar_gutter.y),
left: maybe_col_indexes.start.map(|index| columns[index].offset).unwrap_or(border.left),
right: maybe_col_indexes
.end
.map(|index| columns[index].offset)
- .unwrap_or(container_border_box.width - border.right),
+ .unwrap_or(container_border_box.width - border.right - scrollbar_gutter.x),
};
// TODO: Baseline alignment support for absolutely positioned items (should check if is actuallty specified)
#[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
diff --git a/test_fixtures/block/block_absolute_resolved_insets.html b/test_fixtures/block/block_absolute_resolved_insets.html
new file mode 100644
index 000000000..41d9f517b
--- /dev/null
+++ b/test_fixtures/block/block_absolute_resolved_insets.html
@@ -0,0 +1,52 @@
+<!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">
+ <div
+ style="display: block; width: 200px; height: 200px; border: 20px solid; padding: 15px; position: relative;"
+ >
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ <div style="position: absolute; top: 0; left: 0;"></div>
+ <div style="position: absolute; top: 100%; left: 100%;"></div>
+ <div
+ style="position: absolute; bottom: 100%; right: 100%;"
+ ></div>
+ <div style="position: absolute; top: 30px; left: 30px;"></div>
+ <div
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
+ ></div>
+ </div>
+
+ <div
+ style="display: block; width: 200px; height: 200px; border: 20px solid; padding: 15px; overflow: scroll; position: relative;"
+ >
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ <div style="position: absolute; top: 0; left: 0;"></div>
+ <div style="position: absolute; top: 100%; left: 100%;"></div>
+ <div
+ style="position: absolute; bottom: 100%; right: 100%;"
+ ></div>
+ <div style="position: absolute; top: 30px; left: 30px;"></div>
+ <div
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
+ ></div>
+ </div>
+ <!-- Checks if "top: auto" resolves to the static y position -->
+ <div
+ style="display: block; width: 200px; height: 200px; border: 20px solid; padding: 15px; position: relative;"
+ >
+ <div style="display: block; height: 10px; width: 50px;"></div>
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/test_fixtures/flex/absolute_resolved_insets.html b/test_fixtures/flex/absolute_resolved_insets.html
new file mode 100644
index 000000000..860a3828d
--- /dev/null
+++ b/test_fixtures/flex/absolute_resolved_insets.html
@@ -0,0 +1,45 @@
+<!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">
+ <div
+ style="display: flex; width: 200px; height: 200px; border: 20px solid; padding: 15px; position: relative;"
+ >
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ <div style="position: absolute; top: 0; left: 0;"></div>
+ <div style="position: absolute; top: 100%; left: 100%;"></div>
+ <div
+ style="position: absolute; bottom: 100%; right: 100%;"
+ ></div>
+ <div style="position: absolute; top: 30px; left: 30px;"></div>
+ <div
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
+ ></div>
+ </div>
+
+ <div
+ style="display: flex; width: 200px; height: 200px; border: 20px solid; padding: 15px; overflow: scroll; position: relative;"
+ >
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ <div style="position: absolute; top: 0; left: 0;"></div>
+ <div style="position: absolute; top: 100%; left: 100%;"></div>
+ <div
+ style="position: absolute; bottom: 100%; right: 100%;"
+ ></div>
+ <div style="position: absolute; top: 30px; left: 30px;"></div>
+ <div
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
+ ></div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/test_fixtures/grid/grid_absolute_resolved_insets.html b/test_fixtures/grid/grid_absolute_resolved_insets.html
new file mode 100644
index 000000000..0ab488851
--- /dev/null
+++ b/test_fixtures/grid/grid_absolute_resolved_insets.html
@@ -0,0 +1,45 @@
+<!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">
+ <div
+ style="display: grid; width: 200px; height: 200px; border: 20px solid; padding: 15px; position: relative;"
+ >
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ <div style="position: absolute; top: 0; left: 0;"></div>
+ <div style="position: absolute; top: 100%; left: 100%;"></div>
+ <div
+ style="position: absolute; bottom: 100%; right: 100%;"
+ ></div>
+ <div style="position: absolute; top: 30px; left: 30px;"></div>
+ <div
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
+ ></div>
+ </div>
+
+ <div
+ style="display: grid; width: 200px; height: 200px; border: 20px solid; padding: 15px; overflow: scroll; position: relative;"
+ >
+ <div style="position: absolute; top: auto; left: auto;"></div>
+ <div style="position: absolute; top: 0; left: 0;"></div>
+ <div style="position: absolute; top: 100%; left: 100%;"></div>
+ <div
+ style="position: absolute; bottom: 100%; right: 100%;"
+ ></div>
+ <div style="position: absolute; top: 30px; left: 30px;"></div>
+ <div
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
+ ></div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/tests/generated/block/block_absolute_resolved_insets.rs b/tests/generated/block/block_absolute_resolved_insets.rs
new file mode 100644
index 000000000..bf497e698
--- /dev/null
+++ b/tests/generated/block/block_absolute_resolved_insets.rs
@@ -0,0 +1,697 @@
+#[test]
+fn block_absolute_resolved_insets() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, tree::Layout, TaffyTree};
+ let mut taffy: TaffyTree<crate::TextMeasure> = TaffyTree::new();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Percent(1f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Percent(1f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node03 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: auto(),
+ right: taffy::style::LengthPercentageAuto::Percent(1f32),
+ top: auto(),
+ bottom: taffy::style::LengthPercentageAuto::Percent(1f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node04 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(30f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(30f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node05 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Percent(1f32),
+ height: taffy::style::Dimension::Percent(1f32),
+ },
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Block,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node00, node01, node02, node03, node04, node05],
+ )
+ .unwrap();
+ let node10 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node11 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node12 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Percent(1f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Percent(1f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node13 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: auto(),
+ right: taffy::style::LengthPercentageAuto::Percent(1f32),
+ top: auto(),
+ bottom: taffy::style::LengthPercentageAuto::Percent(1f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node14 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(30f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(30f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node15 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Percent(1f32),
+ height: taffy::style::Dimension::Percent(1f32),
+ },
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Block,
+ overflow: taffy::geometry::Point {
+ x: taffy::style::Overflow::Scroll,
+ y: taffy::style::Overflow::Scroll,
+ },
+ scrollbar_width: 15f32,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node10, node11, node12, node13, node14, node15],
+ )
+ .unwrap();
+ let node20 = taffy
+ .new_leaf(taffy::style::Style {
+ display: taffy::style::Display::Block,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(50f32),
+ height: taffy::style::Dimension::Length(10f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node21 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node2 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Block,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node20, node21],
+ )
+ .unwrap();
+ let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1, node2]).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!();
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node).unwrap();
+ assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node, 600f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, 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);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node0).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node0,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node0,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node00).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height);
+ assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x);
+ assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node00,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node00,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node01).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node01,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node01,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node02).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height);
+ assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x);
+ assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node02,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node02,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node03).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node03,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node03,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node04).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x);
+ assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node04,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node04,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node05).unwrap();
+ assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width);
+ assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node05,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node05,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node1).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height);
+ assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node1,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node1,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node10).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height);
+ assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x);
+ assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node10,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node10,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node11).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node11,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node11,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node12).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height);
+ assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x);
+ assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node12,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node12,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node13).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node13,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node13,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node14).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x);
+ assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node14,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node14,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node15).unwrap();
+ assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width);
+ assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node15,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node15,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node2).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node2, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node2, 200f32, size.height);
+ assert_eq!(location.x, 400f32, "x of node {:?}. Expected {}. Actual {}", node2, 400f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node2,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node2,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node20).unwrap();
+ assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width);
+ assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height);
+ assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node20, 35f32, location.x);
+ assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node20, 35f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node20,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node20,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node21).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node21, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node21, 0f32, size.height);
+ assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node21, 35f32, location.x);
+ assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node21, 45f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node21,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node21,
+ 0f32,
+ layout.scroll_height()
+ );
+}
diff --git a/tests/generated/block/mod.rs b/tests/generated/block/mod.rs
index 39011a84e..dacd4f83d 100644
--- a/tests/generated/block/mod.rs
+++ b/tests/generated/block/mod.rs
@@ -52,6 +52,7 @@ mod block_absolute_minmax_top_left_bottom_right_min_max;
mod block_absolute_no_styles;
mod block_absolute_padding_border_overrides_max_size;
mod block_absolute_padding_border_overrides_size;
+mod block_absolute_resolved_insets;
mod block_align_baseline_child;
mod block_align_baseline_child_margin;
mod block_align_baseline_child_margin_percent;
diff --git a/tests/generated/flex/absolute_resolved_insets.rs b/tests/generated/flex/absolute_resolved_insets.rs
new file mode 100644
index 000000000..7229b14d3
--- /dev/null
+++ b/tests/generated/flex/absolute_resolved_insets.rs
@@ -0,0 +1,578 @@
+#[test]
+fn absolute_resolved_insets() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, tree::Layout, TaffyTree};
+ let mut taffy: TaffyTree<crate::TextMeasure> = TaffyTree::new();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Percent(1f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Percent(1f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node03 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: auto(),
+ right: taffy::style::LengthPercentageAuto::Percent(1f32),
+ top: auto(),
+ bottom: taffy::style::LengthPercentageAuto::Percent(1f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node04 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(30f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(30f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node05 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Percent(1f32),
+ height: taffy::style::Dimension::Percent(1f32),
+ },
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node00, node01, node02, node03, node04, node05],
+ )
+ .unwrap();
+ let node10 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node11 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node12 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Percent(1f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Percent(1f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node13 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: auto(),
+ right: taffy::style::LengthPercentageAuto::Percent(1f32),
+ top: auto(),
+ bottom: taffy::style::LengthPercentageAuto::Percent(1f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node14 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(30f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(30f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node15 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Percent(1f32),
+ height: taffy::style::Dimension::Percent(1f32),
+ },
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Flex,
+ overflow: taffy::geometry::Point {
+ x: taffy::style::Overflow::Scroll,
+ y: taffy::style::Overflow::Scroll,
+ },
+ scrollbar_width: 15f32,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node10, node11, node12, node13, node14, node15],
+ )
+ .unwrap();
+ let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).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!();
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node).unwrap();
+ assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, 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);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node0).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node0,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node0,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node00).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height);
+ assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x);
+ assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node00,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node00,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node01).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node01,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node01,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node02).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height);
+ assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x);
+ assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node02,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node02,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node03).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node03,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node03,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node04).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x);
+ assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node04,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node04,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node05).unwrap();
+ assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width);
+ assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node05,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node05,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node1).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height);
+ assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node1,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node1,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node10).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height);
+ assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x);
+ assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node10,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node10,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node11).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node11,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node11,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node12).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height);
+ assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x);
+ assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node12,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node12,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node13).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node13,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node13,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node14).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x);
+ assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node14,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node14,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node15).unwrap();
+ assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width);
+ assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node15,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node15,
+ 0f32,
+ layout.scroll_height()
+ );
+}
diff --git a/tests/generated/flex/mod.rs b/tests/generated/flex/mod.rs
index 522bea496..bc2806cdd 100644
--- a/tests/generated/flex/mod.rs
+++ b/tests/generated/flex/mod.rs
@@ -44,6 +44,7 @@ mod absolute_minmax_top_left_bottom_right_max;
mod absolute_minmax_top_left_bottom_right_min_max;
mod absolute_padding_border_overrides_max_size;
mod absolute_padding_border_overrides_size;
+mod absolute_resolved_insets;
mod align_baseline;
mod align_baseline_child;
mod align_baseline_child_margin;
diff --git a/tests/generated/grid/grid_absolute_resolved_insets.rs b/tests/generated/grid/grid_absolute_resolved_insets.rs
new file mode 100644
index 000000000..09d725308
--- /dev/null
+++ b/tests/generated/grid/grid_absolute_resolved_insets.rs
@@ -0,0 +1,578 @@
+#[test]
+fn grid_absolute_resolved_insets() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, tree::Layout, TaffyTree};
+ let mut taffy: TaffyTree<crate::TextMeasure> = TaffyTree::new();
+ let node00 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node01 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node02 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Percent(1f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Percent(1f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node03 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: auto(),
+ right: taffy::style::LengthPercentageAuto::Percent(1f32),
+ top: auto(),
+ bottom: taffy::style::LengthPercentageAuto::Percent(1f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node04 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(30f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(30f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node05 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Percent(1f32),
+ height: taffy::style::Dimension::Percent(1f32),
+ },
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node0 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node00, node01, node02, node03, node04, node05],
+ )
+ .unwrap();
+ let node10 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Auto,
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Auto,
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node11 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node12 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Percent(1f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Percent(1f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node13 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: auto(),
+ right: taffy::style::LengthPercentageAuto::Percent(1f32),
+ top: auto(),
+ bottom: taffy::style::LengthPercentageAuto::Percent(1f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node14 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(30f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(30f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node15 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Percent(1f32),
+ height: taffy::style::Dimension::Percent(1f32),
+ },
+ inset: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentageAuto::Length(0f32),
+ right: auto(),
+ top: taffy::style::LengthPercentageAuto::Length(0f32),
+ bottom: auto(),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ overflow: taffy::geometry::Point {
+ x: taffy::style::Overflow::Scroll,
+ y: taffy::style::Overflow::Scroll,
+ },
+ scrollbar_width: 15f32,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::Length(200f32),
+ height: taffy::style::Dimension::Length(200f32),
+ },
+ padding: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(15f32),
+ right: taffy::style::LengthPercentage::Length(15f32),
+ top: taffy::style::LengthPercentage::Length(15f32),
+ bottom: taffy::style::LengthPercentage::Length(15f32),
+ },
+ border: taffy::geometry::Rect {
+ left: taffy::style::LengthPercentage::Length(20f32),
+ right: taffy::style::LengthPercentage::Length(20f32),
+ top: taffy::style::LengthPercentage::Length(20f32),
+ bottom: taffy::style::LengthPercentage::Length(20f32),
+ },
+ ..Default::default()
+ },
+ &[node10, node11, node12, node13, node14, node15],
+ )
+ .unwrap();
+ let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).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!();
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node).unwrap();
+ assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, 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);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node0).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node0,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node0,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node00).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node00,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node00,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node01).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node01,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node01,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node02).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height);
+ assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x);
+ assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node02,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node02,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node03).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node03,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node03,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node04).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x);
+ assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node04,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node04,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node05).unwrap();
+ assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width);
+ assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node05,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node05,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node1).unwrap();
+ assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width);
+ assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height);
+ assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node1,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node1,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node10).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node10,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node10,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node11).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node11,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node11,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node12).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height);
+ assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x);
+ assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node12,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node12,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node13).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node13,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node13,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node14).unwrap();
+ assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width);
+ assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height);
+ assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x);
+ assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node14,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node14,
+ 0f32,
+ layout.scroll_height()
+ );
+ #[cfg_attr(not(feature = "content_size"), allow(unused_variables))]
+ let layout @ Layout { size, location, .. } = taffy.layout(node15).unwrap();
+ assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width);
+ assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height);
+ assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x);
+ assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y);
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_width(),
+ 0f32,
+ "scroll_width of node {:?}. Expected {}. Actual {}",
+ node15,
+ 0f32,
+ layout.scroll_width()
+ );
+ #[cfg(feature = "content_size")]
+ assert_eq!(
+ layout.scroll_height(),
+ 0f32,
+ "scroll_height of node {:?}. Expected {}. Actual {}",
+ node15,
+ 0f32,
+ layout.scroll_height()
+ );
+}
diff --git a/tests/generated/grid/mod.rs b/tests/generated/grid/mod.rs
index 031519195..e1aaf4713 100644
--- a/tests/generated/grid/mod.rs
+++ b/tests/generated/grid/mod.rs
@@ -34,6 +34,8 @@ mod grid_absolute_layout_within_border;
#[cfg(feature = "grid")]
mod grid_absolute_layout_within_border_static;
#[cfg(feature = "grid")]
+mod grid_absolute_resolved_insets;
+#[cfg(feature = "grid")]
mod grid_absolute_row_end;
#[cfg(feature = "grid")]
mod grid_absolute_row_start;