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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! Flex-specific `border-collapse: collapse` rules.
//!
//! Two places in a flex line depend on the table-cell border model
//! and must agree with each other:
//!
//! - the **parent-edge inset** applied to the container before any
//! distribution, so a borderless first / last child does not land
//! on the parent's painted border row; and
//! - the **one-cell sibling overlap** between adjacent bordered items,
//! which the sizing budget reclaims up front and the placement
//! cursor pulls back per pair (BORDER-MODEL-1 gap-honoring rule).
//!
//! The per-edge border predicates themselves live in
//! [`super::super::border_collapse`]; this module only decides when
//! and where they apply along a flex line.
use ;
use crateTuiExt;
use crate;
use crate;
use crateComputedStyle;
/// Shrink `container` by the parent-child border-collapse inset.
///
/// Under `border-collapse: collapse`, `compute_content_area_collapsed`
/// flattens the parent's content area to its outer rect — children's
/// outer rects then extend into the parent's border ring (so a
/// bordered child's first cell coincides with the parent's first
/// border cell, sharing one paint surface — the table-cell model).
///
/// That sharing is only correct when the first/last child ACTUALLY
/// HAS A BORDER to share. If the first child is content-bearing
/// (no own border), its content would land on the parent's painted
/// border row and disappear under the border glyph. Surfaced
/// visually by the showcase chrome: `<header>` inside an `<app>`
/// with collapse + own border had its `<h1>` text painted at the
/// shared border row.
///
/// Per-edge fix: if the first child along the main axis has no
/// border, push that edge's start back by 1 so the first child's
/// content area sits below the parent's border row. Same for the
/// last child along the main axis. Cross-axis insets follow the
/// same logic. Pre-scan one element child each direction; correct
/// for the common case (table cells vs. content-bearing chrome
/// panels) without touching `compute_content_area_collapsed`.
pub
/// Whether adjacent bordered siblings on this line share one cell on
/// their meeting edge, and which edges meet.
///
/// Under `border-collapse: collapse`, each pair of adjacent
/// bordered siblings shares one cell on their meeting edge. The
/// cursor advance subtracts 1 per overlap (see the placement
/// loop), but flex sizing needs to know up-front so the
/// grow distribution uses ALL the available cells — otherwise
/// the saved cells appear as empty space at the parent's right
/// / bottom edge.
///
/// **BORDER-MODEL-1 gap-honoring rule.** When the author writes
/// `gap > 0`, the gap is sacred: it produces a visible cell
/// between siblings and there is nothing adjacent to merge. So
/// the overlap only fires when `gap == 0` AND the parent
/// declares `collapse`. With `gap > 0`, the gap and collapse
/// coexist orthogonally — `collapse` becomes a no-op for that
/// sibling pair. Documented as the 2×2 outcome grid in
/// `DIVERGENCES.md`.
pub