RESOLVED FIXED 176247
AX: Provide a way for Accessibility to cache the selection while retrieving rects for speak selection
https://bugs.webkit.org/show_bug.cgi?id=176247
Summary AX: Provide a way for Accessibility to cache the selection while retrieving r...
Nan Wang
Reported 2017-09-01 15:29:13 PDT
_accessibilityRetrieveRectsAtSelectionOffset:withText: is problematic for speak selection since it would use the current selection as the search range. The rects would be wrong when a speak session is active and the user tries to select some other text.
Attachments
patch (13.24 KB, patch)
2017-09-01 16:23 PDT, Nan Wang
no flags
patch (13.44 KB, patch)
2017-10-16 16:58 PDT, Nan Wang
no flags
patch (13.28 KB, patch)
2017-10-19 09:31 PDT, Nan Wang
rniwa: review+
patch to land (13.65 KB, patch)
2017-10-19 14:43 PDT, Nan Wang
no flags
Radar WebKit Bug Importer
Comment 1 2017-09-01 15:29:31 PDT
Nan Wang
Comment 2 2017-09-01 16:23:04 PDT
Nan Wang
Comment 3 2017-10-16 16:58:14 PDT
Created attachment 323958 [details] patch merge with TOT
Nan Wang
Comment 4 2017-10-17 08:39:12 PDT
Comment on attachment 323958 [details] patch Can someone take a look? Thanks!
Ryosuke Niwa
Comment 5 2017-10-18 18:55:56 PDT
Comment on attachment 323958 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=323958&action=review > Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1893 > +void WebPage::cacheSelectionForAccessibility(bool shouldCache) I don't think we should call this a "cache" since what we're doing here is to save the selection at the time of invocation. A better name might be like storeSelectionForAccessibility or freezeSelectionForAccessibility. There is an alternative approach which is to expose some sort of opaque object like WKWebViewSelection and then add a new variant of getRectsForGranularityWithSelectionOffset which takes that opaque object and computes the correct rect but that might be a bit of an overkill for this particular bug.
Ryosuke Niwa
Comment 6 2017-10-18 18:57:03 PDT
By the way, feel free to email my webkit.org or apple.com email address if you need a code review.
Nan Wang
Comment 7 2017-10-19 08:42:51 PDT
Comment on attachment 323958 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=323958&action=review >> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1893 >> +void WebPage::cacheSelectionForAccessibility(bool shouldCache) > > I don't think we should call this a "cache" since what we're doing here is to save the selection at the time of invocation. > A better name might be like storeSelectionForAccessibility or freezeSelectionForAccessibility. > > There is an alternative approach which is to expose some sort of opaque object like WKWebViewSelection > and then add a new variant of getRectsForGranularityWithSelectionOffset which takes that opaque object > and computes the correct rect but that might be a bit of an overkill for this particular bug. Thanks for the alternative approach! But for this particular bug I think it's more straightforward to go with the current approach and it's easier for the iOS assistive technology to adapt the changes. I will rename them.
Nan Wang
Comment 8 2017-10-19 08:43:08 PDT
(In reply to Ryosuke Niwa from comment #6) > By the way, feel free to email my webkit.org or apple.com email address if > you need a code review. Sure! Thanks for the review.
Nan Wang
Comment 9 2017-10-19 09:31:06 PDT
Created attachment 324241 [details] patch rename
Ryosuke Niwa
Comment 10 2017-10-19 13:29:30 PDT
Comment on attachment 324241 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=324241&action=review > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:2313 > +- (void)_accessibilityStoreSelection:(BOOL)shouldStore > +{ > + _page->storeSelectionForAccessibility(shouldStore); > +} Maybe it's better to add _accessibilityClearSelection instead of making this method take a bool It's kind of weird to say _accessibilityStoreSelection: FALSE. It sounds as if we're going to not store selection in the future instead of the call directly clearing what's already been stored.
Nan Wang
Comment 11 2017-10-19 13:41:21 PDT
(In reply to Ryosuke Niwa from comment #10) > Comment on attachment 324241 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=324241&action=review > > > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:2313 > > +- (void)_accessibilityStoreSelection:(BOOL)shouldStore > > +{ > > + _page->storeSelectionForAccessibility(shouldStore); > > +} > > Maybe it's better to add _accessibilityClearSelection instead of making this > method take a bool > It's kind of weird to say _accessibilityStoreSelection: FALSE. > It sounds as if we're going to not store selection in the future instead of > the call directly clearing what's already been stored. Ok I will make another patch to address this.
Nan Wang
Comment 12 2017-10-19 14:43:51 PDT
Created attachment 324294 [details] patch to land update from review
Nan Wang
Comment 13 2017-10-19 14:45:10 PDT
I want to make sure tests are still passing. Ryosuke, can you take a quick look again? Thanks.
WebKit Commit Bot
Comment 14 2017-10-19 16:34:20 PDT
Comment on attachment 324294 [details] patch to land Clearing flags on attachment: 324294 Committed r223726: <https://trac.webkit.org/changeset/223726>
WebKit Commit Bot
Comment 15 2017-10-19 16:34:22 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.