Title: [238033] trunk
Revision
238033
Author
[email protected]
Date
2018-11-09 09:06:50 -0800 (Fri, 09 Nov 2018)

Log Message

[iOS] Pressing forward delete key in text field does nothing and we should not invoke an editor
action when forward delete is pressed outside a text field
https://bugs.webkit.org/show_bug.cgi?id=190566
<rdar://problem/45262367>

Reviewed by Wenson Hsieh.

Source/WebKit:

Override -_deleteForwardAndNotify to perform a forward deletion and remove the dead code that
expected UIKit to send us a character string with 0xF728 for the forward delete key. UIKit
ceased doing this many years ago. We may revist this decision once <rdar://problem/45772078>
is fixed.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _interpretKeyEvent:isCharEvent:]):
(-[WKContentView _deleteForwardAndNotify:]):

Source/WebKitLegacy/mac:

Remove dead code. UIKit ceased sending us a character string with 0xF728 for the forward delete
key many years ago. We will need to fix up iOS Legacy WebKit support for the forward delete key
in UIKit. We may revist this decision once <rdar://problem/45772078> is fixed.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _handleEditingKeyEvent:]):

LayoutTests:

Add a test to ensure that pressing the forward delete key deletes the next character.

* fast/events/ios/forward-delete-in-editable-expected.txt: Added.
* fast/events/ios/forward-delete-in-editable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238032 => 238033)


--- trunk/LayoutTests/ChangeLog	2018-11-09 16:42:49 UTC (rev 238032)
+++ trunk/LayoutTests/ChangeLog	2018-11-09 17:06:50 UTC (rev 238033)
@@ -1,3 +1,17 @@
+2018-11-09  Daniel Bates  <[email protected]>
+
+        [iOS] Pressing forward delete key in text field does nothing and we should not invoke an editor
+        action when forward delete is pressed outside a text field
+        https://bugs.webkit.org/show_bug.cgi?id=190566
+        <rdar://problem/45262367>
+
+        Reviewed by Wenson Hsieh.
+
+        Add a test to ensure that pressing the forward delete key deletes the next character.
+
+        * fast/events/ios/forward-delete-in-editable-expected.txt: Added.
+        * fast/events/ios/forward-delete-in-editable.html: Added.
+
 2018-11-09  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r236365): [GTK] Many form-related tests are failing

Added: trunk/LayoutTests/fast/events/ios/forward-delete-in-editable-expected.txt (0 => 238033)


--- trunk/LayoutTests/fast/events/ios/forward-delete-in-editable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/forward-delete-in-editable-expected.txt	2018-11-09 17:06:50 UTC (rev 238033)
@@ -0,0 +1,10 @@
+Tests that pressing the forward delete key in an editable element deletes the next character. To run this test manually, press the forward delete key and then click Check Result.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("input").value is "ext"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/ios/forward-delete-in-editable.html (0 => 238033)


--- trunk/LayoutTests/fast/events/ios/forward-delete-in-editable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/forward-delete-in-editable.html	2018-11-09 17:06:50 UTC (rev 238033)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="test-container">
+    <input type="text" id="input" value="Text">
+    <button _onclick_="checkResultAndNotifyDone()">Check Result</button>
+</div>
+<script>
+window.jsTestIsAsync = true;
+
+description("Tests that pressing the forward delete key in an editable element deletes the next character. To run this test  manually, press the forward delete key and then click Check Result.");
+
+runTest();
+
+async function runTest()
+{
+    let inputElement = document.getElementById("input");
+    if (!window.testRunner) {
+        inputElement.focus();
+        inputElement.setSelectionRange(0, 0);
+        return;
+    }
+    // FIXME: We cannot listen for a keyup event because the forward delete key does not generate one
+    // due to <rdar://problem/45772078>. So, we listen for a blur event.
+    inputElement.addEventListener("blur", checkResultAndNotifyDone, {once: true});
+    await UIHelper.activateFormControl(inputElement);
+    inputElement.setSelectionRange(0, 0);
+    await UIHelper.typeCharacter("forwardDelete");
+    inputElement.blur();
+}
+
+function checkResultAndNotifyDone()
+{
+    shouldBeEqualToString('document.getElementById("input").value', "ext");
+    document.body.removeChild(document.getElementById("test-container"));
+    finishJSTest();
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebKit/ChangeLog (238032 => 238033)


--- trunk/Source/WebKit/ChangeLog	2018-11-09 16:42:49 UTC (rev 238032)
+++ trunk/Source/WebKit/ChangeLog	2018-11-09 17:06:50 UTC (rev 238033)
@@ -1,3 +1,21 @@
+2018-11-09  Daniel Bates  <[email protected]>
+
+        [iOS] Pressing forward delete key in text field does nothing and we should not invoke an editor
+        action when forward delete is pressed outside a text field
+        https://bugs.webkit.org/show_bug.cgi?id=190566
+        <rdar://problem/45262367>
+
+        Reviewed by Wenson Hsieh.
+
+        Override -_deleteForwardAndNotify to perform a forward deletion and remove the dead code that
+        expected UIKit to send us a character string with 0xF728 for the forward delete key. UIKit
+        ceased doing this many years ago. We may revist this decision once <rdar://problem/45772078>
+        is fixed.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _interpretKeyEvent:isCharEvent:]):
+        (-[WKContentView _deleteForwardAndNotify:]):
+
 2018-11-08  Wenson Hsieh  <[email protected]>
 
         Unreviewed, try to fix the 32-bit macOS build

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (238032 => 238033)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-11-09 16:42:49 UTC (rev 238032)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-11-09 17:06:50 UTC (rev 238033)
@@ -3823,7 +3823,6 @@
     static const unsigned kWebBackspaceKey = 0x0008;
     static const unsigned kWebReturnKey = 0x000D;
     static const unsigned kWebDeleteKey = 0x007F;
-    static const unsigned kWebDeleteForwardKey = 0xF728;
     static const unsigned kWebSpaceKey = 0x20;
 
     if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)
@@ -3868,10 +3867,6 @@
         }
         break;
 
-    case kWebDeleteForwardKey:
-        _page->executeEditCommand("deleteForward"_s);
-        return YES;
-
     default:
         if (contentEditable && isCharEvent) {
             [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint];
@@ -3942,6 +3937,11 @@
     [self executeEditCommandWithCallback:@"deleteToEndOfLine"];
 }
 
+- (void)_deleteForwardAndNotify:(BOOL)notify
+{
+    [self executeEditCommandWithCallback:@"deleteForward"];
+}
+
 - (UITextInputArrowKeyHistory *)_moveUp:(BOOL)extending withHistory:(UITextInputArrowKeyHistory *)history
 {
     [self executeEditCommandWithCallback:extending ? @"moveUpAndModifySelection" : @"moveUp"];

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (238032 => 238033)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-11-09 16:42:49 UTC (rev 238032)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-11-09 17:06:50 UTC (rev 238033)
@@ -1,3 +1,19 @@
+2018-11-09  Daniel Bates  <[email protected]>
+
+        [iOS] Pressing forward delete key in text field does nothing and we should not invoke an editor
+        action when forward delete is pressed outside a text field
+        https://bugs.webkit.org/show_bug.cgi?id=190566
+        <rdar://problem/45262367>
+
+        Reviewed by Wenson Hsieh.
+
+        Remove dead code. UIKit ceased sending us a character string with 0xF728 for the forward delete
+        key many years ago. We will need to fix up iOS Legacy WebKit support for the forward delete key
+        in UIKit. We may revist this decision once <rdar://problem/45772078> is fixed.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _handleEditingKeyEvent:]):
+
 2018-11-08  Megan Gardner  <[email protected]>
 
         Adopt Reveal Framework to replace Lookup

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (238032 => 238033)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2018-11-09 16:42:49 UTC (rev 238032)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2018-11-09 17:06:50 UTC (rev 238033)
@@ -6054,7 +6054,6 @@
 #define kWebBackspaceKey     0x0008
 #define kWebReturnKey        0x000d
 #define kWebDeleteKey        0x007F
-#define kWebDeleteForwardKey 0xF728
     
 - (BOOL)_handleEditingKeyEvent:(KeyboardEvent *)wcEvent
 {
@@ -6089,9 +6088,6 @@
                 return YES;
             }
             break;
-        case kWebDeleteForwardKey:
-            [self deleteForward:self];
-            return YES;
         default:
             if (platformEvent->type() == PlatformKeyboardEvent::Char) {
                 [[webView _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to