Print the box a widget drew in, not the rel base labelled as it
`DrawInfo::px` was the child's rel base in pixels, resolved at all four construction sites on every draw and read only by three diagnostics -- each of which called it the box: `diag::draw_request`'s `pixel_size`, printed by `trace_unsettled` as "draw in"; and two `debug_assert` messages saying "clips to" and "drew in". A rel base and a box differ wherever a parent hands down part of its own, which is every child of a span, so all three said something that was not true. The field is gone and each site reads `region.to_px(window)`, which is the box it claimed to be printing and costs nothing outside a failing assert. The trace field is `region_px`. `Placing::window` existed only to resolve that value and follows it out. The 23-line counter block inside `try_reuse`'s "outside its range" branch is `diag::outside`, beside the other diagnostics, so the decision reads as its six checks. fmt, workspace clippy under `-D warnings` with and without `layout-diagnostics`, and the workspace tests under both are clean. The cold dump over 400 depth-5 trees is byte-identical: 34,492 boxes. The trace now prints "draw in 189.00x176.00" beside a region 189 by 176.
This commit is contained in:
1 parent
3da1c71870
commit
7e2b4cd9db
4 files changed
+51
-49
No files matched your search
@@ -42,12 +42,12 @@ fn dump(label: &str, report: &diag::Report, text: WidgetId) {
|
||||
TraceEvent::DrawRequest {
|
||||
id,
|
||||
region,
|
||||
pixel_size,
|
||||
region_px,
|
||||
..
|
||||
} if *id == text => {
|
||||
println!(
|
||||
" draw in {:.2}x{:.2} region {region:?}",
|
||||
pixel_size.x, pixel_size.y
|
||||
region_px.x, region_px.y
|
||||
)
|
||||
}
|
||||
TraceEvent::SizeReported { id, size } if *id == text => {
|
||||
|
||||
Reference in new issue
Block a user