Title: [240285] trunk/Source
Revision
240285
Author
[email protected]
Date
2019-01-22 12:59:48 -0800 (Tue, 22 Jan 2019)

Log Message

[iOS] Interpret text key commands on keydown and app key commands on keypress
https://bugs.webkit.org/show_bug.cgi?id=192897
<rdar://problem/46857378>

Reviewed by Brent Fulgham.

Source/WebKit:

Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
is false) and keypress (isCharEvent is true), respectively.

* Platform/spi/ios/UIKitSPI.h: Add more SPI.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _interpretKeyEvent:isCharEvent:]):

Source/WebKitLegacy/ios:

Add stubs for SPI.

* DefaultDelegates/WebDefaultUIKitDelegate.m:
(-[WebDefaultUIKitDelegate handleKeyTextCommandForCurrentEvent]): Added.
(-[WebDefaultUIKitDelegate handleKeyAppCommandForCurrentEvent]): Added.
(-[WebDefaultUIKitDelegate handleKeyCommandForCurrentEvent]): Deleted.
* WebView/WebUIKitDelegate.h:

Source/WebKitLegacy/mac:

Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
is false) and keypress (isCharEvent is true), respectively.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (240284 => 240285)


--- trunk/Source/WebKit/ChangeLog	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKit/ChangeLog	2019-01-22 20:59:48 UTC (rev 240285)
@@ -1,3 +1,18 @@
+2019-01-22  Daniel Bates  <[email protected]>
+
+        [iOS] Interpret text key commands on keydown and app key commands on keypress
+        https://bugs.webkit.org/show_bug.cgi?id=192897
+        <rdar://problem/46857378>
+
+        Reviewed by Brent Fulgham.
+
+        Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
+        is false) and keypress (isCharEvent is true), respectively.
+
+        * Platform/spi/ios/UIKitSPI.h: Add more SPI.
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _interpretKeyEvent:isCharEvent:]):
+
 2019-01-22  David Kilzer  <[email protected]>
 
         C strings in ClientCertificateAuthenticationXPCConstants.h are duplicated

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (240284 => 240285)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2019-01-22 20:59:48 UTC (rev 240285)
@@ -1072,6 +1072,8 @@
 @interface UIKeyboardImpl (IPI)
 - (void)setInitialDirection;
 - (void)prepareKeyboardInputModeFromPreferences:(UIKeyboardInputMode *)lastUsedMode;
+- (BOOL)handleKeyTextCommandForCurrentEvent;
+- (BOOL)handleKeyAppCommandForCurrentEvent;
 @property (nonatomic, readonly) UIKeyboardInputMode *currentInputModeInPreference;
 @end
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (240284 => 240285)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-01-22 20:59:48 UTC (rev 240285)
@@ -135,14 +135,6 @@
 
 #endif
 
-#if PLATFORM(IOS_FAMILY)
-
-@interface UIKeyboardImpl (Staging)
-- (BOOL)handleKeyCommandForCurrentEvent;
-@end
-
-#endif
-
 namespace WebKit {
 using namespace WebCore;
 using namespace WebKit;
@@ -4023,8 +4015,10 @@
     UIKeyboardImpl *keyboard = [UIKeyboardImpl sharedInstance];
 
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
-    if (event.type == WebEventKeyDown && [keyboard respondsToSelector:@selector(handleKeyCommandForCurrentEvent)] && [keyboard handleKeyCommandForCurrentEvent])
+    if (!isCharEvent && [keyboard respondsToSelector:@selector(handleKeyTextCommandForCurrentEvent)] && [keyboard handleKeyTextCommandForCurrentEvent])
         return YES;
+    if (isCharEvent && [keyboard respondsToSelector:@selector(handleKeyAppCommandForCurrentEvent)] && [keyboard handleKeyAppCommandForCurrentEvent])
+        return YES;
 #endif
 
     NSString *characters = event.characters;

Modified: trunk/Source/WebKitLegacy/ios/ChangeLog (240284 => 240285)


--- trunk/Source/WebKitLegacy/ios/ChangeLog	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKitLegacy/ios/ChangeLog	2019-01-22 20:59:48 UTC (rev 240285)
@@ -1,3 +1,19 @@
+2019-01-22  Daniel Bates  <[email protected]>
+
+        [iOS] Interpret text key commands on keydown and app key commands on keypress
+        https://bugs.webkit.org/show_bug.cgi?id=192897
+        <rdar://problem/46857378>
+
+        Reviewed by Brent Fulgham.
+
+        Add stubs for SPI.
+
+        * DefaultDelegates/WebDefaultUIKitDelegate.m:
+        (-[WebDefaultUIKitDelegate handleKeyTextCommandForCurrentEvent]): Added.
+        (-[WebDefaultUIKitDelegate handleKeyAppCommandForCurrentEvent]): Added.
+        (-[WebDefaultUIKitDelegate handleKeyCommandForCurrentEvent]): Deleted.
+        * WebView/WebUIKitDelegate.h:
+
 2019-01-04  Simon Fraser  <[email protected]>
 
         Factor legacy WK1 code for fixed and scrolling layers into their own helper class

Modified: trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m (240284 => 240285)


--- trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m	2019-01-22 20:59:48 UTC (rev 240285)
@@ -162,11 +162,16 @@
 {
 }
 
-- (BOOL)handleKeyCommandForCurrentEvent
+- (BOOL)handleKeyTextCommandForCurrentEvent
 {
     return NO;
 }
 
+- (BOOL)handleKeyAppCommandForCurrentEvent
+{
+    return NO;
+}
+
 - (void)addInputString:(NSString *)str withFlags:(NSUInteger)flags
 {
 }

Modified: trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h (240284 => 240285)


--- trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h	2019-01-22 20:59:48 UTC (rev 240285)
@@ -90,7 +90,8 @@
 - (void)webView:(WebView *)webView didHideFullScreenForPlugInView:(id)plugInView;
 - (void)webView:(WebView *)aWebView didReceiveMessage:(NSDictionary *)aMessage;
 - (void)addInputString:(NSString *)str withFlags:(NSUInteger)flags;
-- (BOOL)handleKeyCommandForCurrentEvent;
+- (BOOL)handleKeyTextCommandForCurrentEvent;
+- (BOOL)handleKeyAppCommandForCurrentEvent;
 // FIXME: remove deleteFromInput when UIKit implements deleteFromInputWithFlags.
 - (void)deleteFromInput;
 - (void)deleteFromInputWithFlags:(NSUInteger)flags;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (240284 => 240285)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-01-22 20:59:48 UTC (rev 240285)
@@ -1,3 +1,17 @@
+2019-01-22  Daniel Bates  <[email protected]>
+
+        [iOS] Interpret text key commands on keydown and app key commands on keypress
+        https://bugs.webkit.org/show_bug.cgi?id=192897
+        <rdar://problem/46857378>
+
+        Reviewed by Brent Fulgham.
+
+        Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
+        is false) and keypress (isCharEvent is true), respectively.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _handleEditingKeyEvent:]):
+
 2019-01-22  Oriol Brufau  <[email protected]>
 
         [css-logical] Implement flow-relative margin, padding and border shorthands

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (240284 => 240285)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-01-22 20:58:33 UTC (rev 240284)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-01-22 20:59:48 UTC (rev 240285)
@@ -6092,9 +6092,13 @@
         if (!webView.isEditable && event.isTabKey)
             return NO;
 
+        bool isCharEvent = platformEvent->type() == PlatformKeyboardEvent::Char;
+
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
-        if (event.type == WebEventKeyDown && [webView._UIKitDelegateForwarder handleKeyCommandForCurrentEvent])
+        if (!isCharEvent && [webView._UIKitDelegateForwarder handleKeyTextCommandForCurrentEvent])
             return YES;
+        if (isCharEvent && [webView._UIKitDelegateForwarder handleKeyAppCommandForCurrentEvent])
+            return YES;
 #endif
 
         NSString *s = [event characters];
@@ -6107,7 +6111,7 @@
             return YES;
         case kWebEnterKey:
         case kWebReturnKey:
-            if (platformEvent->type() == PlatformKeyboardEvent::Char) {
+            if (isCharEvent) {
                 // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
                 [[webView _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
                 return YES;
@@ -6114,7 +6118,7 @@
             }
             break;
         default:
-            if (platformEvent->type() == PlatformKeyboardEvent::Char) {
+            if (isCharEvent) {
                 [[webView _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
                 return YES;
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to