Bug 153331

Summary: Handle soft spaces after accepted candidates
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, enrica, sam, simon.fraser, thorton
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Beth Dakin 2016-01-21 16:22:51 PST
Handle soft spaces after accepted candidates

rdar://problem/23958418
Comment 1 Beth Dakin 2016-01-21 16:35:35 PST
Created attachment 269518 [details]
Patch
Comment 2 WebKit Commit Bot 2016-01-21 17:15:51 PST
Attachment 269518 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:3526:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2016-01-24 11:58:35 PST
Comment on attachment 269518 [details]
Patch

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

> Source/WebCore/editing/Editor.cpp:3567
> +    if (!acceptedCandidate.replacement.endsWith(" "))

Should be endsWith(' ') to avoid unnecessary work.

> Source/WebCore/editing/Editor.cpp:3568
> +        insertText(String(" "), 0);

Should be ASCIILiteral instead of String, although not sure how helpful that optimization is in cases like this.
Comment 4 Simon Fraser (smfr) 2016-01-25 11:59:41 PST
Comment on attachment 269518 [details]
Patch

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

> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h:638
> +    NSRange m_softSpaceRange;

Can this be initialized with { NSNotFound, 0 } ?
Comment 5 Beth Dakin 2016-01-25 12:30:26 PST
Thanks Darin and Simon! http://trac.webkit.org/changeset/195547
Comment 6 Beth Dakin 2016-01-25 12:32:58 PST
(In reply to comment #5)
> Thanks Darin and Simon! http://trac.webkit.org/changeset/195547

I should note that I made all of the suggested changes.