Bug 201144

Summary: Don't compute upconverted characters twice in buildQuery() in DataDetection.mm
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: HTML EditingAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Severity: Normal CC: bfulgham, commit-queue, enrica, megan_gardner, sam, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=152989
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2019-08-26 12:26:21 PDT
Currently upconverted characters (and string length) are computed twice in buildQuery() in DataDetection.mm:

    for (TextIterator iterator(contextRange); !iterator.atEnd(); iterator.advance(), iteratorCount++) {
        size_t currentTextLength = iterator.text().length();
        const UniChar* currentCharPtr = iterator.text().upconvertedCharacters();
        RetainPtr<CFStringRef> currentText = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, iterator.text().upconvertedCharacters(), iterator.text().length()));


There's no need to compute these twice, so we can extract the common code.

Comment 1 David Kilzer (:ddkilzer) 2019-08-26 12:35:22 PDT
Created attachment 377260 [details]
Patch v1
Comment 2 Brent Fulgham 2019-08-26 12:43:41 PDT
Comment on attachment 377260 [details]
Patch v1

Comment 3 WebKit Commit Bot 2019-08-26 13:26:56 PDT
Comment on attachment 377260 [details]
Patch v1

Clearing flags on attachment: 377260

Committed r249115: <https://trac.webkit.org/changeset/249115>
Comment 4 WebKit Commit Bot 2019-08-26 13:26:58 PDT
All reviewed patches have been landed.  Closing bug.