test(runtime): pin absolute-child position to the padding box; fix wording

Addresses PR review: the containing block for an absolutely-positioned child
is the **padding box** (inside the borders), not the "border-box". Verified by
running yoga (an abs child at top:0/left:0 insets by the border only, never by
padding — confirmed across border/padding combos) and the real Ink/vue-tui
renderers (X lands at the inner-border edge, byte-identical in both).

- Tighten the regression test: exact-frame assertions instead of `toContain`,
  including a border+padding case that distinguishes the padding box from the
  content box — the assertion that would have caught the original wording slip
  (presence-only assertions could not).
- Correct "containing block (border-box)" -> "padding box (inside the borders)"
  in paint.ts, layout-guards.ts, and ink-divergences.md. (The unrelated
  "border-box-like" *sizing* notes are correct and left as-is.)

No runtime behavior change; the code already used yoga's computed position.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-09 11:32:19 +08:00
parent 54017cef0d
commit 1bd91dbbb9
4 changed files with 42 additions and 15 deletions
+3 -3
View File
@@ -410,9 +410,9 @@ different runtime behavior, ownership rule, or out-of-contract handling.
dimension is zero. Paint applies the same inner-content gate, so the in-flow child subtree
neither reserves invisible rows nor writes glyphs outside a nonexistent content area.
Border and background are still painted as far as the outer area permits.
**Absolutely-positioned children are exempt** — their region is the containing block
(border-box), not the content rect, so they still lay out and paint (clipped only by
`overflow:hidden`), matching Ink. Positive-size content areas keep the
**Absolutely-positioned children are exempt** — their containing block is the padding box
(inside the borders), not the content rect, so they still lay out and paint (clipped only
by `overflow:hidden`), matching Ink. Positive-size content areas keep the
existing overflow behavior; this is not a blanket `overflow:hidden`.
- **Layout model guidance:** primitive `Box` should preserve the Yoga/flexbox model rather
than paper over it with ad-hoc layout corrections. Defaults such as `flexShrink: 1` are