Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ca6a02d5b6ab91a124a8b4c11b837b42b3250a3
      
https://github.com/WebKit/WebKit/commit/9ca6a02d5b6ab91a124a8b4c11b837b42b3250a3
  Author: Tyler Wilcock <tyle...@apple.com>
  Date:   2025-05-22 (Thu, 22 May 2025)

  Changed paths:
    A LayoutTests/accessibility/mac/text-marker-ordering-expected.txt
    A LayoutTests/accessibility/mac/text-marker-ordering.html
    M LayoutTests/platform/mac-wk1/TestExpectations
    M Source/WebCore/accessibility/AXCoreObject.cpp
    M Source/WebCore/accessibility/AXCoreObject.h
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AXTextMarker.h
    M Source/WebCore/accessibility/AccessibilityObject.h
    M Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm

  Log Message:
  -----------
  AX: AXTextMarker::partialOrderByTraversal is extremely slow on large webpages
https://bugs.webkit.org/show_bug.cgi?id=293257
rdar://151648013

Reviewed by Joshua Hoffman.

When holding VO-Right on html.spec.whatwg.org for 120 seconds, 48.6 seconds are 
spent in AXTextMarker::partialOrderByTraversal.
This commit replaces that function with a new one: 
AXTextMarker::partialOrderByAncestry. This function walks up and keeps
track of the ancestry for the |this| and |other| text markers. When we find a 
shared ancestor, we get the next-most
recent ancestor (which will be different for each), and determine what 
child-index it is in the shared ancestor. This
gets us the same information, much faster.

The old method took 48.6 seconds to process 1800 order-comparisons on 
html.spec.whatwg.org. The new one takes 4.4ms.

This is also faster in the case of simpler, more common webpages:

YouTube: 0.45ms vs 18.2ms for 237 comparisons
Wikipedia: 3.8ms vs. 18.7ms for 270 comparisons

Behavior covered by existing tests, and new test. I also did manual testing on 
html.spec.whatwg.org, YouTube, and Wikipedia where
I RELEASE_ASSERT'd that the new function computed the same thing as the old 
one, and did not find any divergent cases.

* LayoutTests/accessibility/mac/text-marker-ordering-expected.txt: Added.
* LayoutTests/accessibility/mac/text-marker-ordering.html: Added.
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WebCore/accessibility/AXCoreObject.cpp:
(WebCore::AXCoreObject::partialOrder):
* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::operator<=>):
(WebCore::AXTextMarker::partialOrderByTraversal const): Deleted.
* Source/WebCore/accessibility/AXTextMarker.h:
(WebCore::AXTextMarker::findLast const):
* Source/WebCore/accessibility/AccessibilityObject.h:
* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::textMarkerRange const):

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



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

Reply via email to