Judge a kept contract against the box it was asked in

A local redraw keeps the narrower guarantee its parent holds when the new
drawing covers it, so widening and narrowing back do not churn the parent.
It checked that guarantee against `placement`, where the answer put the
drawing, rather than `region`, the box the drawing was made in and the box
both contracts are about. The two differ on every axis a widget reported
less than it was offered, so any such widget escalated to its parent every
time its contract widened -- which is the churn the retention exists to
avoid. `resize` and `try_reuse` both already ask about `region`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
iris-aiandClaude Opus 5 committed 2026-09-20 00:18:18 -04:00
1 parent aea0387567
commit 713e3e747b
2 files changed
+60 -1

No files matched your search

+4 -1
View File
@@ -1102,8 +1102,11 @@ impl UiRenderState {
{
active.answer = was_answer;
}
// Against the box it was asked in, which is what both contracts are
// about. Where the answer put the drawing is shorter than that
// wherever the widget reported less than it was offered.
if active.holds.covers(was_holds)
&& was_holds.contains(self.output_size, active.rel_base, active.placement)
&& was_holds.contains(self.output_size, active.rel_base, active.region)
{
active.holds = was_holds;
}