Commit ad56e35
authored
fix(webview): key the concealed fence gap offset on the gap border, not the language tag (#396)
* fix(webview): key the concealed fence gap offset on the gap border, not the language tag
A concealed fenced block with no language tag drew its copy button 4px ABOVE
the panel's painted top edge, hanging over the rounded corner. Its tagged twin
sat 4px inside.
The panel fill is `background-clip: padding-box`, so a visible open edge that
carries blockEdgeGapCorner's transparent --quoll-block-gap-y top border paints
its surface that far below its border box. In the revealed state the copy
button's anchor IS that bordered line, so `top: 0.3em` resolves against the
paint. In the concealed state the anchor is the zero-height
`.quoll-fenced-code-fence-hidden` row, which sits at the border box's top and
has no border of its own — the same `top` resolves against a datum 8px too
high. The rule that adds the gap back existed, but it was gated on the NEXT
line being a `-has-language` header, and its comment declared bare blocks
deliberately untouched.
The language tag was never what asked for the offset — the gap border is, and
a bare block's panel carries exactly the same one. The gate had simply frozen
an attribute that happened to correlate while the header bar (a tagged-only
feature) was being built.
Widening it also fixes a second miss on the same axis: block-style suppresses
the fenced `-outer-open` inside a blockquote and lets `quoll-blockquote-outer-open`
supply the identical border instead, so blockquote-nested blocks were
uncorrected too — tagged ones included. `concealedGapAnchor` now spells both
sources as a selector LIST, which cannot double-count: the two classes are
mutually exclusive on a fenced open edge, and two matching branches still apply
one declaration.
Measured in the real-browser harness across bare/tagged x concealed/revealed x
top-level/blockquote/list/bodyless, plus a directly-adjacent pair (whose second
block correctly needs no offset because it yields its `-outer-open`). Every
state now lands 4px inside the paint; the already-correct ones did not move.
* docs(theme): clarify concealed-gap re-add rule count in comment
The intro comment above fencedHeaderBarThemeSpec's "Conceal/reveal
geometry" paragraph said "two :has(+ …) / descendant rules" re-add the
alignment offsets, but the spec actually has three: two independent
`:has(+ …)` selector lists from concealedGapAnchor (one per control —
copy button, label) for the vertical gap-y offset, plus one descendant
rule for the label's horizontal column inset. The undercount predates
this PR; this PR only touched the paragraph while generalizing
concealedGapAnchor to take a control argument, so resolve the
pre-existing ambiguity while the comment is already being edited.
Comment-only change, no selectors or behaviour touched.
* refactor(test): drop a no-op cast and a dead field from the header-bar pins
paintedPanelTop's `lines[i] as HTMLElement` restated a type the array
already has, and the cases array declared an `expected?: number` field
no case ever set and no assertion ever read — the band comes from the
module-level EXPECTED_INSET / TOLERANCE. Both are cosmetic; no assertion,
statement, or selector changed.
* test(webview): drop leftover no-op cast in fenced-header-bar test
insets[0] is already typed number (copyInsets returns number[], and
noUncheckedIndexedAccess is not enabled in any tsconfig), so the
'as number' cast at line 208 was a no-op. Cycle 1 refactor commit
b46e98e removed the same-shape cast at line 146 but missed this one.
Consistency cleanup, not a correctness fix.1 parent 8dd69a1 commit ad56e35
3 files changed
Lines changed: 195 additions & 26 deletions
File tree
- src/webview/cm
- test
- webview-browser
- webview/fenced-code
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1008 | 1008 | | |
1009 | 1009 | | |
1010 | 1010 | | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1018 | 1060 | | |
1019 | 1061 | | |
1020 | 1062 | | |
| |||
1127 | 1169 | | |
1128 | 1170 | | |
1129 | 1171 | | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
| 1172 | + | |
| 1173 | + | |
1134 | 1174 | | |
1135 | 1175 | | |
1136 | 1176 | | |
1137 | 1177 | | |
1138 | 1178 | | |
1139 | 1179 | | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
1148 | 1186 | | |
1149 | 1187 | | |
1150 | 1188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
| |||
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
Lines changed: 32 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
550 | 575 | | |
551 | 576 | | |
552 | 577 | | |
| |||
0 commit comments