Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: decb16d6f3dfca9cf72a1811849f257f1b6c4bc8
      
https://github.com/WebKit/WebKit/commit/decb16d6f3dfca9cf72a1811849f257f1b6c4bc8
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-04-15 (Wed, 15 Apr 2026)

  Changed paths:
    M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
    M Source/WebCore/accessibility/cocoa/AXTextMarkerCocoa.mm
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp

  Log Message:
  -----------
  AX: AXTextMarkerRange::toAttributedString does three unecessary allocations 
for every newline / tab it adds to the string
https://bugs.webkit.org/show_bug.cgi?id=312340
rdar://174801453

Reviewed by Joshua Hoffman.

Prior to this commit, AXTextMarkerRange::toAttributedString copied an 
attributes dictionary
and allocated an intermediate NSMutableAttributedString just to append exit 
characters (newlines / tabs).
Instead use replaceCharactersInRange:withString: with a zero-length range, 
which inherits attributes from
the preceding character, accomplishing the same thing.

Also remove other FIXMEs that are invalid:

  - treeID() needs to return an optional because it's a virtual function, and 
the main-thread can return std::nullopt.
  - Ellipsis-type boxes aren't actually constructed, so the FIXME in 
::stichGroups() was invalid.
  - AXIsolatedTree::updateChildren does need to copy out of the node-map, 
comment added explaining why.

* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::stitchGroups const):
* Source/WebCore/accessibility/cocoa/AXTextMarkerCocoa.mm:
(WebCore::AXTextMarkerRange::toAttributedString const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateChildren):

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



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

Reply via email to