Skip to content

INL2a 1/2: atomic inlines in the layout engine (inline-block, inline-flex) - #112

Open
thejackshelton wants to merge 3 commits into
review/tdec-a2-v2from
inl2a-engine-v2
Open

thejackshelton wants to merge 3 commits into
review/tdec-a2-v2from
inl2a-engine-v2

Conversation

@thejackshelton

Copy link
Copy Markdown
Contributor

INL2a part 1 of 2 (T059, notes/T044-inl-spec.md R1-R8, notes/T059J-inl2.md): the layout engine for atomic inlines (inline-block and inline-flex). This is the INL2 chain restacked onto the v2 text stack: inl2a-engine → inl2 → txt2a-engine → txt2a → inl2b, as -v2 branches. The originals are untouched.

Base: review/tdec-a2-v2, a copy of tdec-a2-v2 7b99e3a, the top of the text-stack chain. This PR lands after the text-stack train.

What changed

  • Engine (packages/layout), cherry-picked from inl2a-engine 62cad4640f:
    • An inline-block or inline-flex box is a LayoutBox among a block container's inline-level children.
    • inline-box.ts lays it out at its shrink-to-fit width (CSS2 §10.3.9), with its margin box as its advance.
    • Its baseline is the last line box's for inline-block (the bottom margin edge when there is none, or for a scroll container), and the first baseline for inline-flex.
    • inline.ts puts it in the break text as U+FFFC with a soft wrap opportunity on each side, places it on its line, and counts its min- and max-content contributions.
    • block.ts carries the last baseline through block children.
  • Refused, with typed codes: an atomic inline beside text in a face other than Ahem, rtl without a letter on both sides, relative positioning, a percentage block size, and an atomic inline inside an inline box (validate.ts).
  • Six engine plants. The engine-inline differential suite appends 1500 atomic contexts after INL1a's 3000. inline-atomic.test.ts compares the 16 family-5 cases with Chrome at DPR 1, 2, 3 and 2.625, in ltr and rtl.
  • Merge with the new base (intent-based):
    • REPL-a's block-level replaced boxes are now in the base. A replaced child gives an inline-block no last baseline, because it has no line boxes. The block.ts and flex.ts replaced paths set lastBaseline: null.
    • inlineChildren still rejects a replaced box beside inline content.
    • validate.ts checks for an atomic inline first, then applies the base's isInlineLevel block-in-inline rule.
  • docs/ports.json (the port registry from PORT-0: Chrome port registry (docs/ports.json), its test, and generated THIRD_PARTY_NOTICES.md #52 postdates the old base), with notices regenerated by pnpm notices:gen:
    • block_layout_algorithm.cc, flex_layout_algorithm.cc and line_breaker.cc gain their Dragon references;
    • physical_box_fragment.h, inline_items_builder.cc and logical_line_builder.cc are new BSD reference entries.
  • Changed test: corpus-dpr.test's engine-inline count is derived from INLINE_SPEC, now 3000 plus the atomic contexts. The base's text-latin count is kept.

What passed

  • pnpm regen: fixed point after 2 passes. The output commit covers the translated engine, corpus-dpr.json, host lanes and profiles.
  • pnpm typecheck: clean.
  • pnpm test (heavy lease, on a loaded machine): 178 files; 3723 passed, 39 failed and 1 skipped.
    • 7 in chrome-ports: the missing registry entries, fixed in 6518c6f. The file now passes 13/13.
    • Device step pending: lanes, lanes-records, lanes-concurrent, device-failures and p6a-promotion. lanes.json is host-only, and the device run happens in the train.
    • The rest were load timeouts. All pass on rerun; inline.test passes 12/12 when run alone.
  • North star: unchanged by this PR, because the engine alone changes no compiler output. The INL2 delta is reported on the inl2 PR.
  • Macroscope is at its spending limit, so this PR relies on CI.

🤖 Generated with Claude Code

An inline-block or inline-flex box is a LayoutBox among a block container's inline-level children (input.ts: the Display union only).
inline-box.ts lays it out as its block-level equivalent at its shrink-to-fit width (CSS2 §10.3.9), with its margin box as its
advance and its line height contribution; its baseline is the last line box's for inline-block (the bottom margin edge with none,
or for a scroll container) and the flex container's first baseline for inline-flex (Blink 145, INL-P family 5). inline.ts puts it
in the break text as U+FFFC with a soft wrap opportunity before and after it, places it on its line, and counts its min- and
max-content contributions; block.ts carries the last baseline through block children (a scroll container child gives its bottom
margin edge; a flex child's last baseline is refused as flex-baseline). Refused with typed codes: an atomic inline beside text in a
face other than Ahem (atomic-beside-shaped-text, INL2c), in rtl without a letter on both sides in its paragraph (bidi-neutral),
relatively positioned (inline-box-position), or with a percentage block size (percent-height-flex); validate.ts refuses one inside
an inline box (atomic-in-inline-box). Six engine plants: inlineBlockFirstBaseline, overflowBaselineIgnored, inlineFlexLastBaseline,
atomicMarginExcluded, noBreakAroundAtomic, atomicShrinkToFitIgnored. The engine-inline differential suite appends 1500 generated
atomic contexts after INL1a's 3000 (their inputs unchanged). test/inline-atomic.test.ts compares the 16 family 5 cases without
vertical-align with Chrome at DPR 1, 2, 3 and 2.625 in ltr and rtl, and each plant against them.

(cherry picked from commit 62cad4640fa48dfb8ad466071a6421f9aeba8b46)
…se.sh pnpm regen (fixed point after 2 passes): the translated engine, corpus-dpr.json, lanes.json host lanes and the profiles
…52, after this branch's old base): block_layout_algorithm.cc, flex_layout_algorithm.cc and line_breaker.cc gain their Dragon references; physical_box_fragment.h, inline_items_builder.cc and logical_line_builder.cc are new BSD reference entries; pnpm notices:gen

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant