Bug 201144 - Don't compute upconverted characters twice in buildQuery() in DataDetection.mm
Summary: Don't compute upconverted characters twice in buildQuery() in DataDetection.mm
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-26 12:26 PDT by David Kilzer (:ddkilzer)
Modified: 2019-08-26 13:26 PDT (History)
7 users (show)

See Also:


Attachments
Patch v1 (11.13 KB, patch)
2019-08-26 12:35 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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()));
        [...]
    }

<https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/editing/cocoa/DataDetection.mm#L365>

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

<rdar://problem/54689399>
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

r=me
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.