WebKit Bugzilla
Attachment 372865 Details for
Bug 199204
: Non-editable text selections should be modifiable with hardware keyboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199204-20190625144004.patch (text/plain), 16.57 KB, created by
Daniel Bates
on 2019-06-25 14:40:05 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-06-25 14:40:05 PDT
Size:
16.57 KB
patch
obsolete
>Subversion Revision: 246809 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3606540b3dfcd41dca9862d77e64de922e31f2ad..0e84d907b7aaff4e1af9ee6fe3d35c0baca3beef 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2019-06-25 Daniel Bates <dabates@apple.com> >+ >+ Non-editable text selections should be modifiable with hardware keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=199204 >+ <rdar://problem/51651496> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ UIKit changes are need for this to work, including <rdar://problem/48322899>. >+ Note that without these changes, -canPerformAction is never called for _move* >+ selectors. >+ >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView canPerformAction:withSender:]): >+ > 2019-06-25 Alex Christensen <achristensen@webkit.org> > > Make HTTPCookieAcceptPolicy an enum class >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 4d42f0b01eaa1e15e64ad49ac41a7d8d5702c6e9..323c6cf919f708818b19e956238a9617d48a1e42 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -2892,11 +2892,13 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender > > // These are UIKit IPI selectors. We don't want to forward them to the web view. > auto editorState = _page->editorState(); >- if (action == @selector(_deleteByWord) || action == @selector(_deleteForwardAndNotify:) || action == @selector(_deleteToEndOfParagraph) || action == @selector(_deleteToStartOfLine) >- || action == @selector(_moveDown:withHistory:) || action == @selector(_moveLeft:withHistory:) || action == @selector(_moveRight:withHistory:) >+ if (action == @selector(_moveDown:withHistory:) || action == @selector(_moveLeft:withHistory:) || action == @selector(_moveRight:withHistory:) > || action == @selector(_moveToEndOfDocument:withHistory:) || action == @selector(_moveToEndOfLine:withHistory:) || action == @selector(_moveToEndOfParagraph:withHistory:) > || action == @selector(_moveToEndOfWord:withHistory:) || action == @selector(_moveToStartOfDocument:withHistory:) || action == @selector(_moveToStartOfLine:withHistory:) >- || action == @selector(_moveToStartOfParagraph:withHistory:) || action == @selector(_moveToStartOfWord:withHistory:) || action == @selector(_moveUp:withHistory:) >+ || action == @selector(_moveToStartOfParagraph:withHistory:) || action == @selector(_moveToStartOfWord:withHistory:) || action == @selector(_moveUp:withHistory:)) >+ return YES; >+ >+ if (action == @selector(_deleteByWord) || action == @selector(_deleteForwardAndNotify:) || action == @selector(_deleteToEndOfParagraph) || action == @selector(_deleteToStartOfLine) > || action == @selector(_transpose)) > return editorState.isContentEditable; > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f47c6f0260aff2ea3d09727669ac226281ac3b0a..0c1eed6bf1d47bd10f3f6083b454712dc4c67a52 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2019-06-25 Daniel Bates <dabates@apple.com> >+ >+ Non-editable text selections should be modifiable with hardware keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=199204 >+ <rdar://problem/51651496> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test, skipped for now, until we have the fix for <rdar://problem/48322899>. >+ >+ * editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt: Added. >+ * editing/selection/ios/select-non-editable-text-using-keyboard.html: Added. >+ * platform/ios/TestExpectations: >+ * resources/ui-helper.js: >+ (window.UIHelper.callFunctionAndWaitForEvent): Added. >+ > 2019-06-25 Truitt Savell <tsavell@apple.com> > > [macOS WK2] REGRESSION (r242313): Layout Test scrollingcoordinator/mac/multiple-fixed.html is a flaky time out and image diff >diff --git a/LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt b/LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..be2232e52219f1b23ae82ecfed55611185af9b32 >--- /dev/null >+++ b/LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt >@@ -0,0 +1,45 @@ >+Test selecting non-editable text using the keyboard. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+ >+Press Shift + right arrow to select the next character: >+PASS window.getSelection().toString() is "He" >+ >+Press Shift + left arrow to select the previous character: >+PASS window.getSelection().toString() is "Her" >+ >+Press Shift + Option + right arrow to select to the end of the word: >+PASS window.getSelection().toString() is "Here's " >+ >+Press Shift + Option + left arrow to select to the beginning of the word: >+PASS window.getSelection().toString() is "The" >+ >+Press Shift + Control + right arrow to select to the end of the line: >+PASS window.getSelection().toString() is "Here's to the crazy ones." >+ >+Press Shift + Control + left arrow to select to the beginning of the line: >+PASS window.getSelection().toString() is "The misfits." >+ >+Press Shift + up arrow to select up: >+PASS window.getSelection().toString() is "Here's to the crazy ones.\n\nT" >+ >+Press Shift + down arrow to select down: >+PASS window.getSelection().toString() is "The misfits.\n\nT" >+ >+Press Shift + Option + down arrow to select to the end of the paragraph: >+PASS window.getSelection().toString() is "Here's to the crazy ones." >+ >+Press Shift + Option + up arrow to select to the beginning of the paragraph: >+PASS window.getSelection().toString() is "The rebels." >+ >+Press Shift + Control + down arrow to select to the end of the document: >+PASS window.getSelection().toString() is "Here's to the crazy ones.\n\nThe misfits.\n\nThe rebels." >+ >+Press Shift + Control + up arrow to select to the beginning of the document: >+PASS window.getSelection().toString() is "Here's to the crazy ones.\n\nThe misfits." >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard.html b/LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e14810a6275fab3c11049ef76b44deb78272af19 >--- /dev/null >+++ b/LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard.html >@@ -0,0 +1,176 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<style> >+body.hide-everything-except-test-container > :not(#test-container) { >+ display: none; >+} >+</style> >+</head> >+<body> >+<div id="test-container"> >+ <p>Here's to the crazy ones.</p> >+ <p>The misfits.</p> >+ <p>The rebels.</p> >+</div> >+<script> >+let testContainer = document.getElementById("test-container"); >+let paragraphs = testContainer.children; >+let selection = window.getSelection(); >+ >+function toggleOnlyShowTestContainer() >+{ >+ document.body.classList.toggle("hide-everything-except-test-container"); >+} >+ >+async function testExtendSelectionToNextCharacter() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + right arrow to select the next character:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "He"); >+} >+ >+async function testExtendSelectionToPreviousCharacter() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 3, paragraphs[0].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + left arrow to select the previous character:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("leftArrow", ["shiftKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Her"); >+} >+ >+async function testExtendSelectionToEndOfWord() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Option + right arrow to select to the end of the word:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey", "altKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Here's "); >+} >+ >+async function testExtendSelectionToBeginningOfWord() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 3, paragraphs[1].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Option + left arrow to select to the beginning of the word:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("leftArrow", ["shiftKey", "altKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "The"); >+} >+ >+async function textExtendSelectionToEndOfLine() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Control + right arrow to select to the end of the line:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones."); >+} >+ >+async function testExtendSelectionToBeginningOfLine() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, paragraphs[1].firstChild.length, paragraphs[1].firstChild, paragraphs[1].firstChild.length - 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Control + left arrow to select to the beginning of the line:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("leftArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "The misfits."); >+} >+ >+async function testExtendSelectionUp() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 1, paragraphs[1].firstChild, 0), document, "selectionchange"); >+ >+ debug("<br>Press Shift + up arrow to select up:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nT"); >+} >+ >+async function testExtendSelectionDown() >+{ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 0, paragraphs[1].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + down arrow to select down:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "The misfits.\n\nT"); >+} >+ >+async function testExtendSelectionToEndOfParagraph() >+{ >+ toggleOnlyShowTestContainer(); >+ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Option + down arrow to select to the end of the paragraph:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey", "altKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones."); >+ >+ toggleOnlyShowTestContainer(); >+} >+ >+async function testExtendSelectionToBeginningOfParagraph() >+{ >+ toggleOnlyShowTestContainer(); >+ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[2].firstChild, paragraphs[2].firstChild.length, paragraphs[2].firstChild, paragraphs[2].firstChild.length - 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Option + up arrow to select to the beginning of the paragraph:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey", "altKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "The rebels."); >+ >+ toggleOnlyShowTestContainer(); >+} >+ >+async function testExtendSelectionToEndOfDocument() >+{ >+ toggleOnlyShowTestContainer(); >+ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[0].firstChild, 0, paragraphs[0].firstChild, 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Control + down arrow to select to the end of the document:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nThe misfits.\n\nThe rebels."); >+ >+ toggleOnlyShowTestContainer(); >+} >+ >+async function testExtendSelectionToBeginningOfDocument() >+{ >+ toggleOnlyShowTestContainer(); >+ >+ await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, paragraphs[1].firstChild.length, paragraphs[1].firstChild, paragraphs[1].firstChild.length - 1), document, "selectionchange"); >+ >+ debug("<br>Press Shift + Control + up arrow to select to the beginning of the document:"); >+ await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange"); >+ shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nThe misfits."); >+ >+ toggleOnlyShowTestContainer(); >+} >+ >+async function runTests() >+{ >+ await testExtendSelectionToNextCharacter(); >+ await testExtendSelectionToPreviousCharacter(); >+ await testExtendSelectionToEndOfWord(); >+ await testExtendSelectionToBeginningOfWord(); >+ await textExtendSelectionToEndOfLine(); >+ await testExtendSelectionToBeginningOfLine(); >+ await testExtendSelectionUp(); >+ await testExtendSelectionDown(); >+ await testExtendSelectionToEndOfParagraph(); >+ await testExtendSelectionToBeginningOfParagraph(); >+ await testExtendSelectionToEndOfDocument(); >+ await testExtendSelectionToBeginningOfDocument(); >+ >+ document.body.removeChild(document.getElementById("test-container")); >+ finishJSTest(); >+} >+ >+window.jsTestIsAsync = true; >+description("Test selecting non-editable text using the keyboard."); >+runTests(); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 453d55822ed2b5a72e40bae0cdfb4303192b1b87..914cca66b11d696ba434c6edf1cff76ca3fa7a6a 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -3251,3 +3251,6 @@ webkit.org/b/197778 [ Debug ] webgl/2.0.0/conformance2/attribs/gl-vertexattribip > > # Was unskipped, but now has missing results in iOS . Skipping on iOS only. > media/controls-after-reload.html [ Skip ] >+ >+# FIXME: Unskip the following test once we have the fix for <rdar://problem/48322899>. >+editing/selection/ios/select-non-editable-text-using-keyboard.html [ Skip ] >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 5226b870dbdebfd7e3cabe2072cf96c746393298..9eb97d070eeb4d0cd4c4c89d1ed8650f4c55cebc 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -899,6 +899,15 @@ window.UIHelper = class UIHelper { > await this.activateAt(menuRect.left + menuRect.width / 2, menuRect.top + menuRect.height / 2); > } > >+ static callFunctionAndWaitForEvent(functionToCall, target, eventName) >+ { >+ return new Promise((resolve) => { >+ target.addEventListener(eventName, resolve, { once: true }); >+ functionToCall(); >+ }); >+ >+ } >+ > static callFunctionAndWaitForScrollToFinish(functionToCall, ...theArguments) > { > return new Promise((resolved) => {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199204
:
372863
| 372865