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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// SPDX-FileCopyrightText: Copyright (c) 2026 Mike Li/Mikewolfli/Wei Li(mikewolfli@163.com)
// SPDX-License-Identifier: MIT
//! Custom drawing trait for widgets that want to render their own content.
use crate;
use crateRenderContext;
/// Strokes a control's **surface** border, following the same corner radii as its fill.
///
/// # Why this exists
///
/// A field that fills itself with `border_radius` but strokes a square outline leaves the four
/// corners showing the backdrop between the rounded fill and the square rule — the "corners have no
/// line" defect. Every control that paints a themed surface goes through this one call, so the fill
/// and the outline cannot disagree about the shape again.
///
/// An all-zero radius keeps the historical square call (including its 1 px `draw_rect` form); any
/// non-zero radius strokes a rounded rectangle with the same width — per corner since STY-01, so a
/// non-uniform fill shape gets the matching outline instead of a silently square one.
pub
/// Resolves the tail of the documented border ladder into the colour a dialog's frame is
/// stroked with.
///
/// The documented precedence is "explicit style → theme style → theme palette → literal"
/// (the "Semantics are unchanged" section of `container_widgets/theme_snapshot.rs`'s module
/// docs). The theme half of the ladder differs per control — most dialogs look up a resolved
/// widget style, the progress dialog reads the palette's `outline` token — so the caller
/// performs its own one-line lookup and passes both resolved rungs in; this helper owns the
/// shared tail. A resolved border equal to the `surface` would paint the frame
/// indistinguishable from its fill, so it is discarded, and the literal rung derives one
/// visible step away from the surface: a 45% blend toward `ink`.
///
/// # Drift
///
/// Hand copies of this ladder have drifted: `find_replace_dialog` blends 0.25, `popover` and
/// the sheet/popup family blend 0.35, and `alert_dialogs`/`file_dialog`/`font_dialog` fall
/// back to a literal without the surface-equality filter. They keep their behaviour until a
/// dedicated pass migrates them; this form is the canonical 0.45 ladder the dialogs agree on.
/// The shared tail of the border-colour ladder (theme_snapshot.rs:23-26).
///
/// `explicit border → themed border → (≠ surface) → surface-blend ink`. The five dialog
/// surfaces that hand-copied this ladder converged here; the blend step is the ladder's
/// 0.45 contrast tone. Callers resolve their own theme half because it differs per site.
/// `full_widgets`-gated: every caller is a dialog, and the stripped profiles compile
/// neither them nor this helper.
pub
/// Custom drawing trait for widgets that want to render their own content.
/// Widgets implementing this trait can provide custom drawing logic instead of
/// relying solely on platform rendering.