1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Chrome substitution — the seam between the inline paint path and
//! the UA chrome the built-in elements supply.
//!
//! A few built-ins paint something other than their own text: a
//! `<progress>` / `<meter>` paints a bar, a closed `<select>` dropdown
//! echoes its selected option's label, an `<input type="password">`
//! paints bullets. The paint pass must not know how any of that is
//! decided (which attribute marks a dropdown open, how a meter picks
//! its zone color, …). It knows only the contract in this file: ask
//! for an element's [`ChromeText`]; if one comes back, paint it as a
//! single row in place of the element's own text, converting the
//! optional fg override into a paint `Style` here, where
//! `ComputedStyle` → `Style` conversion lives.
//!
//! The suppliers are the built-ins' `inline_chrome` adapters, gathered
//! into one table in `runtime::builtins::inline_chrome`. That table is
//! compiled in rather than registered per `Dom` because chrome must
//! paint for a bare `Dom<TuiExt>` that never went through `App::build`
//! — the paint pass's own tests, and any consumer driving `cascade` →
//! `layout_dom` → `paint_dom` by hand; a per-`Dom` registration would
//! silently drop the chrome for them. [`inline_chrome`] below is the
//! only place `render` names `runtime::builtins` for chrome.
use ;
use crateTuiExt;
use crateStyle;
use crateglyph_style_from_computed;
use crate;
/// What a built-in paints in place of an element's own text: the
/// single-row `text`, and optionally a foreground that overrides the
/// element's cascaded `color` (a `<meter>` outside its optimum zone).
/// `None` for `fg` keeps the cascade's fg.
pub
/// A built-in's chrome supplier: given an element and the single-row
/// width available to it, the text to paint instead of the element's
/// own text — or `None` when the element is not one of that
/// built-in's.
pub type InlineChromeFn = fn ;
/// The replacement text and its glyph style for `id`, or `None` when
/// no built-in substitutes chrome for it and the element paints its
/// own text. `width` is the single row the chrome may fill.
///
/// The style omits `bg` (`glyph_style_from_computed`): the element's
/// `fill_bg` already owns the cells' background.
pub