Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25e456e0b5 | ||
|
|
53b00c68e9 |
No files matched your search
@@ -202,6 +202,14 @@ impl UiRenderState {
|
|||||||
// that marks a reader is in `redraw`, which is not what asked here.
|
// that marks a reader is in `redraw`, which is not what asked here.
|
||||||
// Both retained routes are an answer, so the question is asked once
|
// Both retained routes are an answer, so the question is asked once
|
||||||
// rather than by each of them.
|
// rather than by each of them.
|
||||||
|
//
|
||||||
|
// Since `a92c6ac` settles a frame strictly bottom-up, no fuzzer can
|
||||||
|
// tell whether the second half of this still does anything: dropping
|
||||||
|
// `dirty_size_under` passes the suite, the shrinker at 400 seeds of
|
||||||
|
// depth 5, the oracle at 1000 of depth 6 and 2000 seeds at depth 4.
|
||||||
|
// It stays because `update` draws the root for a resize before
|
||||||
|
// `redraw_updates` runs at all, which that ordering does not reach --
|
||||||
|
// a hole that is reasoned rather than measured.
|
||||||
let stale =
|
let stale =
|
||||||
rsc.widgets().needs_redraw.contains(&id) || self.dirty_size_under(id, rsc.widgets());
|
rsc.widgets().needs_redraw.contains(&id) || self.dirty_size_under(id, rsc.widgets());
|
||||||
let replace_answer = self.answer_invalid.remove(&id) || (self.replace_answers && stale);
|
let replace_answer = self.answer_invalid.remove(&id) || (self.replace_answers && stale);
|
||||||
|
|||||||
+16
-34
@@ -46,43 +46,26 @@ impl Widget for Span {
|
|||||||
|sum, len| sum + *len,
|
|sum, len| sum + *len,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// What is left for the shares to divide: the box less everything
|
||||||
|
// fixed, as a length of the box rather than a number of pixels.
|
||||||
|
let room = Len::rel_max() - Len::from_parts(total.rel, total.px);
|
||||||
// Whether anything is left over is a question in pixels: `rel(0.5)`
|
// Whether anything is left over is a question in pixels: `rel(0.5)`
|
||||||
// beside 300 px is full at 600 and overfull at 400. The room to
|
// beside 300 px is full at 600 and overfull at 400. Asked of `room`
|
||||||
// divide is `len * fixed - total.px`, and the length where it runs
|
// itself, and answered back through the same expression, so the
|
||||||
// out is exactly the box a parent sizing itself from this answer
|
// boundary is the drawing's own and not a second way of finding it:
|
||||||
// hands back -- which is why this used to need a margin either side
|
// the three cases a rounded division needed -- the fixed parts
|
||||||
// of the boundary, and why it does not now: that box and this sum are
|
// growing slower than the box, faster, or exactly with it -- are the
|
||||||
// whole counts of the same step, and both routes to it land on the
|
// sign of `room.rel`, which `through` already reads. What the
|
||||||
// same count. What the generated oracle checks is the consequence,
|
// generated oracle checks is the consequence, since which children
|
||||||
// since which children exist at all turns on this.
|
// exist at all turns on this.
|
||||||
let fixed = Rel::ONE - total.rel;
|
|
||||||
let mut shares = false;
|
let mut shares = false;
|
||||||
if total.leftover > Weight::ZERO {
|
if total.leftover > Weight::ZERO {
|
||||||
let current = painter.px_len(axis);
|
shares = room.to_px(painter.px_len(axis)) > Px::ZERO;
|
||||||
let holds = if fixed > Rel::ZERO {
|
let holds = match shares {
|
||||||
// The box length the fixed parts alone fill.
|
true => Holds::from(Px::STEP..=Px::MAX),
|
||||||
let full = total.px.div(fixed);
|
false => Holds::from(Px::MIN..=Px::ZERO),
|
||||||
shares = current > full;
|
|
||||||
match shares {
|
|
||||||
true => Holds::from(full.next_up()..=Px::MAX),
|
|
||||||
false => Holds::from(Px::MIN..=full),
|
|
||||||
}
|
|
||||||
} else if fixed < Rel::ZERO {
|
|
||||||
// The relative parts grow faster than the box does, so here
|
|
||||||
// a shorter box is the one that leaves room.
|
|
||||||
let full = total.px.div(fixed);
|
|
||||||
shares = current < full;
|
|
||||||
match shares {
|
|
||||||
true => Holds::from(Px::MIN..=full.next_down()),
|
|
||||||
false => Holds::from(full..=Px::MAX),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// The relative parts take exactly the box, whatever it is, so
|
|
||||||
// the only room is what negative pixels leave.
|
|
||||||
shares = total.px < Px::ZERO;
|
|
||||||
Holds::ANY
|
|
||||||
};
|
};
|
||||||
painter.holds(axis, holds);
|
painter.holds(axis, holds.through(room));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Across itself a span is as long as its longest child -- unless a
|
// Across itself a span is as long as its longest child -- unless a
|
||||||
@@ -99,7 +82,6 @@ impl Widget for Span {
|
|||||||
// row.
|
// row.
|
||||||
let mut fixed = Len::rel_min();
|
let mut fixed = Len::rel_min();
|
||||||
let mut taken = Weight::ZERO;
|
let mut taken = Weight::ZERO;
|
||||||
let room = Len::rel_max() - Len::from_parts(total.rel, total.px);
|
|
||||||
let mut start = Len::rel_min();
|
let mut start = Len::rel_min();
|
||||||
let mut ortho = LayoutLen::ZERO;
|
let mut ortho = LayoutLen::ZERO;
|
||||||
for (child, len) in self.children.iter().zip(&lens) {
|
for (child, len) in self.children.iter().zip(&lens) {
|
||||||
|
|||||||
Reference in new issue
Block a user