Skip to main content

max / makeover-webview

Give a run member that asks to fill the rule that lets it `.run > [data-width="fill"]` gets `flex: 1 1 0`. A zero basis and not `auto`, because equal division between several fills is what `Width::Fill` states and `auto` divides the leftovers in proportion to the contents instead. The `min-width: min-content` floor stays, so a fill cannot shrink under what is in it and overlap its neighbour. A member that says nothing gets nothing: a flex item with the floor and no grow is already content-sized. That is why this position omits `Content` while a control omits `Fill`. Each leaves out what it already did. The markup half is quasi-webview (quasicoherent `cf981aaa`), which emits the attribute for the two panes and the row of peers that `RegionKind::Split` and `Columns` used to spell.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session
https://claude.ai/code/session_01P8ostB2UmZJGj5WjSHRSot
Author: Max Johnson <me@maxj.phd> · 2026-09-07 19:19 UTC
Signed with PGP, not checked
Commit: 2dae673172fc644bc55ae2bea89145f2e75b295f
Parent: 24c5fe0
3 files changed, +61 insertions, -1 deletion
M Cargo.toml +1 -1
@@ -1,6 +1,6 @@
1 1 [package]
2 2 name = "makeover-webview"
3 - version = "0.73.0"
3 + version = "0.74.0"
4 4 edition = "2024"
5 5 # One copy of this renderer per dependency graph, enforced by cargo rather than
6 6 # by remembering. Two versions means the generated stylesheet and the emitted
M src/lib.rs +35
@@ -1104,6 +1104,20 @@
1104 1104 /// costs no query and no number, and it is what fixes all four measured widths
1105 1105 /// whichever fallback the group declared.
1106 1106 ///
1107 + /// # A member that asks to fill
1108 + ///
1109 + /// `.run > [data-width="fill"]` gets `flex: 1 1 0`, which is the second half of
1110 + /// what a column has always been able to say, reaching a row of regions.
1111 + /// `flex-basis: 0` and not `auto` is what makes several fills divide the room
1112 + /// equally rather than dividing the leftovers in proportion to their contents;
1113 + /// equal division is [`makeover_layout::Width::Fill`]'s own stated rule. The
1114 + /// floor above still applies, so a fill cannot shrink under what is in it.
1115 + ///
1116 + /// A member that says nothing gets nothing, because a flex item with the floor
1117 + /// and no grow is already content-sized. That is why the omitted value here is
1118 + /// `Content` while a control omits `Fill`: each position leaves out what it
1119 + /// already did.
1120 + ///
1107 1121 /// # What each fallback gets, exactly
1108 1122 ///
1109 1123 /// [`Fallback::Wrap`] is `flex-wrap: wrap`, which is exact. The browser wraps
@@ -1175,6 +1189,27 @@
1175 1189 // even without anything leaving the flow.
1176 1190 let _ = writeln!(css, ".{run} > * {{\n min-width: min-content;\n}}");
1177 1191
1192 + // A member that absorbs what is left. `flex-basis: 0` rather than `auto` is
1193 + // what makes several fills divide the room equally instead of dividing the
1194 + // leftovers in proportion to what is already in them, which is
1195 + // `Width::Fill`'s own rule and the one thing that type states about more
1196 + // than one of them.
1197 + //
1198 + // The `min-width: min-content` floor above is deliberately not overridden.
1199 + // A fill that could shrink below its contents would overlap its neighbour,
1200 + // which is rule 1, and equal division under a floor is still equal division
1201 + // everywhere the floor is not reached.
1202 + //
1203 + // Attribute rather than class, because the width is a fact the description
1204 + // carried rather than a hook this crate invented: the same division
1205 + // `data-tone` and `data-selector` are on the right side of. It beats the
1206 + // `Stack` rule below on specificity whichever order they are written in,
1207 + // which is what a member asking to fill should do to a blanket.
1208 + let _ = writeln!(
1209 + css,
1210 + ".{run} > [data-width=\"fill\"] {{\n flex: 1 1 0;\n}}"
1211 + );
1212 +
1178 1213 for fallback in [
1179 1214 Fallback::Wrap,
1180 1215 Fallback::Stack,
M src/tests.rs +25
@@ -41,6 +41,25 @@
41 41 assert!(!css.contains("@media"));
42 42 }
43 43
44 + #[test]
45 + fn a_member_that_asks_to_fill_absorbs_what_is_left() {
46 + // The second half of what a column says, reaching a row of regions
47 + // (quasicoherent `cf981aaa`). A zero basis and not `auto`, because equal
48 + // division between several fills is `Width::Fill`'s own stated rule and
49 + // `auto` divides the leftovers in proportion to the contents instead.
50 + let css = run_rules(&Emit::default());
51 + assert!(css.contains(".run > [data-width=\"fill\"] {\n flex: 1 1 0;\n}"));
52 +
53 + // The floor is not overridden. A fill that could shrink under its own
54 + // contents would overlap its neighbour, which is the rule this whole
55 + // mechanism exists to keep.
56 + assert!(!css.contains("min-width: 0"));
57 +
58 + // A member that says nothing gets nothing: content is what a flex item
59 + // with the floor and no grow already is.
60 + assert!(!css.contains("data-width=\"content\""));
61 + }
62 +
44 63 #[test]
45 64 fn room_is_never_asked_of_the_viewport() {
46 65 // The 913 case: a window in SizeClass::Expanded holding a group out of
@@ -1188,6 +1207,12 @@
1188 1207 | "center"
1189 1208 | "min-content"
1190 1209 | "1 1 max-content"
1210 + // A run member that absorbs what is left, 0.74.0.
1211 + // Grow, shrink and a zero basis: the zero is what
1212 + // makes several fills divide the room equally
1213 + // rather than dividing the leftovers in proportion
1214 + // to their contents. Three ratios and no length.
1215 + | "1 1 0"
1191 1216 // A menu run's overflow control, 0.64.0.
1192 1217 // `column` and `stretch` are the same reading
1193 1218 // `flex` and `center` get one line up: which way