Title: [254945] trunk
Revision
254945
Author
[email protected]
Date
2020-01-22 14:00:43 -0800 (Wed, 22 Jan 2020)

Log Message

Automatic link replacement via "Smart links" should emit "insertLink" input events
https://bugs.webkit.org/show_bug.cgi?id=191306
Source/WebCore:

<rdar://problem/58491514>

Patch by Nikos Mouchtaris <[email protected]> on 2020-01-22
Reviewed by Wenson Hsieh.

Added support for outputting "insertLink" for input type and the url for the
data of the input event when smart link is used.

Test: fast/events/input-event-insert-link.html

* editing/CreateLinkCommand.h:
* editing/EditCommand.cpp:
(WebCore::inputTypeNameForEditingAction):

LayoutTests:

Patch by Nikos Mouchtaris <[email protected]> on 2020-01-22
Reviewed by Wenson Hsieh.

Due to webkit.org/b/162081 this test is skipped for WebKit2.

* fast/events/input-event-insert-link-expected.txt: Added.
* fast/events/input-event-insert-link.html: Added.
* platform/gtk/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (254944 => 254945)


--- trunk/LayoutTests/ChangeLog	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/LayoutTests/ChangeLog	2020-01-22 22:00:43 UTC (rev 254945)
@@ -1,3 +1,20 @@
+2020-01-22  Nikos Mouchtaris  <[email protected]>
+
+        Automatic link replacement via "Smart links" should emit "insertLink" input events
+        https://bugs.webkit.org/show_bug.cgi?id=191306
+
+        Reviewed by Wenson Hsieh.
+
+        Due to webkit.org/b/162081 this test is skipped for WebKit2.
+
+        * fast/events/input-event-insert-link-expected.txt: Added.
+        * fast/events/input-event-insert-link.html: Added.
+        * platform/gtk/TestExpectations:
+        * platform/ios/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+        * platform/win/TestExpectations:
+        * platform/wincairo/TestExpectations:
+
 2020-01-22  Yusuke Suzuki  <[email protected]>
 
         [JSC] DateMath should accept more ISO-8601 timezone designators even if they are not included in ECMA262 to produce expected results in the wild code

Added: trunk/LayoutTests/fast/events/input-event-insert-link-expected.txt (0 => 254945)


--- trunk/LayoutTests/fast/events/input-event-insert-link-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/input-event-insert-link-expected.txt	2020-01-22 22:00:43 UTC (rev 254945)
@@ -0,0 +1,29 @@
+This test verifies that input events of inputType 'insertLink' are dispatched when automatically replacing text with a link.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+event.type = beforeinput
+event.inputType = insertText
+event.data = "" 
+event.type = beforeinput
+event.inputType = insertLink
+event.data = ""
+event.type = input
+event.inputType = insertText
+event.data = "" 
+event.type = input
+event.inputType = insertLink
+event.data = ""
+event.type = beforeinput
+event.inputType = insertParagraph
+event.data = ""
+event.type = input
+event.inputType = insertParagraph
+event.data = ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+www.apple.comĀ 
+
+

Added: trunk/LayoutTests/fast/events/input-event-insert-link.html (0 => 254945)


--- trunk/LayoutTests/fast/events/input-event-insert-link.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/input-event-insert-link.html	2020-01-22 22:00:43 UTC (rev 254945)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+</head>
+<body>
+    <div id="editable" contenteditable _onbeforeinput_=handleInput(event) _oninput_=handleInput(event)></div>
+    <script type="text/_javascript_">
+        description("This test verifies that input events of inputType 'insertLink' are dispatched when automatically replacing text with a link.");
+        if (window.internals)
+        {
+            internals.settings.setInputEventsEnabled(true);
+            internals.setAutomaticLinkDetectionEnabled(true);
+        }
+
+        document.getElementById("editable").focus();
+        document.execCommand("insertText", true, "www.apple.com ");
+        document.execCommand("insertParagraph");
+
+        function handleInput(event)
+        {
+            debug(`event.type = ${event.type}`);
+            debug(`event.inputType = ${event.inputType}`);
+            debug(`event.data = ""
+        }
+    </script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (254944 => 254945)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2020-01-22 22:00:43 UTC (rev 254945)
@@ -722,6 +722,7 @@
 editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
 editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
 editing/inserting/smart-quote-with-all-configurations.html [ Skip ]
+fast/events/input-event-insert-link.html [ Failure ]
 
 # QuickTime plug-in not relevant to this port
 Bug(GTK) plugins/quicktime-plugin-replacement.html [ Skip ]

Modified: trunk/LayoutTests/platform/ios/TestExpectations (254944 => 254945)


--- trunk/LayoutTests/platform/ios/TestExpectations	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-01-22 22:00:43 UTC (rev 254945)
@@ -797,6 +797,7 @@
 editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
 editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
 editing/inserting/smart-quote-with-all-configurations.html [ Skip ]
+fast/events/input-event-insert-link.html [ Failure ]
 
 # No tab navigation support on iOS
 fast/shadow-dom/focus-on-iframe.html [ Failure ]

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (254944 => 254945)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-01-22 22:00:43 UTC (rev 254945)
@@ -600,6 +600,7 @@
 
 webkit.org/b/162081 editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
 webkit.org/b/162081 editing/inserting/smart-quote-with-all-configurations.html [ Failure ]
+webkit.org/b/162081 fast/events/input-event-insert-link.html [ Failure ]
 
 webkit.org/b/160017 js/regress-139548.html [ Pass Timeout ]
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (254944 => 254945)


--- trunk/LayoutTests/platform/win/TestExpectations	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/LayoutTests/platform/win/TestExpectations	2020-01-22 22:00:43 UTC (rev 254945)
@@ -1300,6 +1300,7 @@
 editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
 editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
 editing/inserting/smart-quote-with-all-configurations.html [ Skip ]
+fast/events/input-event-insert-link.html [ Failure ]
 
 ###### Text Iterator
 # Plain text controller currently in Mac DumpRenderTree only.

Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (254944 => 254945)


--- trunk/LayoutTests/platform/wincairo/TestExpectations	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations	2020-01-22 22:00:43 UTC (rev 254945)
@@ -1370,6 +1370,7 @@
 # Windows does not implement setAutomaticLinkDetectionEnabled
 editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
 editing/inserting/smart-quote-with-all-configurations.html [ Failure ]
+fast/events/input-event-insert-link.html [ Failure ]
 
 ###### Text Iterator
 # Plain text controller currently in Mac DumpRenderTree only.

Modified: trunk/Source/WebCore/ChangeLog (254944 => 254945)


--- trunk/Source/WebCore/ChangeLog	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/Source/WebCore/ChangeLog	2020-01-22 22:00:43 UTC (rev 254945)
@@ -1,3 +1,20 @@
+2020-01-22  Nikos Mouchtaris  <[email protected]>
+
+        Automatic link replacement via "Smart links" should emit "insertLink" input events
+        https://bugs.webkit.org/show_bug.cgi?id=191306
+        <rdar://problem/58491514>
+
+        Reviewed by Wenson Hsieh.
+
+        Added support for outputting "insertLink" for input type and the url for the 
+        data of the input event when smart link is used.
+
+        Test: fast/events/input-event-insert-link.html
+
+        * editing/CreateLinkCommand.h:
+        * editing/EditCommand.cpp:
+        (WebCore::inputTypeNameForEditingAction):
+
 2020-01-22  Said Abou-Hallawa  <[email protected]>
 
         Remove ImageBuffer::sizeForDestinationSize()

Modified: trunk/Source/WebCore/editing/CreateLinkCommand.h (254944 => 254945)


--- trunk/Source/WebCore/editing/CreateLinkCommand.h	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/Source/WebCore/editing/CreateLinkCommand.h	2020-01-22 22:00:43 UTC (rev 254945)
@@ -44,6 +44,8 @@
     void doApply() override;
     EditAction editingAction() const override { return EditAction::CreateLink; }
 
+    String inputEventData() const override { return m_url; }
+    
     String m_url;
 };
 

Modified: trunk/Source/WebCore/editing/EditCommand.cpp (254944 => 254945)


--- trunk/Source/WebCore/editing/EditCommand.cpp	2020-01-22 21:58:37 UTC (rev 254944)
+++ trunk/Source/WebCore/editing/EditCommand.cpp	2020-01-22 22:00:43 UTC (rev 254945)
@@ -116,6 +116,8 @@
         return "formatSetInlineTextDirection"_s;
     case EditAction::SetBlockWritingDirection:
         return "formatSetBlockTextDirection"_s;
+    case EditAction::CreateLink:
+        return "insertLink"_s;
     default:
         return emptyString();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to