Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 60d1179d23a0bec425606c2c8da5d22f6a64ddc4
      
https://github.com/WebKit/WebKit/commit/60d1179d23a0bec425606c2c8da5d22f6a64ddc4
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-09-06 (Sun, 06 Sep 2026)

  Changed paths:
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp

  Log Message:
  -----------
  AX: textRuns() unnecessarily recomputes the same elementRect() repeatedly, 
once per line, accruing samples on Speedometer
https://bugs.webkit.org/show_bug.cgi?id=323522
rdar://186765403

Reviewed by Chris Fleizach.

AccessibilityRenderObject::textRuns() computes distanceFromBoundsInDirection 
for the
first text box on each line. Two of the three terms in it -- the containing 
block's
absolute position and this object's element rect -- are properties of the 
renderer, so
they're identical for every line, but both were computed inside the per-line 
branch.

Hoist them out and compute them at most once per textRuns() call. This is done 
lazily
rather than up front so renderers that turn out to have no text boxes don't pay 
for
them at all.

A profile of Speedometer 3.1 with VoiceOver enabled attributes 228 samples to 
these
two calls under textRuns() (190 elementRect, 38 absoluteBoundingBoxRect). A 
synthetic
isolated-tree build over deliberately wrap-heavy content (WebKitTestRunner with
--accessibility-isolated-tree, narrow column, ~1000 multi-line paragraphs) goes 
from a
median 224ms to 160ms, a 28% reduction, with non-overlapping run ranges.

* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textRuns):

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



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

Reply via email to