WebKit Bugzilla
Attachment 372863 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-20190625143630.patch (text/plain), 16.69 KB, created by
Daniel Bates
on 2019-06-25 14:36:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-06-25 14:36:31 PDT
Size:
16.69 KB
patch
obsolete
>Subversion Revision: 246682 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 1533a9dddfb874353629c6dcd3b56ac864711ced..a5511ae0db12cde684fd19c7cd2d5a578167ab96 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-21 Daniel Bates <dabates@apple.com> > > [iOS] Should not process key events in non-editable elements using IME >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 86da5ead2de6f01b2dcd484c2b80083efe9f8a09..b3e16f2417b133ce6c98171a62daf1e30df3528f 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -2876,11 +2876,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 15147ed26309bc99fcba3eef78c7509fa2d5e7d2..ed11f0c83f206db93027ed14dddb62d2194c05a5 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-21 Daniel Bates <dabates@apple.com> > > [iOS] Should not process key events in non-editable elements using IME >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 7e9dd8d8cc366d23cbb868db0de7f0e55a2e59bd..dc28c42f108ff1bcb3e6866073d8485f0bd42922 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -3252,5 +3252,8 @@ 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 ] >+ > # FIXME: Unskip the following test once we have the fix for <rdar://problem/46430796>. > fast/events/ios/key-command-select-all-prevent-default.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