Bug 197119

Summary: -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebKit Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: megan_gardner, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: iPhone / iPad   
OS: iOS 12   
Attachments:
Description Flags
Patch none

Daniel Bates
Reported 2019-04-19 14:35:32 PDT
An empty autocorrection context is expected to have a marked text range of, emphasis mine, NSMakeRange(**NSNotFound**, 0) NOT, again emphasis mine, NSMakeRange(**WTF::notFound**, 0). Subtle detail here: NSNotFound is equal to INT_MAX, but WTF::notFound = static_cast<size_t>(-1). Clients, like TextInput don't know that NSMakeRange(WTF::notFound, 0) represent the empty range. They only know that NSMakeRange(NSNotFound, 0) represents the empty range. Note that -[WKAutocorrectionContext emptyAutocorrectionContext:] just turns around and calls -[WKAutocorrectionContext autocorrectionContextWithWebContext:] so it's actually the latter that has the bug, but who would duplicate code when they could just call -[WKAutocorrectionContext emptyAutocorrectionContext:] 😀.
Attachments
Patch (10.19 KB, patch)
2019-04-19 14:48 PDT, Daniel Bates
no flags
Daniel Bates
Comment 1 2019-04-19 14:48:59 PDT
Daniel Bates
Comment 2 2019-04-19 16:48:44 PDT
Comment on attachment 367832 [details] Patch Clearing flags on attachment: 367832 Committed r244473: <https://trac.webkit.org/changeset/244473>
Daniel Bates
Comment 3 2019-04-19 16:48:46 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 4 2019-04-19 16:49:21 PDT
Note You need to log in before you can comment on or make changes to this bug.