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

+13 -4
View File
@@ -422,10 +422,19 @@ impl<'a> Painter<'a> {
self.extent_own[axis as usize] = holds;
}
/// One window axis in pixels. Every length in layout is a length of the
/// window, so this is what one becomes pixels against.
pub fn window_px_len(&self, axis: Axis) -> Px {
self.window.axis(axis)
/// A window length in pixels, which is what every length in layout is
/// measured in. Reading one pins the drawing to this window wherever the
/// length is a fraction of it; one that is only pixels is that many
/// pixels in any window and pins nothing.
pub fn to_px(&mut self, len: Len, axis: Axis) -> Px {
let window = self.window.axis(axis);
if len.rel != Rel::ZERO {
let own = &mut self.frame_own[axis as usize];
if *own == Holds::ANY {
*own = Holds::at(window);
}
}
len.to_px(window)
}
/// A validity range already stated about the window. Containers use