Place a locally redrawn widget once, in the box already chosen for it
`redraw` asks a dirty widget at its offer, and then again in the final box its parent chose from that answer. The second ask handed that box over as if it were an offer, so `draw_inner` ran `placed_box` on it and applied the widget's own alignment to a box that had already been placed -- a second placement on every local redraw of a widget that is not near-aligned. It only showed where the widget's alignment was its own to apply: a container override makes `draw_inner` take the box as given, and `Stack`, `Pad` and `Scroll` override every child they hand a box to. It is the fix for both of the handoff's standing warm-against-cold failures. Shrinker seed 288 on `region-node` was an 8.8px inset at each end of a `Text` under a `Span(Y-)` under two `Stack`s; oracle seed 326 at depth 6 was 88px on a `Text` under two `Branch`es. Neither reduced below 11 and 43 widgets, and both are this. Checked: fmt, clippy, 80 suite tests, 17 core unit tests, the release oracle at 100 seeds, **all fifteen shrinker cases at 400 seeds of depth 5**, and **1000 seeds of depth 6** -- the last two for the first time. `tabs`, `text`, `random` and the tab replay render byte-identical at 1920x1200 against `08c9d5a`, since nothing about a cold layout changes. Generated seed 20 at depth 4 catches it and joins the ordinary set, so `cargo test` fails without this rather than only the ignored long run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
08c9d5aa32
commit
d8ae9c3bdd
2 files changed
+15
-6
No files matched your search
@@ -1013,9 +1013,16 @@ impl UiRenderState {
|
||||
if at_offer {
|
||||
return;
|
||||
}
|
||||
// Then in the final box its parent chose from that answer. It is kept
|
||||
// if it holds there; otherwise its result is the parent's business.
|
||||
self.draw_inner(id, region, info, None, rsc);
|
||||
// Then in the final box its parent chose from that answer. That box
|
||||
// is already placed, so the near edge goes with it: applying the
|
||||
// widget's own alignment to it again would place its content twice,
|
||||
// the way it did for a region node under a `Stack` once the stack
|
||||
// stopped overriding every child's alignment.
|
||||
let placed_info = DrawInfo {
|
||||
align: Some(RegionAlign::NEAR),
|
||||
..info
|
||||
};
|
||||
self.draw_inner(id, region, placed_info, None, rsc);
|
||||
let active = &self.active[&id];
|
||||
if (active.size, active.holds) != was {
|
||||
rsc.widgets_mut().needs_redraw.insert(parent);
|
||||
|
||||
Reference in new issue
Block a user