Skip to content

macOS engine: the focus route's caret scan searches a field's character boxes by line, then x, instead of linearly #290

Closed

Description

@SSFSKIM

Problem & intent

#283's focus route places the caret at a background Chrome text field's clicked point by scanning the field's character boxes (AXBoundsForRange {i, 1}) linearly for the one that holds the point. AXVisibleCharacterRange does not narrow the scan: Chrome for Testing 156 answers the whole text even when the field is scrolled. On #283's hosted probe (run 42150236590), a 3,074-character textarea took 165-185 ms for a full linear scan (1,538 calls, 72-104 ms to a mid-field match). Fields over caretScanLimit (5,000 characters) are not scanned at all: the click answers focusedNotPlaced (caret pointOutsideText).

Intent. Replace the linear scan with a search over the boxes in reading order: a binary search on the line (box y), then on x within the line. The probe's prototype found offset 1537 in 12 calls (under 1 ms). Then raise or drop the 5,000-character limit.

Constraints

Success criteria

  • Unit tests over synthetic box layouts: wrapped lines, empty lines, runs of empty boxes, failed reads, and a 20,000-character field. The search answers the same offset as the linear scan wherever the linear one answers.
  • A hosted probe re-measurement on the long textarea (the probe/283-hosted kit's long-* cells) with the call count and time.

Sources

Activity

  1. added
    enhancement
    status:ready-for-implementer
    priority:P3
    status:in-progress
    and removed
    status:ready-for-implementer
    on Nov 6, 2026
  2. added
    status:in-review
    and removed
    status:in-progress
    on Nov 9, 2026
  3. SSFSKIM commented on Nov 9, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-review: PR #342: caret search by line then x; review clean after 4 rounds; ci-gate green

  4. removed
    status:in-review
    on Nov 9, 2026
  5. SSFSKIM commented on Nov 9, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Landed via PR #342 (0.27.19)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:P3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions