Settle dirty layout from the leaves upward
This commit is contained in:
1 parent
a640c6cce2
commit
84f589e364
5 files changed
+69
-68
No files matched your search
@@ -22,8 +22,6 @@ pub struct Painter<'a> {
|
||||
/// The children whose size this widget read while drawing.
|
||||
pub(super) size_deps: Vec<WidgetId>,
|
||||
pub(super) reads_output: bool,
|
||||
/// Whether this widget is drawing in the same pixel-sized box as before.
|
||||
pub(super) same_box: bool,
|
||||
/// The slot this widget's primitives are positioned through: its own if
|
||||
/// its parent placed it, otherwise the nearest ancestor that has one.
|
||||
pub(super) move_idx: MoveIdx,
|
||||
@@ -146,21 +144,6 @@ impl<'a> Painter<'a> {
|
||||
Some(hint)
|
||||
}
|
||||
|
||||
/// A clean child's retained size, when this widget's own constraints are
|
||||
/// unchanged. This is the answer from its last real draw, not a guess.
|
||||
pub fn retained_size<W: ?Sized>(&mut self, id: &StrongWidget<W>) -> Option<Size> {
|
||||
if !self.same_box || self.rsc.widgets().needs_redraw.contains(&id.id()) {
|
||||
return None;
|
||||
}
|
||||
let active = self.state.active.get(&id.id())?;
|
||||
if active.parent != Some(self.id) {
|
||||
return None;
|
||||
}
|
||||
let size = active.size;
|
||||
self.depend_on_size(id);
|
||||
Some(size)
|
||||
}
|
||||
|
||||
fn depend_on_size<W: ?Sized>(&mut self, child: &StrongWidget<W>) {
|
||||
if !self.size_deps.contains(&child.id()) {
|
||||
self.size_deps.push(child.id());
|
||||
|
||||
Reference in new issue
Block a user