From a2378a72fe6ebf86969bb5e9c5b15ff351bf086c Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Wed, 17 Jul 2024 08:28:26 +1200 Subject: [PATCH] Fix case where Taffy allowed margins to collapse through an element when it shouldn't have (#695) --- src/compute/block.rs | 4 +++- src/compute/leaf.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compute/block.rs b/src/compute/block.rs index 7e0bc1aa5..512e885fa 100644 --- a/src/compute/block.rs +++ b/src/compute/block.rs @@ -186,7 +186,9 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: || padding.top > 0.0 || padding.bottom > 0.0 || border.top > 0.0 - || border.bottom > 0.0; + || border.bottom > 0.0 + || matches!(size.height, Some(h) if h > 0.0) + || matches!(min_size.height, Some(h) if h > 0.0); drop(style); diff --git a/src/compute/leaf.rs b/src/compute/leaf.rs index 0c3f5a0af..c05d54eb2 100644 --- a/src/compute/leaf.rs +++ b/src/compute/leaf.rs @@ -78,7 +78,9 @@ where || padding.top > 0.0 || padding.bottom > 0.0 || border.top > 0.0 - || border.bottom > 0.0; + || border.bottom > 0.0 + || matches!(node_size.height, Some(h) if h > 0.0) + || matches!(node_min_size.height, Some(h) if h > 0.0); debug_log!("LEAF"); debug_log!("node_size", dbg:node_size);