Frontier
Caret geometry at boundaries between inline text and atomic blocks.
The frontier is the visual boundary between an inline paragraph and an adjacent atomic block (media, etc.) that shares the same visual row. Caret measurement at the frontier cannot use the paragraph's last text run alone, because the paragraph ends before the visual frontier.
Behavior
The caret is measured at the visual frontier when the engine selection sits at a position that is textually at the end of a block but visually adjacent to an atomic neighbor on the same row:
- If the paragraph is on the same visual row as its atomic neighbor, the caret x-coordinate is the right edge of the paragraph's last rect.
- Otherwise, fall back to text-run measurement.
Overlap is computed as rect.top < other.bottom && other.top < rect.bottom.
Cases covered
- Empty paragraph on a shared row with a media block.
- Non-empty paragraph inline with an adjacent media block on the same row.
- Paragraph followed by a row-break div.
Implementation
Frontier resolution lives in packages/dom/src/frontier/ (measure.ts, and supporting modules) and is consumed by the selection overlay's measureFrontierCaretPosition path in selection-overlay/caret-measurement.ts. Runtime projection of inter-row paragraph breaks lives in runtime/runtime-media-projection.ts (projectRuntimeInterRowBreaks) and is coordinated by the runtime.