Bug 197119 - -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
Summary: -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empt...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad iOS 12
: P2 Normal
Assignee: Daniel Bates
Keywords: InRadar
Depends on:
Reported: 2019-04-19 14:35 PDT by Daniel Bates
Modified: 2019-04-19 16:49 PDT (History)
4 users (show)

See Also:

Patch (10.19 KB, patch)
2019-04-19 14:48 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 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:] 😀.
Comment 1 Daniel Bates 2019-04-19 14:48:59 PDT
Created attachment 367832 [details]
Comment 2 Daniel Bates 2019-04-19 16:48:44 PDT
Comment on attachment 367832 [details]

Clearing flags on attachment: 367832

Committed r244473: <https://trac.webkit.org/changeset/244473>
Comment 3 Daniel Bates 2019-04-19 16:48:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2019-04-19 16:49:21 PDT