Keep the original measurement placement separate from the assigned slot.
Validate frame and extent lengths before reusing an answer or drawing, and
represent hint-only records as having no measured answer.
Retain primitive and mask coordinates with their frame/extent reference.
Forwarded children follow a reused wrapper's placement without rerunning
valid draw bodies. Keep the single Widget::draw API.
Restore the eight failing suite cases from the region/placement prototype,
with regressions for mixed coordinate references, a changed inherited
extent, the sizing-stack fraction, and an undrawn share becoming visible.
This remains experimental: nested container updates do substantially more
work than e44dea3 despite restoring the leaf and wrapper reuse guarantees.
Do not merge it as a performance improvement.
19 lines
667 B
Rust
19 lines
667 B
Rust
use crate::prelude::*;
|
|
|
|
pub struct Masked {
|
|
pub inner: StrongWidget,
|
|
}
|
|
|
|
impl Widget for Masked {
|
|
fn draw(&mut self, painter: &mut Painter) -> Size {
|
|
painter.set_mask(DrawRegion::Extent(UiRegion::FULL));
|
|
painter.widget(&self.inner);
|
|
// What it occupies is its box, on both axes, for the reason `Scroll`
|
|
// reports the same: it clips what is inside to that box, so it can
|
|
// neither take less of one nor honestly ask for more. Passing the
|
|
// inner size up instead asks to be placed at a length it does not
|
|
// draw, and the framework would place the drawing it clipped away.
|
|
Size::LEFTOVER
|
|
}
|
|
}
|