Give a child a part of the container's extent rather than its raw box
`Pad` and `Stack` read `Painter::placement` to put their children inside their own drawing, and reading it is what says the drawing holds for that placement alone. So a pad or a stack anywhere in a row was drawn again -- with its whole subtree -- the moment an earlier sibling changed length, however little else had moved. `widget_within` now takes a `DrawRegion`, and `DrawRegion::Extent(part)` gives the child a part of the extent without reading it. What is retained is the part rather than the box it resolved to, so moving the extent re-places the child through the same rule instead of redrawing the parent: `inherited_children` becomes `extent_children`, carrying `Inherit` for the wrapper case `Painter::widget` already had and `Within(part)` for the new one. The dependency that goes up is a range on the container's extent rather than on its frame, since only the part's *length* reaches the child and where the part sits is re-placed. A declared length is unchanged: it is a length of the frame wherever the box it sits in came from. What still pins the placement is a report with a fraction in it -- the same fraction of a different extent is a different length -- and that pin is on the answer, which `extent_frames_keep_fractional_reports_and_numeric_dependencies_valid` fails without. Three tests from the first attempt at this come with it, and the diagnostics rig now says which of the three contracts refused a reuse, which is what found the above. Measured, seed 1 at depth 8, median frame: `many` 0.667 -> 0.613 ms and `resize` 48 -> 32 us; seed 13's `many` 6.35 -> 5.15 ms. Green: fmt, clippy, 109 suite and 20 core tests, the oracle at 100 seeds, the shrinker at 400 trees of depth 5, 1000 seeds at depth 6, and 2000 seeds at depth 4 over all fifteen cases. The five reference renders are byte-identical to `0e107f0` on Venus, as are `tabs` resized to 900x1200 and `random` to 1280x800 against cold renders there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e107f0e89
commit
e6ba570d07
7 files changed
+358
-57
No files matched your search
@@ -54,10 +54,13 @@ pub(crate) enum Counter {
|
||||
TextShapes,
|
||||
TextBreaks,
|
||||
GlyphPlacements,
|
||||
OutsidePlacement,
|
||||
OutsideFrame,
|
||||
OutsideExtent,
|
||||
}
|
||||
|
||||
impl Counter {
|
||||
const COUNT: usize = Self::GlyphPlacements as usize + 1;
|
||||
const COUNT: usize = Self::OutsideExtent as usize + 1;
|
||||
|
||||
const NAMES: [&'static str; Self::COUNT] = [
|
||||
"updates",
|
||||
@@ -89,6 +92,9 @@ impl Counter {
|
||||
"text shapes",
|
||||
"text line breaks",
|
||||
"glyph placements",
|
||||
"reuse outside: the placement it was pinned to",
|
||||
"reuse outside: a frame length",
|
||||
"reuse outside: an extent length",
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user