Update listMarkerTextForNodeAndPosition() to return a StringView instead of a String. listMarkerTextForNodeAndPosition() has a StringView internally and none it its call sites actually need a String. The call sites either use StringBuilder or want a NSString*. This avoids unnecessary String allocations.
<rdar://problem/91509602>
Created attachment 457129 [details] Patch
Comment on attachment 457129 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457129&action=review > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:684 > + [[attrString mutableString] appendString:text.createNSString().get()]; This could almost certainly be createNSStringWIthoutCopying() since mutable string functions take characters out of NSString objects, they don’t keep the NSString around.
(In reply to Darin Adler from comment #3) > Comment on attachment 457129 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=457129&action=review > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:684 > > + [[attrString mutableString] appendString:text.createNSString().get()]; > > This could almost certainly be createNSStringWIthoutCopying() since mutable > string functions take characters out of NSString objects, they don’t keep > the NSString around. Ok. The previous code was actually using a createNSStringWithoutCopying() but looking at the doc for appendString:, I couldn't convince myself that it was safe. I'll go back to a createNSStringWithoutCopying() then.
Created attachment 457217 [details] Patch
Committed r292693 (249485@main): <https://commits.webkit.org/249485@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 457217 [details].