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:
iris-ai committed 2026-09-19 16:55:48 -04:00
1 parent aeb60e50f5
commit beb138632a
8 files changed
+55 -49

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ pub struct ActiveData {
/// padding's rel base less its pixels -- as a length of the window. `None`
/// forwards the parent's rel base. What it declared is kept separately in
/// `declared` and is a fraction of whichever of the two reached it.
pub narrow: [Option<Len>; 2],
pub narrow_rel_base: [Option<Len>; 2],
/// Where its drawing was put, and where it was asked, each as a part of
/// its parent's box. The two differ where a container asks in one place
/// and puts the answer in another -- a row measures from its cursor and