Settle dirty layout from the leaves upward

This commit is contained in:
iris-ai committed 2026-09-14 15:56:44 -04:00
1 parent a640c6cce2
commit 84f589e364
5 files changed
+69 -68

No files matched your search

+3 -7
View File
@@ -13,13 +13,9 @@ impl Widget for Scroll {
fn draw(&mut self, painter: &mut Painter) -> Size {
let output_len = painter.output_size().axis(self.axis);
let container_len = UiScalar::abs(painter.px_size().axis(self.axis));
// Its last measured size stays valid while neither the child nor this
// container's constraints changed. Otherwise draw it in the whole
// container to learn its length, then place it at the scrolled offset.
let child = match painter.retained_size(&self.inner) {
Some(size) => size,
None => painter.place(&self.inner, UiRegion::FULL).size(),
};
// Draw in the whole container to learn the content's length, then
// place it at the scrolled offset.
let child = painter.place(&self.inner, UiRegion::FULL).size();
let content_len = child
.axis(self.axis)
.apply_rest()