Bug 252193 - AX: Move the AttributedString for TextMarkerRange functionality out of the Mac wrapper into the AXCoreObject implementation so that it can be cached in isolated tree mode.
Summary: AX: Move the AttributedString for TextMarkerRange functionality out of the Ma...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks: 256347
  Show dependency treegraph
 
Reported: 2023-02-13 14:11 PST by Andres Gonzalez
Modified: 2023-05-04 20:11 PDT (History)
11 users (show)

See Also:


Attachments
Patch (63.14 KB, patch)
2023-02-13 19:40 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (93.81 KB, patch)
2023-02-17 12:45 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (94.87 KB, patch)
2023-02-17 14:48 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (94.87 KB, patch)
2023-02-23 20:05 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Gonzalez 2023-02-13 14:11:52 PST
Add it to the AXCoreObject interface and provide a common implementation for Mac and iOS.
Comment 1 Radar WebKit Bug Importer 2023-02-13 14:18:32 PST
<rdar://problem/105416277>
Comment 2 Andres Gonzalez 2023-02-13 19:40:56 PST
Created attachment 464979 [details]
Patch
Comment 3 Tyler Wilcock 2023-02-13 19:59:46 PST
Comment on attachment 464979 [details]
Patch

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

> Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:2
> + * Copyright (C) 2019 Apple Inc. All rights reserved.

I know this is largely a copy-paste, but might as well update the copyright year to 2023 since we're adding this new file.

> Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:43
> +PlainTextRange::PlainTextRange(NSRange r)

I think WebKit coding style doesn't allow for shortening variable names (so this should probably be `range` rather than `r`).
Comment 4 Tyler Wilcock 2023-02-13 20:01:54 PST
Comment on attachment 464979 [details]
Patch

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

> COMMIT_MESSAGE:1
> +AX: Move the AttributedString for TextMarkerRange functionality out of the Mac wrapper into the AX objet implementation so that
 it can be cached in isolated tree mode.
 

Typo — "AX objet"
Comment 5 Andres Gonzalez 2023-02-14 06:00:36 PST
(In reply to Tyler Wilcock from comment #3)
> Comment on attachment 464979 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=464979&action=review
> 
> > Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:2
> > + * Copyright (C) 2019 Apple Inc. All rights reserved.
> 
> I know this is largely a copy-paste, but might as well update the copyright
> year to 2023 since we're adding this new file.

It is not a new file, it was mac/AccessibilityObjectMac.mm and now is cocoa/AccessibilityObjectCocoa.mm (with additions), but git refuses to think so despite using git mv ... Changed the copyright year nevertheless, although I'm not sure what the policy is regarding file renames + additions.
> 
> > Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:43
> > +PlainTextRange::PlainTextRange(NSRange r)
> 
> I think WebKit coding style doesn't allow for shortening variable names (so
> this should probably be `range` rather than `r`).

Fixed, this is part of the old content of the file.
Comment 6 Andres Gonzalez 2023-02-14 06:01:44 PST
(In reply to Tyler Wilcock from comment #4)
> Comment on attachment 464979 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=464979&action=review
> 
> > COMMIT_MESSAGE:1
> > +AX: Move the AttributedString for TextMarkerRange functionality out of the Mac wrapper into the AX objet implementation so that
>  it can be cached in isolated tree mode.
>  
> 
> Typo — "AX objet"

Fixed, AXCoreObject to be precise.
Comment 7 Andres Gonzalez 2023-02-17 12:45:23 PST
Created attachment 465059 [details]
Patch
Comment 8 Andres Gonzalez 2023-02-17 14:48:05 PST
Created attachment 465061 [details]
Patch

Fixes merge problems.
Comment 9 Tyler Wilcock 2023-02-20 11:25:22 PST
Comment on attachment 465061 [details]
Patch

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

Looks like your patch message is missing the block listing modified files.

> COMMIT_MESSAGE:11
> +- Lots of code cleanup and strenghening.

Typo — strenghening should be strengthening.

> Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm:203
> +    auto matchFunc = [] (const AXCoreObject& axObject) {

Can this be typed as const AccessibilityObject&?

> Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm:207
> +    if (const auto* parent = Accessibility::findAncestor<AXCoreObject>(*object, true, WTFMove(matchFunc)))

Can this be Accessibility::findAncestor<AccessibilityObject> rather than <AXCoreObject>? This code checks DOM nodes which isn't going to work for isolated objects, so would be nice to type this specifically if possible.
Comment 10 Andres Gonzalez 2023-02-23 20:05:09 PST
Created attachment 465147 [details]
Patch
Comment 11 Andres Gonzalez 2023-02-23 20:12:21 PST
(In reply to Tyler Wilcock from comment #9)
> Comment on attachment 465061 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=465061&action=review
> 
> Looks like your patch message is missing the block listing modified files.

Yes, no easy way that I know of to recreate the list of modified files and functions after many commit amends. git show shows all the differences so the list that the WebKit script creates is redundant in that sense.
> 
> > COMMIT_MESSAGE:11
> > +- Lots of code cleanup and strenghening.
> 
> Typo — strenghening should be strengthening.

Fixed.
> 
> > Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm:203
> > +    auto matchFunc = [] (const AXCoreObject& axObject) {
> 
> Can this be typed as const AccessibilityObject&?
> 
> > Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm:207
> > +    if (const auto* parent = Accessibility::findAncestor<AXCoreObject>(*object, true, WTFMove(matchFunc)))
> 
> Can this be Accessibility::findAncestor<AccessibilityObject> rather than
> <AXCoreObject>? This code checks DOM nodes which isn't going to work for
> isolated objects, so would be nice to type this specifically if possible.

Fixed.
Comment 12 Tyler Wilcock 2023-02-23 20:16:44 PST
(In reply to Andres Gonzalez from comment #11)
> (In reply to Tyler Wilcock from comment #9)
> > Comment on attachment 465061 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=465061&action=review
> > 
> > Looks like your patch message is missing the block listing modified files.
> 
> Yes, no easy way that I know of to recreate the list of modified files and
> functions after many commit amends. git show shows all the differences so
> the list that the WebKit script creates is redundant in that sense.
You can do it with this set of steps:

1. Copy your current commit message to Notes / TextEdit / whatever.
2. Run `git reset HEAD^`. This undoes your head commit and unstages all the changes.
3. git add .
4. git commit
5. Notice all the changed files are back. Copy-paste the previous commit message you saved.

There might be an easier way, but this works fine.
Comment 13 Andres Gonzalez 2023-02-23 20:28:43 PST
(In reply to Tyler Wilcock from comment #12)
> (In reply to Andres Gonzalez from comment #11)
> > (In reply to Tyler Wilcock from comment #9)
> > > Comment on attachment 465061 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=465061&action=review
> > > 
> > > Looks like your patch message is missing the block listing modified files.
> > 
> > Yes, no easy way that I know of to recreate the list of modified files and
> > functions after many commit amends. git show shows all the differences so
> > the list that the WebKit script creates is redundant in that sense.
> You can do it with this set of steps:
> 
> 1. Copy your current commit message to Notes / TextEdit / whatever.
> 2. Run `git reset HEAD^`. This undoes your head commit and unstages all the
> changes.
> 3. git add .
> 4. git commit
> 5. Notice all the changed files are back. Copy-paste the previous commit
> message you saved.
> 
> There might be an easier way, but this works fine.

thanks for the tip, but I don't really think it is worth the trouble in this case and many others where you don't really need to comment in the commit message at that level of granularity. If the change doesn't make sense in the code, then you have a problem in the code or needs to be better commented in the code itlself, not in the commit message. In some cases it may be good to have some comments in individual functions in the commit message, but not in most cases. Just think it is a vestige of the ChangeLogs predating git.
Comment 14 EWS 2023-02-24 11:07:08 PST
Committed 260800@main (89395210e335): <https://commits.webkit.org/260800@main>

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