RESOLVED FIXED 191306
Automatic link replacement via "Smart links" should emit "insertLink" input events
https://bugs.webkit.org/show_bug.cgi?id=191306
Summary Automatic link replacement via "Smart links" should emit "insertLink" input e...
Wenson Hsieh
Reported 2018-11-06 07:44:45 PST
To reproduce: 1. https://whsieh.github.io/examples/input-events. 2. Right click, and make sure that Substitutions → Smart links is checked in the context menu. 3. Type "https://www.apple.com" and a space. Expected: input type of "insertLink" Observed: input type of null
Attachments
Patch (4.58 KB, patch)
2020-01-21 13:58 PST, Nikos Mouchtaris
no flags
Patch (4.47 KB, patch)
2020-01-21 14:22 PST, Nikos Mouchtaris
no flags
Patch (8.34 KB, patch)
2020-01-21 16:07 PST, Nikos Mouchtaris
no flags
Patch (8.45 KB, patch)
2020-01-21 16:24 PST, Nikos Mouchtaris
no flags
Patch (8.83 KB, patch)
2020-01-21 16:50 PST, Nikos Mouchtaris
no flags
Patch (9.04 KB, patch)
2020-01-22 13:34 PST, Nikos Mouchtaris
no flags
Radar WebKit Bug Importer
Comment 1 2020-01-10 14:37:13 PST
Nikos Mouchtaris
Comment 2 2020-01-21 13:58:36 PST
Tim Horton
Comment 3 2020-01-21 14:18:20 PST
Comment on attachment 388344 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388344&action=review > Source/WebCore/ChangeLog:5 > + You should stick the radar link here (see other commits for examples). > LayoutTests/fast/events/emit-insertLink.html:9 > + description("To manually test this, change the foreground color and check the resulting debug messages."); Is this right? It doesn't sound right.
Wenson Hsieh
Comment 4 2020-01-21 14:22:39 PST
Comment on attachment 388344 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388344&action=review > LayoutTests/fast/events/emit-insertLink-expected.txt:18 > +event.type = beforeinput > +event.inputType = insertText > +event.data = www.apple.com > +event.type = input > +event.inputType = insertText > +event.data = www.apple.com > +event.type = beforeinput > +event.inputType = insertParagraph > +event.data = null > +event.type = input > +event.inputType = insertParagraph > +event.data = null > +PASS successfullyParsed is true Hm...I would've expected to see a line that says `event.inputType = insertLink` here too, instead of just insertText and insertParagraph.
Nikos Mouchtaris
Comment 5 2020-01-21 14:22:49 PST
Wenson Hsieh
Comment 6 2020-01-21 14:23:29 PST
Comment on attachment 388344 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388344&action=review >> LayoutTests/fast/events/emit-insertLink-expected.txt:18 >> +PASS successfullyParsed is true > > Hm...I would've expected to see a line that says `event.inputType = insertLink` here too, instead of just insertText and insertParagraph. Ah, you might need this: if (window.internals) internals.setAutomaticLinkDetectionEnabled(true);
Wenson Hsieh
Comment 7 2020-01-21 15:14:34 PST
(In reply to Wenson Hsieh from comment #6) > Comment on attachment 388344 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=388344&action=review > > >> LayoutTests/fast/events/emit-insertLink-expected.txt:18 > >> +PASS successfullyParsed is true > > > > Hm...I would've expected to see a line that says `event.inputType = insertLink` here too, instead of just insertText and insertParagraph. > > Ah, you might need this: > > if (window.internals) > internals.setAutomaticLinkDetectionEnabled(true); ...regrettably, this doesn't work in WebKit2; this is a known issue, currently being tracked by <webkit.org/b/162081>. We could probably make the test work on WebKit2 as a followup in <webkit.org/b/162081>, and only enable in on WebKit1 for the time being.
Nikos Mouchtaris
Comment 8 2020-01-21 16:07:54 PST
Wenson Hsieh
Comment 9 2020-01-21 16:14:25 PST
Comment on attachment 388364 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388364&action=review > LayoutTests/fast/events/emit-insertLink.html:11 > + if (window.internals) > + internals.settings.setInputEventsEnabled(true); > + internals.setAutomaticLinkDetectionEnabled(true); Missing { } around the multiline if statement.
Nikos Mouchtaris
Comment 10 2020-01-21 16:24:39 PST
Wenson Hsieh
Comment 11 2020-01-21 16:36:41 PST
Comment on attachment 388368 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388368&action=review > Source/WebCore/ChangeLog:12 > + Test: fast/events/emit-insertLink.html Let's update this to fast/events/input-event-insert-link.html as well. > LayoutTests/ChangeLog:11 > + * fast/events/emit-insertLink-expected.txt: Added. > + * fast/events/emit-insertLink.html: Added. Let's update these to fast/events/input-event-insert-link.html as well. > LayoutTests/fast/events/input-event-insert-link.html:14 > + I think it helps to have a quick description here; perhaps something like, `description("This test verifies that input events of inputType 'insertLink' are dispatched when automatically replacing text with a link.");`.
Nikos Mouchtaris
Comment 12 2020-01-21 16:50:59 PST
Nikos Mouchtaris
Comment 13 2020-01-22 13:34:48 PST
WebKit Commit Bot
Comment 14 2020-01-22 14:00:48 PST
Comment on attachment 388465 [details] Patch Clearing flags on attachment: 388465 Committed r254945: <https://trac.webkit.org/changeset/254945>
WebKit Commit Bot
Comment 15 2020-01-22 14:00:50 PST
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.