Take a window read where a length is resolved against it

A widget that resolves a window length in pixels depends on that window
wherever the length is a fraction of it, and nothing was recording that:
Painter::to_px replaces window_px_len and pins the window it read, while
a length that is only pixels is that many pixels in any window and pins
nothing. Span still states the range it actually branched on, which
replaces the pin with something wider.

Scroll is where it showed: its content's answer is a window length now,
so a viewport whose own box does not change with the window -- 40 px of
a branch's box -- kept an end-snapped offset from the window before.
Seed 942 at depth 6 under resize, pinned as
unsettled::resizing_under_a_short_scroll_snaps_its_window_tall_content_again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
iris-aiandClaude Opus 5 committed 2026-09-19 00:21:11 -04:00
1 parent 1512d8418b
commit 23523eea29
6 files changed
+61 -13

No files matched your search

+1 -2
View File
@@ -16,8 +16,7 @@ impl Widget for Scroll {
let answer_len = painter
.widget_at(&self.inner, [None; 2], [Place::Fill(Part::All); 2])
.len(self.axis);
let fixed =
Len::from_parts(answer_len.rel, answer_len.px).to_px(painter.window_px_len(self.axis));
let fixed = painter.to_px(Len::from_parts(answer_len.rel, answer_len.px), self.axis);
self.container_len = container_len;
self.content_len = fixed.max(container_len);
+1 -1
View File
@@ -68,7 +68,7 @@ impl Widget for Span {
// exist at all turns on this.
let mut shares = false;
if total.leftover > Weight::ZERO {
shares = room.to_px(painter.window_px_len(axis)) > Px::ZERO;
shares = painter.to_px(room, axis) > Px::ZERO;
let holds = match shares {
true => Holds::from(Px::STEP..=Px::MAX),
false => Holds::from(Px::MIN..=Px::ZERO),