Title: [244471] trunk/Source
Revision
244471
Author
[email protected]
Date
2019-04-19 14:53:22 -0700 (Fri, 19 Apr 2019)

Log Message

Use existing KeyEventCodesIOS constants instead of duplicating them
https://bugs.webkit.org/show_bug.cgi?id=197081

Rubber-stamped by Wenson Hsieh.

Source/WebKit:

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
as it is identical to the default switch case.

Source/WebKitLegacy/mac:

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244470 => 244471)


--- trunk/Source/WebKit/ChangeLog	2019-04-19 21:47:32 UTC (rev 244470)
+++ trunk/Source/WebKit/ChangeLog	2019-04-19 21:53:22 UTC (rev 244471)
@@ -1,3 +1,14 @@
+2019-04-18  Daniel Bates  <[email protected]>
+
+        Use existing KeyEventCodesIOS constants instead of duplicating them
+        https://bugs.webkit.org/show_bug.cgi?id=197081
+
+        Rubber-stamped by Wenson Hsieh.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
+        as it is identical to the default switch case.
+
 2019-04-19  Keith Rollin  <[email protected]>
 
         Add postprocess-header-rule scripts

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (244470 => 244471)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-04-19 21:47:32 UTC (rev 244470)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-04-19 21:53:22 UTC (rev 244471)
@@ -83,6 +83,7 @@
 #import <WebCore/FloatQuad.h>
 #import <WebCore/FontAttributeChanges.h>
 #import <WebCore/InputMode.h>
+#import <WebCore/KeyEventCodesIOS.h>
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/Pasteboard.h>
@@ -4503,12 +4504,6 @@
 
 - (BOOL)_interpretKeyEvent:(::WebEvent *)event isCharEvent:(BOOL)isCharEvent
 {
-    static const unsigned kWebEnterKey = 0x0003;
-    static const unsigned kWebBackspaceKey = 0x0008;
-    static const unsigned kWebReturnKey = 0x000D;
-    static const unsigned kWebDeleteKey = 0x007F;
-    static const unsigned kWebSpaceKey = 0x20;
-
     if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)
         return NO;
 
@@ -4534,30 +4529,21 @@
         return NO;
 
     switch ([characters characterAtIndex:0]) {
-    case kWebBackspaceKey:
-    case kWebDeleteKey:
+    case NSBackspaceCharacter:
+    case NSDeleteCharacter:
         if (contentEditable) {
             [keyboard deleteFromInputWithFlags:event.keyboardFlags];
             return YES;
         }
         break;
-
-    case kWebSpaceKey:
+    case NSEnterCharacter:
+    case NSCarriageReturnCharacter:
         if (contentEditable && isCharEvent) {
-            [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint];
-            return YES;
-        }
-        break;
-
-    case kWebEnterKey:
-    case kWebReturnKey:
-        if (contentEditable && isCharEvent) {
             // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
             [keyboard addInputString:@"\n" withFlags:0 withInputManagerHint:nil];
             return YES;
         }
         break;
-
     default:
         if (contentEditable && isCharEvent) {
             [keyboard addInputString:event.characters withFlags:event.keyboardFlags withInputManagerHint:event.inputManagerHint];

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (244470 => 244471)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-04-19 21:47:32 UTC (rev 244470)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-04-19 21:53:22 UTC (rev 244471)
@@ -1,3 +1,13 @@
+2019-04-18  Daniel Bates  <[email protected]>
+
+        Use existing KeyEventCodesIOS constants instead of duplicating them
+        https://bugs.webkit.org/show_bug.cgi?id=197081
+
+        Rubber-stamped by Wenson Hsieh.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _handleEditingKeyEvent:]):
+
 2019-04-18  Ryosuke Niwa  <[email protected]>
 
         Crash in FrameLoader::stopAllLoaders via [WebView dealloc] inside ~ObjCEventListener

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (244470 => 244471)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-04-19 21:47:32 UTC (rev 244470)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-04-19 21:53:22 UTC (rev 244471)
@@ -6069,11 +6069,6 @@
 
 #if PLATFORM(IOS_FAMILY)
     
-#define kWebEnterKey         0x0003
-#define kWebBackspaceKey     0x0008
-#define kWebReturnKey        0x000d
-#define kWebDeleteKey        0x007F
-    
 - (BOOL)_handleEditingKeyEvent:(KeyboardEvent *)wcEvent
 {
     // Use the isEditable state to determine whether or not to process tab key events.
@@ -6105,12 +6100,12 @@
         if (!s.length)
             return NO;
         switch ([s characterAtIndex:0]) {
-        case kWebBackspaceKey:
-        case kWebDeleteKey:
+        case NSBackspaceCharacter:
+        case NSDeleteCharacter:
             [[webView _UIKitDelegateForwarder] deleteFromInputWithFlags:event.keyboardFlags];
             return YES;
-        case kWebEnterKey:
-        case kWebReturnKey:
+        case NSEnterCharacter:
+        case NSCarriageReturnCharacter:
             if (isCharEvent) {
                 // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
                 [[webView _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to