Say narrow_rel_base, and let a container pass None for it
`narrow` said what the argument did to a value it never named, so a reader had to go and find out which value. It is `narrow_rel_base`, and the resolved one stays the bare `rel_base` -- which is also the only one in `Painter`, `Placing` and `LayoutHolds`, where there is nothing to tell it apart from. It takes `impl Into<Option<[Option<Len>; 2]>>`, so a container that does not narrow anything writes `None` rather than `[None; 2]`, and `Span` builds the one case that does with a `then` instead of a mutable array. Cold layout is byte-identical to `84dad21`.
This commit is contained in:
1 parent
aeb60e50f5
commit
beb138632a
8 files changed
+55
-49
No files matched your search
@@ -14,7 +14,7 @@ impl Widget for Scroll {
|
||||
let container_len = painter.px_len(self.axis);
|
||||
// Asked in the whole viewport, then put at the scrolled offset.
|
||||
let answer_len = painter
|
||||
.widget_at(&self.inner, [None; 2], [Place::Fill(Part::WHOLE); 2])
|
||||
.widget_at(&self.inner, None, [Place::Fill(Part::WHOLE); 2])
|
||||
.len(self.axis);
|
||||
let fixed = painter.to_px(Len::from_parts(answer_len.rel, answer_len.px), self.axis);
|
||||
self.container_len = container_len;
|
||||
@@ -64,7 +64,7 @@ impl Widget for Scroll {
|
||||
// box, scrolled: its drawing moved there, not made again there.
|
||||
painter.place_at(
|
||||
&self.inner,
|
||||
[None; 2],
|
||||
None,
|
||||
self.axis
|
||||
.pair(Place::Fill(content), Place::Fill(Part::WHOLE)),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user