Bug 264095

Summary: AX: Give user feedback while the isolated tree is being built.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: AccessibilityAssignee: Andres Gonzalez <andresg_22>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, 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
Patch none

Description Andres Gonzalez 2023-11-02 09:26:58 PDT
Especially needed for large pages where building the isolated tree can take several seconds.
Comment 1 Radar WebKit Bug Importer 2023-11-02 09:27:08 PDT
<rdar://problem/117857438>
Comment 2 Andres Gonzalez 2023-11-02 11:41:06 PDT
Created attachment 468462 [details]
Patch
Comment 3 Andres Gonzalez 2023-11-03 06:35:17 PDT
Created attachment 468468 [details]
Patch
Comment 4 Tyler Wilcock 2023-11-03 10:27:36 PDT
Comment on attachment 468468 [details]
Patch

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

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:-155
> -    tree->updatingSubtree(nullptr);

Is this removing the only place we set updatingSubtree to nullptr?

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:181
> +    String percent = String::number(percentComplete) + "%"_s;
> +    String title = AXProcessingPage() + " "_s + percent;

I think using makeString will be more efficient here (less String allocations).

String title = makeString(AXProcessingPage(), " ", percentComplete, "%");

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:190
> +            { AXPropertyName::TitleAttributeValue, title },

I think we can WTFMove(title) here.

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:389
> +    double i = 0;

Is there a more descriptive name that could be used? appendsResolved? Something else?

> Source/WebCore/platform/LocalizedStrings.cpp:955
> +    return WEB_UI_STRING("Processing page", "Title for the webarea while accessibility isolated tree is being built.");

I think this note:

"Title for the webarea while accessibility isolated tree is being built."

is only used but folks doing localization, who might not know what "isolated tree" is (and probably don't need to). Maybe we just call it the accessibility tree?
Comment 5 Andres Gonzalez 2023-11-03 14:22:19 PDT
Created attachment 468477 [details]
Patch
Comment 6 Andres Gonzalez 2023-11-03 14:37:19 PDT
(In reply to Tyler Wilcock from comment #4)
> Comment on attachment 468468 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=468468&action=review
> 
> > Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:-155
> > -    tree->updatingSubtree(nullptr);
> 
> Is this removing the only place we set updatingSubtree to nullptr?

AG: At the moment, this was superfluous, it was always null for a full tree. The only time it is not null is for the empty content tree, and for that tree it remains not null until the tree is destroyed. This will have a role when we implement some sort of feedback during updates of isolated subtrees or to avoid processing notifications while a subtree is being re-built.
> 
> > Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:181
> > +    String percent = String::number(percentComplete) + "%"_s;
> > +    String title = AXProcessingPage() + " "_s + percent;
> 
> I think using makeString will be more efficient here (less String
> allocations).
> 
> String title = makeString(AXProcessingPage(), " ", percentComplete, "%");

AG: we need both Strings, the percent and the title since they are used for different purposes. Also makeString and the operator+ resolve to invoking the same method tryMakeString in StringConcatenate.h, so I don't think there is significant advantage of one over the other performance wise, and + is a lot more readable.
> 
> > Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:190
> > +            { AXPropertyName::TitleAttributeValue, title },
> 
> I think we can WTFMove(title) here.


Fixed.
> 
> > Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:389
> > +    double i = 0;
> 
> Is there a more descriptive name that could be used? appendsResolved?
> Something else?

counter since that's what it is.
> 
> > Source/WebCore/platform/LocalizedStrings.cpp:955
> > +    return WEB_UI_STRING("Processing page", "Title for the webarea while accessibility isolated tree is being built.");
> 
> I think this note:
> 
> "Title for the webarea while accessibility isolated tree is being built."
> 
> is only used but folks doing localization, who might not know what "isolated
> tree" is (and probably don't need to). Maybe we just call it the
> accessibility tree?

Removed "isolated" and left it as "accessibility tree".
Comment 7 EWS 2023-11-06 11:28:46 PST
Committed 270280@main (16714dac0820): <https://commits.webkit.org/270280@main>

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