From bfe51c76227b24879e62e96f02b238ae31d46a52 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 23 Nov 2026 02:57:01 -0500 Subject: [PATCH] fw sync: L-320: parts_group takes the nested case: a part group registered under the body group keeps its own group, for the header's hosted cells as for the parts --- crates/ui-contract/src/contract/items/header.rs | 2 +- crates/ui-contract/src/contract/steps/stops.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/ui-contract/src/contract/items/header.rs b/crates/ui-contract/src/contract/items/header.rs index 811ff3e17..881ed1426 100644 --- a/crates/ui-contract/src/contract/items/header.rs +++ b/crates/ui-contract/src/contract/items/header.rs @@ -800,7 +800,7 @@ impl Header { /// where the `PaintUi` the hosting needs exists. pub(super) fn paint(&self, ui: &mut Ui, cx: &Cx<'_, C>, comp: &mut C, env: &Env, id: Id, rtl: bool) { let ctx = ui.ctx().clone(); - let group = crate::contract::steps::parts_group(id, env.roving.filter(|_| cx.core.roving_member)); + let group = crate::contract::steps::parts_group(&ctx, id, env.roving.filter(|_| cx.core.roving_member)); for cell in &self.cells { let spec = &self.specs[cell.spec]; let hosted = self.hosted.contains(&spec.key); diff --git a/crates/ui-contract/src/contract/steps/stops.rs b/crates/ui-contract/src/contract/steps/stops.rs index 017648c0a..fabb2b054 100644 --- a/crates/ui-contract/src/contract/steps/stops.rs +++ b/crates/ui-contract/src/contract/steps/stops.rs @@ -53,8 +53,13 @@ fn roving_group(id: Id) -> Id { /// The roving group a stop shown among a component's parts joins: the body group `joined` when the component joined it /// in this pass (`Cx::join_roving`), else the group of the component's own parts. The one source for the parts' /// registration and for a component the header hosts in its cells. -pub(crate) fn parts_group(id: Id, joined: Option) -> Id { - joined.unwrap_or_else(|| roving_group(id)) +/// +/// A part group that nests in the body group (it moves on the crossing axis, so its group was registered with the body +/// group as its parent) keeps its own group: its parts rove among themselves and the body steps over them as one member. +pub(crate) fn parts_group(ctx: &Context, id: Id, joined: Option) -> Id { + let own = roving_group(id); + let nested = joined.is_some_and(|body| focus::with(ctx, |state| state.current_group(own)).is_some_and(|group| group.parent == Some(body))); + joined.filter(|_| !nested).unwrap_or(own) } pub(crate) fn body_group(id: Id) -> Id { sub(id, "body_roving") @@ -114,7 +119,7 @@ pub(crate) fn register_stops(input: &StopsIn<'_>) -> Vec { let stop = if extras.nudges { stop.role(input.role.nudge(true)) } else { stop }; let stop = if extras.default_stop { stop.default_stop() } else { stop }; // A part group that joined the body's roving group has its parts registered there, unless it nests in it. - let joined = group.map(|_| parts_group(input.id, input.group.filter(|_| !nested))); + let joined = group.map(|_| parts_group(ctx, input.id, input.group.filter(|_| !nested))); let stop = if let Some(group) = row_parts.or(joined).or(input.row) { stop.in_group(group) } else { stop }; if extras.after_header { after_header.push(stop);