Bug 228336

Summary: Fix for [WebAccessibilityObjectWrapper lineRectsAndText] to properly handle replacement nodes and SVG text.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: AccessibilityAssignee: Andres Gonzalez <andresg_22>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, darin, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Andres Gonzalez 2021-07-27 11:13:19 PDT
Fix for [WebAccessibilityObjectWrapper lineRectsAndText] to properly handle replacement nodes and SVG text.
Comment 1 Radar WebKit Bug Importer 2021-07-27 11:13:32 PDT
<rdar://problem/81172124>
Comment 2 Andres Gonzalez 2021-07-27 11:34:06 PDT
Created attachment 434300 [details]
Patch
Comment 3 Darin Adler 2021-07-27 13:49:19 PDT
Comment on attachment 434300 [details]
Patch

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

> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:2881
> +                [text appendAttributedString:[[NSAttributedString alloc] initWithString:label]];

This isn’t ARC, so I think the leaks the attributed string. Need to release it.
Comment 4 Andres Gonzalez 2021-07-28 17:29:07 PDT
Created attachment 434479 [details]
Patch
Comment 5 Andres Gonzalez 2021-07-28 17:52:59 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 434300 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434300&action=review
> 
> > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:2881
> > +                [text appendAttributedString:[[NSAttributedString alloc] initWithString:label]];
> 
> This isn’t ARC, so I think the leaks the attributed string. Need to release
> it.

Thanks, I changed it to:

                auto label = adoptNS([[NSAttributedString alloc] initWithString:static_cast<WebAccessibilityObjectWrapper *>(item).accessibilityLabel]);
                [text appendAttributedString:label.get()];
Comment 6 Andres Gonzalez 2021-07-30 12:41:55 PDT
Created attachment 434653 [details]
Patch
Comment 7 Andres Gonzalez 2021-07-31 13:59:49 PDT
Created attachment 434705 [details]
Patch
Comment 8 EWS 2021-08-02 07:43:21 PDT
Committed r280529 (240161@main): <https://commits.webkit.org/240161@main>

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