Title: [241284] trunk
Revision
241284
Author
[email protected]
Date
2019-02-11 17:04:16 -0800 (Mon, 11 Feb 2019)

Log Message

[iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph
https://bugs.webkit.org/show_bug.cgi?id=194505
<rdar://problem/47743533>

Reviewed by Tim Horton.

Source/WebKit:

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _deleteToEndOfParagraph]): Added.
(-[WKContentView _transpose]): Added.

LayoutTests:

Add tests to ensure that Control + t and Control + k perform a transpose and delete to the
end of the line/paragraph. Skip the tests for now until we have the UIKit fix <rdar://problem/44928156>.

* fast/events/ios/key-command-delete-to-end-of-paragraph-expected.txt: Added.
* fast/events/ios/key-command-delete-to-end-of-paragraph.html: Added.
* fast/events/ios/key-command-transpose-expected.txt: Added.
* fast/events/ios/key-command-transpose.html: Added.
* platform/ios/TestExpectations: Skip tests for now.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (241283 => 241284)


--- trunk/LayoutTests/ChangeLog	2019-02-12 00:07:21 UTC (rev 241283)
+++ trunk/LayoutTests/ChangeLog	2019-02-12 01:04:16 UTC (rev 241284)
@@ -1,3 +1,20 @@
+2019-02-11  Daniel Bates  <[email protected]>
+
+        [iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph
+        https://bugs.webkit.org/show_bug.cgi?id=194505
+        <rdar://problem/47743533>
+
+        Reviewed by Tim Horton.
+
+        Add tests to ensure that Control + t and Control + k perform a transpose and delete to the
+        end of the line/paragraph. Skip the tests for now until we have the UIKit fix <rdar://problem/44928156>.
+
+        * fast/events/ios/key-command-delete-to-end-of-paragraph-expected.txt: Added.
+        * fast/events/ios/key-command-delete-to-end-of-paragraph.html: Added.
+        * fast/events/ios/key-command-transpose-expected.txt: Added.
+        * fast/events/ios/key-command-transpose.html: Added.
+        * platform/ios/TestExpectations: Skip tests for now.
+
 2019-02-11  Adrian Perez de Castro  <[email protected]>
 
         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests

Added: trunk/LayoutTests/fast/events/ios/key-command-delete-to-end-of-paragraph-expected.txt (0 => 241284)


--- trunk/LayoutTests/fast/events/ios/key-command-delete-to-end-of-paragraph-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/key-command-delete-to-end-of-paragraph-expected.txt	2019-02-12 01:04:16 UTC (rev 241284)
@@ -0,0 +1,12 @@
+Tests that pressing Control + k in a content-editable field deletes to the end of the paragraph.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+To run this test by hand, place the text insertion point before the 'h' in the text below and press Control + k.
+
+PASS document.getElementById("test").textContent is "a"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/ios/key-command-delete-to-end-of-paragraph.html (0 => 241284)


--- trunk/LayoutTests/fast/events/ios/key-command-delete-to-end-of-paragraph.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/key-command-delete-to-end-of-paragraph.html	2019-02-12 01:04:16 UTC (rev 241284)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width">
+<script src=""
+<script src=""
+<style>
+#test {
+    border: 1px solid black;
+    height: 500px;
+    width: 500px;
+}
+
+.hidden {
+    display: none;
+}
+</style>
+</head>
+<body>
+<p id="description"></p>
+<p id="manual-instructions" class="hide">To run this test by hand, place the text insertion point before the 'h' in the text below and press Control + k.</p>
+<div id="console"></div>
+<div id="test" contenteditable="true">ah</div>
+<script>
+window.jsTestIsAsync = true;
+
+let testElement = document.getElementById("test");
+let mutationObserver = null;
+
+function handleMutation()
+{
+    mutationObserver.disconnect();
+    shouldBeEqualToString('document.getElementById("test").textContent', "a");
+    document.body.removeChild(testElement);
+    finishJSTest();
+}
+
+function runTest()
+{
+    if (!window.testRunner)
+        document.getElementById("manual-instructions").classList.remove("hidden");
+
+    mutationObserver = new MutationObserver(handleMutation);
+    mutationObserver.observe(testElement, { subtree:true, characterData: true });
+
+    function handleFocus() {
+        window.getSelection().setBaseAndExtent(testElement.firstChild, 1, testElement.firstChild, 1); // Put caret before the 'h'.
+        if (window.testRunner)
+            UIHelper.keyDown("k", ["ctrlKey"]);
+    }
+    testElement.addEventListener("focus", handleFocus, { once: true });
+    if (window.testRunner)
+        UIHelper.activateElement(testElement);
+}
+
+description("Tests that pressing Control + k in a content-editable field deletes to the end of the paragraph.");
+runTest();
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/ios/key-command-transpose-expected.txt (0 => 241284)


--- trunk/LayoutTests/fast/events/ios/key-command-transpose-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/key-command-transpose-expected.txt	2019-02-12 01:04:16 UTC (rev 241284)
@@ -0,0 +1,12 @@
+Tests that pressing Control + t in a content-editable field performs a tranpose.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+To run this test by hand, place the text insertion point before the 'h' in the text below and press Control + t.
+
+PASS document.getElementById("test").textContent is "ha"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/ios/key-command-transpose.html (0 => 241284)


--- trunk/LayoutTests/fast/events/ios/key-command-transpose.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/key-command-transpose.html	2019-02-12 01:04:16 UTC (rev 241284)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width">
+<script src=""
+<script src=""
+<style>
+#test {
+    border: 1px solid black;
+    height: 500px;
+    width: 500px;
+}
+
+.hidden {
+    display: none;
+}
+</style>
+</head>
+<body>
+<p id="description"></p>
+<p id="manual-instructions" class="hide">To run this test by hand, place the text insertion point before the 'h' in the text below and press Control + t.</p>
+<div id="console"></div>
+<div id="test" contenteditable="true">ah</div>
+<script>
+window.jsTestIsAsync = true;
+
+let testElement = document.getElementById("test");
+let mutationObserver = null;
+
+function handleMutation()
+{
+    mutationObserver.disconnect();
+    shouldBeEqualToString('document.getElementById("test").textContent', "ha");
+    document.body.removeChild(testElement);
+    finishJSTest();
+}
+
+function runTest()
+{
+    if (!window.testRunner)
+        document.getElementById("manual-instructions").classList.remove("hidden");
+
+    mutationObserver = new MutationObserver(handleMutation);
+    mutationObserver.observe(testElement, { subtree:true, characterData: true });
+
+    function handleFocus() {
+        window.getSelection().setBaseAndExtent(testElement.firstChild, 1, testElement.firstChild, 1); // Put caret before the 'h'.
+        if (window.testRunner)
+            UIHelper.keyDown("t", ["ctrlKey"]);
+    }
+    testElement.addEventListener("focus", handleFocus, { once: true });
+    if (window.testRunner)
+        UIHelper.activateElement(testElement);
+}
+
+description("Tests that pressing Control + t in a content-editable field performs a tranpose.");
+runTest();
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (241283 => 241284)


--- trunk/LayoutTests/platform/ios/TestExpectations	2019-02-12 00:07:21 UTC (rev 241283)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2019-02-12 01:04:16 UTC (rev 241284)
@@ -3215,3 +3215,7 @@
 fast/events/touch/ios/touch-events-with-modifiers.html [ Skip ]
 fast/events/touch/ios/mouse-events-with-modifiers.html [ Skip ]
 fast/events/touch/ios/pointer-events-with-modifiers.html [ Skip ]
+
+# FIXME: Unskip the following test once we have the fix for <rdar://problem/44928156>.
+fast/events/ios/key-command-delete-to-end-of-paragraph.html [ Skip ]
+fast/events/ios/key-command-transpose.html [ Skip ]

Modified: trunk/Source/WebKit/ChangeLog (241283 => 241284)


--- trunk/Source/WebKit/ChangeLog	2019-02-12 00:07:21 UTC (rev 241283)
+++ trunk/Source/WebKit/ChangeLog	2019-02-12 01:04:16 UTC (rev 241284)
@@ -1,3 +1,15 @@
+2019-02-11  Daniel Bates  <[email protected]>
+
+        [iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph
+        https://bugs.webkit.org/show_bug.cgi?id=194505
+        <rdar://problem/47743533>
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _deleteToEndOfParagraph]): Added.
+        (-[WKContentView _transpose]): Added.
+
 2019-02-11  Adrian Perez de Castro  <[email protected]>
 
         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (241283 => 241284)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-02-12 00:07:21 UTC (rev 241283)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-02-12 01:04:16 UTC (rev 241284)
@@ -4266,6 +4266,16 @@
     [self executeEditCommandWithCallback:@"deleteForward"];
 }
 
+- (void)_deleteToEndOfParagraph
+{
+    [self executeEditCommandWithCallback:@"deleteToEndOfParagraph"];
+}
+
+- (void)_transpose
+{
+    [self executeEditCommandWithCallback:@"transpose"];
+}
+
 - (UITextInputArrowKeyHistory *)_moveUp:(BOOL)extending withHistory:(UITextInputArrowKeyHistory *)history
 {
     [self executeEditCommandWithCallback:extending ? @"moveUpAndModifySelection" : @"moveUp"];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to