From aa79d7c38cddf7d563900e29c2abc1e9f786038f Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Thu, 30 May 2024 23:20:04 +0100 Subject: [PATCH] Block auto margins are zeroed by two auto insets not two auto margins The rule is: "If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0." Taffy was previously erroneously checking 'margin-left' and 'margin-right' instead of 'left' and 'right' --- src/compute/block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compute/block.rs b/src/compute/block.rs index 7e6d300be1..04298299b0 100644 --- a/src/compute/block.rs +++ b/src/compute/block.rs @@ -383,7 +383,7 @@ fn perform_final_layout_on_in_flow_children( let free_x_space = f32_max(0.0, container_inner_width - final_size.width - item_non_auto_x_margin_sum); let x_axis_auto_margin_size = { let auto_margin_count = item_margin.left.is_none() as u8 + item_margin.right.is_none() as u8; - if auto_margin_count == 2 && item.size.width.is_none() { + if item.inset.left.is_auto() && item.inset.right.is_auto() && item.size.width.is_none() { 0.0 } else if auto_margin_count > 0 { free_x_space / auto_margin_count as f32