Bug 225580

Summary: Remove all remaining uses of the String::toInt family of functions
Product: WebKit Reporter: Darin Adler <darin>
Component: WebCore Misc.Assignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, alecflett, apinheiro, beidson, calvaris, cdumez, cfleizach, cgarcia, changseok, dbarton, dino, dmazzoni, esprehn+autocc, ews-watchlist, fmalita, fred.wang, galpeter, glenn, gustavo, gyuyoung.kim, hi, japhet, jcraig, jdiggs, joepeck, jsbell, macpherson, menard, mifenton, mkwst, pdr, pnormand, sabouhallawa, samuel_white, sam, schenney, sergio, toyoshim, vjaquez, webkit-bug-importer, yutak
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch sam: review+

Description Darin Adler 2021-05-09 12:57:18 PDT
Remove all remaining uses of the String::toInt family of functions
Comment 1 Darin Adler 2021-05-09 14:07:58 PDT Comment hidden (obsolete)
Comment 2 Darin Adler 2021-05-09 14:08:57 PDT
Patch got a little bigger because I revisited HTML attributes and made them use parseHTMLInteger instead of parseInteger<>.
Comment 3 Radar WebKit Bug Importer 2021-05-09 14:27:17 PDT
<rdar://problem/77719686>
Comment 4 Darin Adler 2021-05-09 14:27:25 PDT Comment hidden (obsolete)
Comment 5 Darin Adler 2021-05-09 14:37:48 PDT Comment hidden (obsolete)
Comment 6 Darin Adler 2021-05-09 15:02:45 PDT Comment hidden (obsolete)
Comment 7 Darin Adler 2021-05-09 15:43:43 PDT Comment hidden (obsolete)
Comment 8 Darin Adler 2021-05-09 16:26:56 PDT
Created attachment 428143 [details]
Patch
Comment 9 Darin Adler 2021-05-09 18:23:47 PDT
Comment on attachment 428143 [details]
Patch

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

> Source/WebCore/editing/cocoa/DataDetection.mm:210
> +    if (++indexIterator != resultIndices.end()) {

Oops this should just be a while loop; I will fix that.
Comment 10 Darin Adler 2021-05-09 18:23:50 PDT Comment hidden (obsolete)
Comment 11 Sam Weinig 2021-05-10 08:53:07 PDT
Comment on attachment 428143 [details]
Patch

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

> Source/WebCore/html/HTMLLIElement.cpp:122
> +    Optional<int> explicitValue;
> +    if (auto parsedValue = parseHTMLInteger(value))
> +        explicitValue = *parsedValue;

If we have this pattern more (convert Expected<T, *> to Optional<T> we should consider adding a makeOptional() or convertToOptional() that takes an Expected.
Comment 12 Darin Adler 2021-05-10 09:14:45 PDT
Comment on attachment 428143 [details]
Patch

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

>> Source/WebCore/html/HTMLLIElement.cpp:122
>> +        explicitValue = *parsedValue;
> 
> If we have this pattern more (convert Expected<T, *> to Optional<T> we should consider adding a makeOptional() or convertToOptional() that takes an Expected.

Or maybe that should be an implicit conversion defined in the Expected class template.
Comment 13 Darin Adler 2021-05-10 09:57:14 PDT
Committed r277269 (237536@main): <https://commits.webkit.org/237536@main>