From ddc06cae5829d20c7a7dd2c36a37e60ae92b7e21 Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 20 Nov 2026 09:58:39 +0000 Subject: [PATCH] craft-ui: a scrolling body's measuring run keeps its unbounded band The bound to the measured line applies once this pass measured the body; its measuring run lays the content out in the unbounded band, so a measure reports the content's whole extent. --- crates/ui-contract/src/contract/body/regions.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui-contract/src/contract/body/regions.rs b/crates/ui-contract/src/contract/body/regions.rs index 8eaa13d3f..4f20d74ed 100644 --- a/crates/ui-contract/src/contract/body/regions.rs +++ b/crates/ui-contract/src/contract/body/regions.rs @@ -383,8 +383,10 @@ impl<'b> BodyHooks<'b> { let end_line = if full { (end_h - across_h).max(0.0) } else { end_h }; let line_bottom = top + line_h.max(end_line).min(body_room); // A scrolling body offered no bound (a content-sized container in a body that scrolls) shows all of its - // content: its view is the line this pass measured, never an unbounded band. - let bottom = if body_room.is_finite() || scroll_of(props).is_none() { top + body_room } else { line_bottom }; + // content: once this pass measured it, its view is that line, never an unbounded band. Its measuring run + // keeps the unbounded band, in which the content takes its whole extent. + let unbounded_view = !body_room.is_finite() && scroll_of(props).is_some() && self.measured_body.is_some(); + let bottom = if unbounded_view { line_bottom } else { top + body_room }; (bottom, line_bottom) } else { // A fill-width body is offered the room the parent gives this pass, never the height its content took last