Bug 269628

Summary: AX: Update cached text runs when line layout changes
Product: WebKit Reporter: Joshua Hoffman <jhoffman23>
Component: AccessibilityAssignee: Joshua Hoffman <jhoffman23>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, changseok, dmazzoni, esprehn+autocc, ews-watchlist, glenn, jcraig, kondapallykalyan, pdr, samuel_white, tyler_w, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Joshua Hoffman 2024-02-16 16:48:37 PST
We don't update cached text runs when they change at present.
Comment 1 Radar WebKit Bug Importer 2024-02-16 16:48:47 PST
<rdar://problem/123122761>
Comment 2 Joshua Hoffman 2024-02-16 17:06:00 PST
Created attachment 469939 [details]
Patch
Comment 3 Tyler Wilcock 2024-02-17 13:53:24 PST
Comment on attachment 469939 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=469939&action=review

> COMMIT_MESSAGE:17
> +* LayoutTests/accessibility/ax-thread-text-apis/changing-text-runs.html: Added.

I wonder if something like "dynamic-text-line-wrapping.html" would be a better name. I imagine we'll want to add lots more tests where we dynamically change the underlying text runs data structure and test the result, which would make the current name of this test confusing.

> Source/WebCore/accessibility/AXObjectCache.h:221
> +    void onTextRunsChanged(RenderObject&);

Can this be const RenderObject&?

> Source/WebCore/rendering/RenderBlockFlow.cpp:4042
> +        if (auto* axObjectCache = document().axObjectCache())

This should use Document::existingAXObjectCache() instead of axObjectCache(). The latter creates a cache if one doesn't already exist, which is probably not what we want here?

Maybe just `cache` instead of `axObjectCache`?

> LayoutTests/accessibility/ax-thread-text-apis/changing-text-runs.html:9
> +<p id="line" style="word-break: break-word;">Hello world.</p>

Maybe id="paragraph"?

> LayoutTests/accessibility/ax-thread-text-apis/changing-text-runs.html:12
> +<script>
> +    var output = "This tests that text runs are updated when a container is resized and text wraps.\n";

Everything inside the script tag can be indented one less level.
Comment 4 Joshua Hoffman 2024-02-19 09:20:02 PST
Comment on attachment 469939 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=469939&action=review

>> COMMIT_MESSAGE:17
>> +* LayoutTests/accessibility/ax-thread-text-apis/changing-text-runs.html: Added.
> 
> I wonder if something like "dynamic-text-line-wrapping.html" would be a better name. I imagine we'll want to add lots more tests where we dynamically change the underlying text runs data structure and test the result, which would make the current name of this test confusing.

Good point, will update that.
Comment 5 Joshua Hoffman 2024-02-19 10:03:43 PST
Created attachment 469966 [details]
Patch
Comment 6 EWS 2024-02-19 14:33:22 PST
Committed 274999@main (ed2bfb346eb5): <https://commits.webkit.org/274999@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 469966 [details].