Source/WebKit/ChangeLog

 12019-06-25 Daniel Bates <dabates@apple.com>
 2
 3 Non-editable text selections should be modifiable with hardware keyboard
 4 https://bugs.webkit.org/show_bug.cgi?id=199204
 5 <rdar://problem/51651496>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 UIKit changes are need for this to work, including <rdar://problem/48322899>.
 10 Note that without these changes, -canPerformAction is never called for _move*
 11 selectors.
 12
 13 * UIProcess/ios/WKContentViewInteraction.mm:
 14 (-[WKContentView canPerformAction:withSender:]):
 15
1162019-06-25 Alex Christensen <achristensen@webkit.org>
217
318 Make HTTPCookieAcceptPolicy an enum class

Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

@@- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
28922892
28932893 // These are UIKit IPI selectors. We don't want to forward them to the web view.
28942894 auto editorState = _page->editorState();
2895  if (action == @selector(_deleteByWord) || action == @selector(_deleteForwardAndNotify:) || action == @selector(_deleteToEndOfParagraph) || action == @selector(_deleteToStartOfLine)
2896  || action == @selector(_moveDown:withHistory:) || action == @selector(_moveLeft:withHistory:) || action == @selector(_moveRight:withHistory:)
 2895 if (action == @selector(_moveDown:withHistory:) || action == @selector(_moveLeft:withHistory:) || action == @selector(_moveRight:withHistory:)
28972896 || action == @selector(_moveToEndOfDocument:withHistory:) || action == @selector(_moveToEndOfLine:withHistory:) || action == @selector(_moveToEndOfParagraph:withHistory:)
28982897 || action == @selector(_moveToEndOfWord:withHistory:) || action == @selector(_moveToStartOfDocument:withHistory:) || action == @selector(_moveToStartOfLine:withHistory:)
2899  || action == @selector(_moveToStartOfParagraph:withHistory:) || action == @selector(_moveToStartOfWord:withHistory:) || action == @selector(_moveUp:withHistory:)
 2898 || action == @selector(_moveToStartOfParagraph:withHistory:) || action == @selector(_moveToStartOfWord:withHistory:) || action == @selector(_moveUp:withHistory:))
 2899 return YES;
 2900
 2901 if (action == @selector(_deleteByWord) || action == @selector(_deleteForwardAndNotify:) || action == @selector(_deleteToEndOfParagraph) || action == @selector(_deleteToStartOfLine)
29002902 || action == @selector(_transpose))
29012903 return editorState.isContentEditable;
29022904

LayoutTests/ChangeLog

 12019-06-25 Daniel Bates <dabates@apple.com>
 2
 3 Non-editable text selections should be modifiable with hardware keyboard
 4 https://bugs.webkit.org/show_bug.cgi?id=199204
 5 <rdar://problem/51651496>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Add a test, skipped for now, until we have the fix for <rdar://problem/48322899>.
 10
 11 * editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt: Added.
 12 * editing/selection/ios/select-non-editable-text-using-keyboard.html: Added.
 13 * platform/ios/TestExpectations:
 14 * resources/ui-helper.js:
 15 (window.UIHelper.callFunctionAndWaitForEvent): Added.
 16
1172019-06-25 Truitt Savell <tsavell@apple.com>
218
319 [macOS WK2] REGRESSION (r242313): Layout Test scrollingcoordinator/mac/multiple-fixed.html is a flaky time out and image diff

LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt

 1Test selecting non-editable text using the keyboard.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6
 7Press Shift + right arrow to select the next character:
 8PASS window.getSelection().toString() is "He"
 9
 10Press Shift + left arrow to select the previous character:
 11PASS window.getSelection().toString() is "Her"
 12
 13Press Shift + Option + right arrow to select to the end of the word:
 14PASS window.getSelection().toString() is "Here's "
 15
 16Press Shift + Option + left arrow to select to the beginning of the word:
 17PASS window.getSelection().toString() is "The"
 18
 19Press Shift + Control + right arrow to select to the end of the line:
 20PASS window.getSelection().toString() is "Here's to the crazy ones."
 21
 22Press Shift + Control + left arrow to select to the beginning of the line:
 23PASS window.getSelection().toString() is "The misfits."
 24
 25Press Shift + up arrow to select up:
 26PASS window.getSelection().toString() is "Here's to the crazy ones.\n\nT"
 27
 28Press Shift + down arrow to select down:
 29PASS window.getSelection().toString() is "The misfits.\n\nT"
 30
 31Press Shift + Option + down arrow to select to the end of the paragraph:
 32PASS window.getSelection().toString() is "Here's to the crazy ones."
 33
 34Press Shift + Option + up arrow to select to the beginning of the paragraph:
 35PASS window.getSelection().toString() is "The rebels."
 36
 37Press Shift + Control + down arrow to select to the end of the document:
 38PASS window.getSelection().toString() is "Here's to the crazy ones.\n\nThe misfits.\n\nThe rebels."
 39
 40Press Shift + Control + up arrow to select to the beginning of the document:
 41PASS window.getSelection().toString() is "Here's to the crazy ones.\n\nThe misfits."
 42PASS successfullyParsed is true
 43
 44TEST COMPLETE
 45

LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<script src="../../../resources/js-test.js"></script>
 5<script src="../../../resources/ui-helper.js"></script>
 6<style>
 7body.hide-everything-except-test-container > :not(#test-container) {
 8 display: none;
 9}
 10</style>
 11</head>
 12<body>
 13<div id="test-container">
 14 <p>Here's to the crazy ones.</p>
 15 <p>The misfits.</p>
 16 <p>The rebels.</p>
 17</div>
 18<script>
 19let testContainer = document.getElementById("test-container");
 20let paragraphs = testContainer.children;
 21let selection = window.getSelection();
 22
 23function toggleOnlyShowTestContainer()
 24{
 25 document.body.classList.toggle("hide-everything-except-test-container");
 26}
 27
 28async function testExtendSelectionToNextCharacter()
 29{
 30 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange");
 31
 32 debug("<br>Press Shift + right arrow to select the next character:");
 33 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey"]) , document, "selectionchange");
 34 shouldBeEqualToString("window.getSelection().toString()", "He");
 35}
 36
 37async function testExtendSelectionToPreviousCharacter()
 38{
 39 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 3, paragraphs[0].firstChild, 1), document, "selectionchange");
 40
 41 debug("<br>Press Shift + left arrow to select the previous character:");
 42 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("leftArrow", ["shiftKey"]) , document, "selectionchange");
 43 shouldBeEqualToString("window.getSelection().toString()", "Her");
 44}
 45
 46async function testExtendSelectionToEndOfWord()
 47{
 48 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange");
 49
 50 debug("<br>Press Shift + Option + right arrow to select to the end of the word:");
 51 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
 52 shouldBeEqualToString("window.getSelection().toString()", "Here's ");
 53}
 54
 55async function testExtendSelectionToBeginningOfWord()
 56{
 57 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 3, paragraphs[1].firstChild, 1), document, "selectionchange");
 58
 59 debug("<br>Press Shift + Option + left arrow to select to the beginning of the word:");
 60 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("leftArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
 61 shouldBeEqualToString("window.getSelection().toString()", "The");
 62}
 63
 64async function textExtendSelectionToEndOfLine()
 65{
 66 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange");
 67
 68 debug("<br>Press Shift + Control + right arrow to select to the end of the line:");
 69 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange");
 70 shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.");
 71}
 72
 73async function testExtendSelectionToBeginningOfLine()
 74{
 75 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, paragraphs[1].firstChild.length, paragraphs[1].firstChild, paragraphs[1].firstChild.length - 1), document, "selectionchange");
 76
 77 debug("<br>Press Shift + Control + left arrow to select to the beginning of the line:");
 78 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("leftArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange");
 79 shouldBeEqualToString("window.getSelection().toString()", "The misfits.");
 80}
 81
 82async function testExtendSelectionUp()
 83{
 84 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 1, paragraphs[1].firstChild, 0), document, "selectionchange");
 85
 86 debug("<br>Press Shift + up arrow to select up:");
 87 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey"]) , document, "selectionchange");
 88 shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nT");
 89}
 90
 91async function testExtendSelectionDown()
 92{
 93 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 0, paragraphs[1].firstChild, 1), document, "selectionchange");
 94
 95 debug("<br>Press Shift + down arrow to select down:");
 96 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey"]) , document, "selectionchange");
 97 shouldBeEqualToString("window.getSelection().toString()", "The misfits.\n\nT");
 98}
 99
 100async function testExtendSelectionToEndOfParagraph()
 101{
 102 toggleOnlyShowTestContainer();
 103
 104 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange");
 105
 106 debug("<br>Press Shift + Option + down arrow to select to the end of the paragraph:");
 107 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
 108 shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.");
 109
 110 toggleOnlyShowTestContainer();
 111}
 112
 113async function testExtendSelectionToBeginningOfParagraph()
 114{
 115 toggleOnlyShowTestContainer();
 116
 117 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[2].firstChild, paragraphs[2].firstChild.length, paragraphs[2].firstChild, paragraphs[2].firstChild.length - 1), document, "selectionchange");
 118
 119 debug("<br>Press Shift + Option + up arrow to select to the beginning of the paragraph:");
 120 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
 121 shouldBeEqualToString("window.getSelection().toString()", "The rebels.");
 122
 123 toggleOnlyShowTestContainer();
 124}
 125
 126async function testExtendSelectionToEndOfDocument()
 127{
 128 toggleOnlyShowTestContainer();
 129
 130 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange");
 131
 132 debug("<br>Press Shift + Control + down arrow to select to the end of the document:");
 133 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange");
 134 shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nThe misfits.\n\nThe rebels.");
 135
 136 toggleOnlyShowTestContainer();
 137}
 138
 139async function testExtendSelectionToBeginningOfDocument()
 140{
 141 toggleOnlyShowTestContainer();
 142
 143 await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, paragraphs[1].firstChild.length, paragraphs[1].firstChild, paragraphs[1].firstChild.length - 1), document, "selectionchange");
 144
 145 debug("<br>Press Shift + Control + up arrow to select to the beginning of the document:");
 146 await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange");
 147 shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nThe misfits.");
 148
 149 toggleOnlyShowTestContainer();
 150}
 151
 152async function runTests()
 153{
 154 await testExtendSelectionToNextCharacter();
 155 await testExtendSelectionToPreviousCharacter();
 156 await testExtendSelectionToEndOfWord();
 157 await testExtendSelectionToBeginningOfWord();
 158 await textExtendSelectionToEndOfLine();
 159 await testExtendSelectionToBeginningOfLine();
 160 await testExtendSelectionUp();
 161 await testExtendSelectionDown();
 162 await testExtendSelectionToEndOfParagraph();
 163 await testExtendSelectionToBeginningOfParagraph();
 164 await testExtendSelectionToEndOfDocument();
 165 await testExtendSelectionToBeginningOfDocument();
 166
 167 document.body.removeChild(document.getElementById("test-container"));
 168 finishJSTest();
 169}
 170
 171window.jsTestIsAsync = true;
 172description("Test selecting non-editable text using the keyboard.");
 173runTests();
 174</script>
 175</body>
 176</html>

LayoutTests/platform/ios/TestExpectations

@@webkit.org/b/197778 [ Debug ] webgl/2.0.0/conformance2/attribs/gl-vertexattribip
32513251
32523252# Was unskipped, but now has missing results in iOS . Skipping on iOS only.
32533253media/controls-after-reload.html [ Skip ]
 3254
 3255# FIXME: Unskip the following test once we have the fix for <rdar://problem/48322899>.
 3256editing/selection/ios/select-non-editable-text-using-keyboard.html [ Skip ]

LayoutTests/resources/ui-helper.js

@@window.UIHelper = class UIHelper {
899899 await this.activateAt(menuRect.left + menuRect.width / 2, menuRect.top + menuRect.height / 2);
900900 }
901901
 902 static callFunctionAndWaitForEvent(functionToCall, target, eventName)
 903 {
 904 return new Promise((resolve) => {
 905 target.addEventListener(eventName, resolve, { once: true });
 906 functionToCall();
 907 });
 908
 909 }
 910
902911 static callFunctionAndWaitForScrollToFinish(functionToCall, ...theArguments)
903912 {
904913 return new Promise((resolved) => {