From a24b6ab062da285937209939b25ad4c5a5023e62 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Fri, 7 Aug 2026 19:14:37 +0000 Subject: [PATCH] Map display:flow-root to taffy's new item_is_flow_root so it establishes a BFC Bumps taffy rev to include Style::item_is_flow_root / CoreStyle::is_flow_root (DioxusLabs/taffy#1060). flow-root boxes now avoid floats and do not collapse margins with their parent's BFC. --- Cargo.lock | 2 +- Cargo.toml | 2 +- packages/stylo_taffy/src/convert.rs | 6 ++++++ packages/stylo_taffy/src/wrapper.rs | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d40ef9211..8022f3ce8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7188,7 +7188,7 @@ dependencies = [ [[package]] name = "taffy" version = "0.12.2" -source = "git+https://github.com/DioxusLabs/taffy?rev=8391c0903648448cf0a78d7983cb9b49b5f200a3#8391c0903648448cf0a78d7983cb9b49b5f200a3" +source = "git+https://github.com/DioxusLabs/taffy?rev=6e811a8b72a8dc00d4765a927632606d9a2208af#6e811a8b72a8dc00d4765a927632606d9a2208af" dependencies = [ "arrayvec", "serde", diff --git a/Cargo.toml b/Cargo.toml index 4bacbbd7a..243ad5c8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ dioxus-cli-config = { version = "0.7.3" } dioxus-core-macro = { version = "0.7.3" } # Taffy + Parley + Fontations -taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "8391c0903648448cf0a78d7983cb9b49b5f200a3", default-features = false, features = [ +taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "6e811a8b72a8dc00d4765a927632606d9a2208af", default-features = false, features = [ "std", "flexbox", "grid", diff --git a/packages/stylo_taffy/src/convert.rs b/packages/stylo_taffy/src/convert.rs index 11954be3d..5f3fe4b36 100644 --- a/packages/stylo_taffy/src/convert.rs +++ b/packages/stylo_taffy/src/convert.rs @@ -158,6 +158,11 @@ pub fn is_block(input: stylo::Display) -> bool { ) } +#[inline] +pub fn is_flow_root(input: stylo::Display) -> bool { + matches!(input.inside(), stylo::DisplayInside::FlowRoot) +} + #[inline] pub fn is_table(input: stylo::Display) -> bool { matches!(input.inside(), stylo::DisplayInside::Table) @@ -613,6 +618,7 @@ pub fn to_taffy_style(style: &stylo::ComputedValues) -> taffy::Style { box_sizing: self::box_sizing(style.clone_box_sizing()), item_is_table: display.inside() == stylo::DisplayInside::Table, item_is_replaced: false, + item_is_flow_root: self::is_flow_root(display), position: self::position(style.clone_position()), overflow: taffy::Point { x: self::overflow(style.clone_overflow_x()), diff --git a/packages/stylo_taffy/src/wrapper.rs b/packages/stylo_taffy/src/wrapper.rs index 1b861c018..21d9e5cfc 100644 --- a/packages/stylo_taffy/src/wrapper.rs +++ b/packages/stylo_taffy/src/wrapper.rs @@ -44,6 +44,11 @@ impl> taffy::CoreStyle for TaffyStyloStyle convert::is_block(self.0.get_box().display) } + #[inline] + fn is_flow_root(&self) -> bool { + convert::is_flow_root(self.0.get_box().display) + } + #[inline] fn box_sizing(&self) -> taffy::BoxSizing { convert::box_sizing(self.0.get_position().box_sizing)