Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d8184230a66a6f34ff32f0bcbbb6318a60231b14
      
https://github.com/WebKit/WebKit/commit/d8184230a66a6f34ff32f0bcbbb6318a60231b14
  Author: Tyler Wilcock <[email protected]>
  Date:   2025-05-27 (Tue, 27 May 2025)

  Changed paths:
    A LayoutTests/accessibility/editable-svg-arrow-movement-expected.txt
    A LayoutTests/accessibility/editable-svg-arrow-movement.html
    M Source/WebCore/accessibility/AXObjectCache.cpp

  Log Message:
  -----------
  AX: AXObjectCache::characterOffsetFromVisiblePosition iterates over the 
result of VisiblePosition::canonicalPosition(const Position&), which can return 
previous positions, resulting in infinite loops
https://bugs.webkit.org/show_bug.cgi?id=293619
rdar://152094332

Reviewed by Joshua Hoffman.

Over time, we've added various attempts to catch infinite loops in 
AXObjectCache::characterOffsetFromVisiblePosition
that result from getting the "next" position actually returning previous 
positions, thus resulting in us looping forever.

This commit removes all of these workarounds, and eliminates the root cause for 
getting any previous positions in the
first place. This happened because we maintained `currentPosition` by 
constructing a `VisiblePosition` from the
`nextVisuallyDistinctCandidate`, then extracting the `deepEquivalent` from the 
`VisiblePosition`. The problem with that
is that the VisiblePosition constructor calls `canonicalPosition` on the passed 
`Position`, which critically can return
a previous `Position`. When this happens, we will loop forever.

There is no code comment or layout test proving why we need to canonicalize the 
positions we use, so this commit stops
doing it. Instead, we solely loop over `nextVisuallyDistinctCandidate`, which 
should guarantee forward progress.

New test added that exhibited a full hang before this change.

* LayoutTests/accessibility/editable-svg-arrow-movement-expected.txt: Added.
* LayoutTests/accessibility/editable-svg-arrow-movement.html: Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::characterOffsetFromVisiblePosition):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to