RESOLVED FIXED 209380
Support inserting text or dictation alternative by simulating keyboard input
https://bugs.webkit.org/show_bug.cgi?id=209380
Summary Support inserting text or dictation alternative by simulating keyboard input
Daniel Bates
Reported 2020-03-21 16:54:00 PDT
Some web sites, like facebook.com or reddit.com, implement their own text editing system, which listens for DOM keyboard events or the DOM change event. When text corrections or dictation alternatives are inserted the behavior of the editor does not match what it would have done if a user manually typed the correction or alternative. For example, facebook.com listens for a DOM keyup event to hide the placeholder text shown in their fields. Towards having a good user experience, expose an insertion option that when enabled dispatches dummy keyboard and change events when performing a text insertion.
Attachments
Patch (20.93 KB, patch)
2020-03-21 17:16 PDT, Daniel Bates
no flags
Patch (20.93 KB, patch)
2020-03-21 17:17 PDT, Daniel Bates
no flags
Patch and unit tests (20.08 KB, patch)
2020-03-21 23:01 PDT, Daniel Bates
no flags
Patch and unit tests (20.08 KB, patch)
2020-03-21 23:02 PDT, Daniel Bates
no flags
Patch and unit tests (20.09 KB, patch)
2020-03-21 23:34 PDT, Daniel Bates
no flags
To Land (20.18 KB, patch)
2020-03-23 13:57 PDT, Daniel Bates
no flags
Daniel Bates
Comment 1 2020-03-21 16:54:05 PDT
Daniel Bates
Comment 2 2020-03-21 17:16:42 PDT
Daniel Bates
Comment 3 2020-03-21 17:17:30 PDT
Daniel Bates
Comment 4 2020-03-21 20:18:56 PDT
Comment on attachment 394185 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394185&action=review > Tools/TestWebKitAPI/cocoa/TestCocoa.h:45 > +// This is a template instead of a macro to support passing arguments written in Objective-C Yikes, this will not preserve original expressions....doesn't look like there is an exposed way to retrieve stringified values of the passed args in C++. So, going to go back to using a macro for this and just surround the array literals with parens
Daniel Bates
Comment 5 2020-03-21 23:01:23 PDT
Created attachment 394195 [details] Patch and unit tests Now EXPECT_NS_EQUAL is a macro, again
Daniel Bates
Comment 6 2020-03-21 23:02:52 PDT
Created attachment 394196 [details] Patch and unit tests
Daniel Bates
Comment 7 2020-03-21 23:33:18 PDT
Comment on attachment 394196 [details] Patch and unit tests View in context: https://bugs.webkit.org/attachment.cgi?id=394196&action=review > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4716 > + [self _shouldSimulateKeyboardInputOnTextInsertionInternal]; r-, this is wrong.
Daniel Bates
Comment 8 2020-03-21 23:34:37 PDT
Created attachment 394197 [details] Patch and unit tests
Darin Adler
Comment 9 2020-03-22 09:50:20 PDT
Comment on attachment 394197 [details] Patch and unit tests View in context: https://bugs.webkit.org/attachment.cgi?id=394197&action=review > Source/WebKit/Shared/Cocoa/InsertTextOptions.h:37 > + bool simulateKeyboardInput { false }; As you know, Cocoa programming style suggests naming boolean properties in a way that disambiguates from a function that would take action. So shouldSimulateKeyboardInput because simulateKeyboardInput reads like a command that would do something immediately rather than a setting for what should be done. We should consider that style for the booleans in this structure.
Daniel Bates
Comment 10 2020-03-23 13:57:36 PDT
Daniel Bates
Comment 11 2020-03-23 13:58:18 PDT
Comment on attachment 394197 [details] Patch and unit tests View in context: https://bugs.webkit.org/attachment.cgi?id=394197&action=review Thanks for the review. >> Source/WebKit/Shared/Cocoa/InsertTextOptions.h:37 >> + bool simulateKeyboardInput { false }; > > As you know, Cocoa programming style suggests naming boolean properties in a way that disambiguates from a function that would take action. So shouldSimulateKeyboardInput because simulateKeyboardInput reads like a command that would do something immediately rather than a setting for what should be done. > > We should consider that style for the booleans in this structure. Renamed.
Daniel Bates
Comment 12 2020-03-23 14:00:05 PDT
Comment on attachment 394300 [details] To Land Clearing flags on attachment: 394300 Committed r258873: <https://trac.webkit.org/changeset/258873>
Daniel Bates
Comment 13 2020-03-23 14:00:07 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.