Recompose retained frames exactly and preserve text width validity
Keep each widget's original local frame and replay the same composition order on reuse. Remove inverse region remapping, including its fixed-frame fallback that forced otherwise valid subtrees to draw again. Require exact pixel-region equality in the shared generated oracle. Check primitive and mask geometry as well as draw reuse when fixed frames resize. Publish text's retained line-break range, with no upper bound when there are no soft breaks, and cover widening, explicit newlines, and empty text. Compared withefb416b, the depth-8 diagnostic rig performs 7-9% fewer widget evaluations in the affected phases. Uninstrumented release runs use 3.5% fewer instructions for size changes and 5.0% fewer for resize. Repaint and scroll use 0.7% and 0.6% more instructions. Container updates remain substantially more expensive than thee44dea3baseline; this is still an experimental continuation, not a production replacement.
This commit is contained in:
1 parent
efb416bbc3
commit
2ed5503717
7 files changed
+162
-203
No files matched your search
@@ -176,6 +176,23 @@ impl TextBuffer {
|
||||
self.layout_key.as_ref()?.max_width
|
||||
}
|
||||
|
||||
/// Widths covered by the current line breaks, including a wider shaping
|
||||
/// retained when a later draw requested a narrower box.
|
||||
pub fn width_holds(&self) -> crate::Holds {
|
||||
let Some(width) = self.wrap_width() else {
|
||||
return crate::Holds::ANY;
|
||||
};
|
||||
let width = Px::from_f32(width);
|
||||
let soft_wrapped = self.layout.lines().any(|line| {
|
||||
matches!(
|
||||
line.break_reason(),
|
||||
parley::layout::BreakReason::Regular | parley::layout::BreakReason::Emergency
|
||||
)
|
||||
});
|
||||
let upper = if soft_wrapped { width } else { Px::MAX };
|
||||
crate::Holds::from(Px::ceil_from_f32(self.layout.width()).min(width)..=upper)
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Vec2 {
|
||||
Vec2::new(self.layout.width(), self.layout.height())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user