WebKit Bugzilla
Attachment 372259 Details for
Bug 198925
: [iOS] Pressing key while holding Command should not insert character
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch and test
bug-198925-20190617113030.patch (text/plain), 5.21 KB, created by
Daniel Bates
on 2019-06-17 11:30:30 PDT
(
hide
)
Description:
Patch and test
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-06-17 11:30:30 PDT
Size:
5.21 KB
patch
obsolete
>Subversion Revision: 246325 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 39c18e702d75808b31e6cc4bcb1f34f5a72722e9..d5b27b44b27797f28ef29ac02303377b6030dc41 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2019-06-17 Daniel Bates <dabates@apple.com> >+ >+ [iOS] Pressing key while holding Command should not insert character >+ https://bugs.webkit.org/show_bug.cgi?id=198925 >+ <rdar://problem/51778811> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Do not insert a character for an unhandled key command that has a Command modifier. >+ For example, pressing Command + Shift + v, which is an unhandled key command (at the >+ time of writing) should not insert v. This matches iOS and Mac platform conventions. >+ >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _interpretKeyEvent:isCharEvent:]): >+ > 2019-05-16 Daniel Bates <dabates@apple.com> > > [iOS] Select all with existing range selection replaces range instead of selecting all text >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 91f625c0e2870576c95a7399ac8473aad8a6b709..1d68a030d5b7bc386c65e161373ee67fff45e97b 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -4663,6 +4663,10 @@ - (BOOL)_interpretKeyEvent:(::WebEvent *)event isCharEvent:(BOOL)isCharEvent > return YES; > #endif > >+ // Don't insert character for an unhandled Command-key key command. This matches iOS and Mac platform conventions. >+ if (event.modifierFlags & WebEventFlagMaskCommandKey) >+ return NO; >+ > NSString *characters = event.characters; > if (!characters.length) > return NO; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a1e7a143a284d862f02649a56120342ac3f56108..2c663e2815d8b77b45b6753e3c43390968caff99 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2019-06-17 Daniel Bates <dabates@apple.com> >+ >+ [iOS] Pressing key while holding Command should not insert character >+ https://bugs.webkit.org/show_bug.cgi?id=198925 >+ <rdar://problem/51778811> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test that Command + Shift + v does not insert a v as we don't expect it >+ to as of the time of writing. A more comprehensive test would be needed to >+ ensure that all unhandled key commands with Command modifiers do not insert >+ a character. For now, the added test seems good enough. >+ >+ * fast/events/ios/command+shift+v-should-not-insert-v-expected.txt: Added. >+ * fast/events/ios/command+shift+v-should-not-insert-v.html: Added. >+ > 2019-06-13 Daniel Bates <dabates@apple.com> > > [iOS] Normalize test result of fast/events/ios/keyboard-event-key-attribute.html to handle possible modifier dispatch >diff --git a/LayoutTests/fast/events/ios/command+shift+v-should-not-insert-v-expected.txt b/LayoutTests/fast/events/ios/command+shift+v-should-not-insert-v-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6c1447410f5e8e85ee015973dbfff7519b8fd8a2 >--- /dev/null >+++ b/LayoutTests/fast/events/ios/command+shift+v-should-not-insert-v-expected.txt >@@ -0,0 +1,10 @@ >+Tests that Command + Shift + v does not insert v and that pressing a does insert an a. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS window.event.data is "a" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/events/ios/command+shift+v-should-not-insert-v.html b/LayoutTests/fast/events/ios/command+shift+v-should-not-insert-v.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fab6468b1d80cac8debcfe5e3ada95f36d146f56 >--- /dev/null >+++ b/LayoutTests/fast/events/ios/command+shift+v-should-not-insert-v.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<script> >+window.jsTestIsAsync = true; >+ >+let testElement; >+ >+function checkTextInput(event) >+{ >+ shouldBeEqualToString("window.event.data", "a"); >+ document.body.removeChild(testElement); >+ finishJSTest(); >+} >+ >+function handleFocus() >+{ >+ testElement.addEventListener("input", checkTextInput, { once: true }); >+ if (window.testRunner) { >+ UIHelper.keyDown("v", ["metaKey", "shiftKey"]); // Should emit no TextInput event. >+ UIHelper.keyDown("a"); // To end the test. >+ } >+} >+ >+function runTest() >+{ >+ testElement = document.getElementById("test"); >+ >+ description("Tests that <kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>v</kbd> does not insert v and that pressing <kbd>a</kbd> does insert an a."); >+ >+ testElement.addEventListener("focus", handleFocus, { once: true }); >+ if (window.testRunner) >+ UIHelper.activateFormControl(testElement); >+ else >+ testElement.focus(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<p id="description"></p> >+<div id="console"></div> >+<input type="text" id="test" placeholder="Press Command + Shift + v. Then press a." style="width: 300px"></div> >+</body> >+</html>
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 198925
: 372259