Say what three retained-layout details mean

Reading this back, three things claim something they do not do.

`OnResize::Translate` is returned by `TextView::on_resize` under a
comment weighing anchored glyphs against reshaping ones, but nothing
consumes it: `try_reuse` asks only whether the answer is `Scale`, so a
widget saying `Translate` is redrawn. Say so on the variant, since the
comment beside it reads as a description of behaviour.

`depend_on_size(child, false)` and `depend_on_size(child, true)` are the
difference between a hint, which is context-free, and a size the child
produced by drawing, which carries every pixel axis the child read. That
is the subtlest rule in the file and it was spelled as a bool; give the
two cases their names.

`draw_started` is the record of what has drawn during the pass under
way, and it worked only because `redraw` removes an id before asking
about it -- nothing emptied the set, so it accumulated the id of every
widget ever drawn, including ones long gone. Empty it with the pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
iris-aiandClaude Opus 5 committed 2026-09-14 18:49:08 -04:00
1 parent b1b3eca1c0
commit f1a47e9b7b
3 files changed
+26 -13

No files matched your search

+5
View File
@@ -27,6 +27,9 @@ pub struct UiRenderState {
/// content dirtiness, these may retain an answer whose observed pixel
/// axes did not change.
resize_marks: HashSet<WidgetId>,
/// What has already been drawn during the pass under way, so a widget
/// reached by redrawing an ancestor is not drawn again on its own
/// account. Emptied when the pass ends.
draw_started: HashSet<WidgetId>,
/// A widget's move slot, which outlives any one `ActiveData`: a redraw
/// replaces that while its children go on pointing at the slot.
@@ -138,6 +141,7 @@ impl UiRenderState {
self.resized = [false; 2];
self.invalid_sizes.clear();
self.resize_marks.clear();
self.draw_started.clear();
}
fn redraw_all(&mut self, root: Option<&StrongWidget>, rsc: &mut dyn UiRsc) {
@@ -574,6 +578,7 @@ impl UiRenderState {
self.layers.clear();
self.invalid_sizes.clear();
self.resize_marks.clear();
self.draw_started.clear();
rsc.widgets_mut().needs_redraw.clear();
rsc.free();
}