Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d843c238e992864a057149c5a14c0c191629b4b6
      
https://github.com/WebKit/WebKit/commit/d843c238e992864a057149c5a14c0c191629b4b6
  Author: Chinh Tran <[email protected]>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    A 
LayoutTests/accessibility/mac/bounds-for-range-on-stitched-text-expected.txt
    A LayoutTests/accessibility/mac/bounds-for-range-on-stitched-text.html
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/cocoa/AXCoreObjectCocoa.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AXBoundsForRange returns incorrect bounds after inline boundaries in stitched 
accessibility text
https://bugs.webkit.org/show_bug.cgi?id=323121
rdar://186383833

Reviewed by Tyler Wilcock.

With Accessibility Text Stitching enabled, a line of inline text is merged into
one AXStaticText (the stitch-group representative), whose value is the
concatenation of all its members. AXBoundsForRange returned correct bounds only
for offsets inside the first run: any range past the first inline boundary
collapsed to a ~2px sliver at the end of that run. This misplaced marks that an
assistive technology draws over text ranges, such as spell-check underlines.

The offset was being scoped to the representative's own node instead of the full
stitched value. Fix both accessibility paths:

Main thread: for a representative, resolve the offsets against simpleRange()
(the whole stitched text) instead of visiblePositionForIndex, which clamps the
offset to the representative's own node.

Isolated tree: let the NSRange-to-marker walk cross every member by stopping
past the block-flow ancestor (a stitch group never crosses its block flow), and
clamp the offsets to the stitched length so the walk cannot escape into content
after the group. When turning a marker range into a rect, take a
representative's own run width from localRect rather than its union frame. Also
start the multi-object accumulation loop at the object after the start object, 
so
the bounds do not incorrectly include text before the requested start offset.

* Source/WebCore/accessibility/AXTextMarker.cpp:
(viewportRelativeFrameFromRuns):
(WebCore::AXTextMarkerRange::viewportRelativeFrame const):
* Source/WebCore/accessibility/cocoa/AXCoreObjectCocoa.mm:
(WebCore::Accessibility::markerRangeFrom):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper computeTextBoundsForRange:backingObject:]):
* LayoutTests/accessibility/mac/bounds-for-range-on-stitched-text.html: Added.
* LayoutTests/accessibility/mac/bounds-for-range-on-stitched-text-expected.txt: 
Added.

Canonical link: https://commits.webkit.org/320653@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to