Bug 201085 - [iOS] [WebKit2] Tapping on the “I’m” text suggestion after typing “i’” does nothing
Summary: [iOS] [WebKit2] Tapping on the “I’m” text suggestion after typing “i’” does n...
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: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-23 12:23 PDT by Wenson Hsieh
Modified: 2019-08-23 19:57 PDT (History)
7 users (show)

See Also:


Attachments
Patch (10.03 KB, patch)
2019-08-23 13:01 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Make foldQuoteMarks take a const String& (11.66 KB, patch)
2019-08-23 14:22 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2019-08-23 12:23:48 PDT
<rdar://problem/53056118>
Comment 1 Wenson Hsieh 2019-08-23 13:01:02 PDT
Created attachment 377151 [details]
Patch
Comment 2 Darin Adler 2019-08-23 13:43:50 PDT
Comment on attachment 377151 [details]
Patch

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

> Source/WebCore/editing/TextIterator.h:57
> +WEBCORE_EXPORT String foldQuoteMarks(String);

Seems a little peculiar to have the argument the be "String" rather than "const String&". Also, I am a little concerned using this outside the context of ICU’s usearch. The folding here was specifically to work around what usearch does and does not do. This folding alone without all the other folding that usearch does is a sort of peculiar subset. Finally, it’s not great to have this in this header since it’s not really an "iteration" thing. Just because the file-local version was here doesn’t mean this is a good logical home for the function.
Comment 3 Darin Adler 2019-08-23 13:46:27 PDT
Comment on attachment 377151 [details]
Patch

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

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2342
>          textForRange = plainTextReplacingNoBreakSpace(range.get());

Might be cleaner to integrate the quote mark folding into a replacement for the "plainTextReplacingNoBreakSpace" function instead of doing it as a separate step.
Comment 4 Wenson Hsieh 2019-08-23 13:48:37 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 377151 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=377151&action=review
> 
> > Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2342
> >          textForRange = plainTextReplacingNoBreakSpace(range.get());
> 
> Might be cleaner to integrate the quote mark folding into a replacement for
> the "plainTextReplacingNoBreakSpace" function instead of doing it as a
> separate step.

This was my first thought, but then I realized that we’d still need a way to fold quote marks for the original text passed into applyAutocorrectionInternal.
Comment 5 Darin Adler 2019-08-23 13:50:28 PDT
Comment on attachment 377151 [details]
Patch

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

>>> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2342
>>>          textForRange = plainTextReplacingNoBreakSpace(range.get());
>> 
>> Might be cleaner to integrate the quote mark folding into a replacement for the "plainTextReplacingNoBreakSpace" function instead of doing it as a separate step.
> 
> This was my first thought, but then I realized that we’d still need a way to fold quote marks for the original text passed into applyAutocorrectionInternal.

Does that text perhaps also ultimately come from a call to plainTextReplacingNoBreakSpace?
Comment 6 Wenson Hsieh 2019-08-23 13:58:04 PDT
Comment on attachment 377151 [details]
Patch

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

>>>> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2342
>>>>          textForRange = plainTextReplacingNoBreakSpace(range.get());
>>> 
>>> Might be cleaner to integrate the quote mark folding into a replacement for the "plainTextReplacingNoBreakSpace" function instead of doing it as a separate step.
>> 
>> This was my first thought, but then I realized that we’d still need a way to fold quote marks for the original text passed into applyAutocorrectionInternal.
> 
> Does that text perhaps also ultimately come from a call to plainTextReplacingNoBreakSpace?

It comes from UIKit (which, in turn, gets it from kbd).
Comment 7 Wenson Hsieh 2019-08-23 14:07:09 PDT
(In reply to Darin Adler from comment #2)
> Comment on attachment 377151 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=377151&action=review
> 
> > Source/WebCore/editing/TextIterator.h:57
> > +WEBCORE_EXPORT String foldQuoteMarks(String);
> 
> Seems a little peculiar to have the argument the be "String" rather than
> "const String&”.

Agreed. On closer inspection, we should be able to make this const String& (the only call site that depends on this is one of the SearchBuffer constructors that could be tweaked). I’ll post a v2 that does this.

> Also, I am a little concerned using this outside the
> context of ICU’s usearch. The folding here was specifically to work around
> what usearch does and does not do. This folding alone without all the other
> folding that usearch does is a sort of peculiar subset.

I see. Perhaps the function could be renamed in such a way that makes this clear?

> Finally, it’s not
> great to have this in this header since it’s not really an "iteration"
> thing. Just because the file-local version was here doesn’t mean this is a
> good logical home for the function.

Yeah, I had considered moving this (either to WTFString.h as an instance method of WTF::String, or a standalone function in that file, or just a function in StringCommon.h, or even a new header in WebCore) but decided to leave it out of this patch to make this change simpler.

One thing to note is that wherever we decide to move it, we should probably keep foldQuoteMarks and foldQuoteMark in the same place.

Would it be okay to do this in a followup patch?
Comment 8 Wenson Hsieh 2019-08-23 14:22:59 PDT
Created attachment 377154 [details]
Make foldQuoteMarks take a const String&
Comment 9 Wenson Hsieh 2019-08-23 15:17:18 PDT
> One thing to note is that wherever we decide to move it, we should probably
> keep foldQuoteMarks and foldQuoteMark in the same place.
> 
> Would it be okay to do this in a followup patch?

I filed <https://bugs.webkit.org/show_bug.cgi?id=201092> for this.
Comment 10 WebKit Commit Bot 2019-08-23 16:00:45 PDT
Comment on attachment 377154 [details]
Make foldQuoteMarks take a const String&

Clearing flags on attachment: 377154

Committed r249074: <https://trac.webkit.org/changeset/249074>
Comment 11 WebKit Commit Bot 2019-08-23 16:00:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Darin Adler 2019-08-23 16:37:25 PDT
Comment on attachment 377154 [details]
Make foldQuoteMarks take a const String&

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

> Source/WebCore/editing/TextIterator.cpp:-2422
> -    foldQuoteMarks(m_target);

What you did here seems to be fixing a serious bug! This was calling a function and ignoring its result so it wasn’t folding the quote marks. Glad you fixed it, but not at all happy that we didn’t have test coverage that showed us what was happening.
Comment 13 Wenson Hsieh 2019-08-23 16:59:35 PDT
(In reply to Darin Adler from comment #12)
> Comment on attachment 377154 [details]
> Make foldQuoteMarks take a const String&
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=377154&action=review
> 
> > Source/WebCore/editing/TextIterator.cpp:-2422
> > -    foldQuoteMarks(m_target);
> 
> What you did here seems to be fixing a serious bug! This was calling a
> function and ignoring its result so it wasn’t folding the quote marks. Glad
> you fixed it, but not at all happy that we didn’t have test coverage that
> showed us what was happening.

Indeed!

One thing to note here is that this codepath is only compiled if UCONFIG_NO_COLLATION, which might explain the lack of test coverage (at least, on macOS and iOS bots).
Comment 14 Darin Adler 2019-08-23 19:57:56 PDT
Comment on attachment 377154 [details]
Make foldQuoteMarks take a const String&

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

>>> Source/WebCore/editing/TextIterator.cpp:-2422
>>> -    foldQuoteMarks(m_target);
>> 
>> What you did here seems to be fixing a serious bug! This was calling a function and ignoring its result so it wasn’t folding the quote marks. Glad you fixed it, but not at all happy that we didn’t have test coverage that showed us what was happening.
> 
> Indeed!
> 
> One thing to note here is that this codepath is only compiled if UCONFIG_NO_COLLATION, which might explain the lack of test coverage (at least, on macOS and iOS bots).

Aha, yes, that makes sense. And I think that means this does not affect any Cocoa platforms.