[iOS] Add support for deleteFromInputWithFlags.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 00:23:53 +0000 (00:23 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 00:23:53 +0000 (00:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141216
rdar://problem/19130081

Reviewed by Benjamin Poulain.

Adopts the new method as soon as it is available.
The patch also removes some obsolete code used for staging.

Source/WebKit/ios:

* DefaultDelegates/WebDefaultUIKitDelegate.m:
(-[WebDefaultUIKitDelegate addInputString:withFlags:]):
(-[WebDefaultUIKitDelegate deleteFromInput]):
(-[WebDefaultUIKitDelegate deleteFromInputwithFlags:]):
(-[WebDefaultUIKitDelegate addInputString:fromVariantKey:]): Deleted.
* WebView/WebUIKitDelegate.h:

Source/WebKit/mac:

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

Source/WebKit2:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179580 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ios/ChangeLog
Source/WebKit/ios/DefaultDelegates/WebDefaultUIKitDelegate.m
Source/WebKit/ios/WebView/WebUIKitDelegate.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/spi/ios/UIKitSPI.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

index 15e4a215af01835fb6e6468bd78772e454a1ef01..3ef5f168fb018826adde34158bd1b126775d0c9b 100644 (file)
@@ -1,3 +1,21 @@
+2015-02-03  Enrica Casucci  <enrica@apple.com>
+
+        [iOS] Add support for deleteFromInputWithFlags.
+        https://bugs.webkit.org/show_bug.cgi?id=141216
+        rdar://problem/19130081
+
+        Reviewed by Benjamin Poulain.
+
+        Adopts the new method as soon as it is available.
+        The patch also removes some obsolete code used for staging.
+
+        * DefaultDelegates/WebDefaultUIKitDelegate.m:
+        (-[WebDefaultUIKitDelegate addInputString:withFlags:]):
+        (-[WebDefaultUIKitDelegate deleteFromInput]):
+        (-[WebDefaultUIKitDelegate deleteFromInputwithFlags:]):
+        (-[WebDefaultUIKitDelegate addInputString:fromVariantKey:]): Deleted.
+        * WebView/WebUIKitDelegate.h:
+
 2015-01-22  Andreas Kling  <akling@apple.com>
 
         Remove unused class EmojiFallbackFontSelector.
index 714f1f96e3ca1cd70b1999ed76187d0e56730703..9044243d6dc6067b6a06f2a0fe6b5d64b079389c 100644 (file)
@@ -161,16 +161,16 @@ static WebDefaultUIKitDelegate *sharedDelegate = nil;
 {
 }
 
-// FIXME: to be removed when UIKit implements the new one below.
-- (void)addInputString:(NSString *)str fromVariantKey:(BOOL)isPopupVariant
+- (void)addInputString:(NSString *)str withFlags:(NSUInteger)flags
 {
 }
 
-- (void)addInputString:(NSString *)str withFlags:(NSUInteger)flags
+// FIXME: to be removed when UIKit implements the new one below.
+- (void)deleteFromInput
 {
 }
 
-- (void)deleteFromInput
+- (void)deleteFromInputwithFlags:(NSUInteger)flags
 {
 }
 
index 84f18f0e1815eb5d63af93bd8d467a6238707740..bbbd5acdddd19999a3a08bd67909e23f0d7769a9 100644 (file)
 - (void)webView:(WebView *)webView willShowFullScreenForPlugInView:(id)plugInView;
 - (void)webView:(WebView *)webView didHideFullScreenForPlugInView:(id)plugInView;
 - (void)webView:(WebView *)aWebView didReceiveMessage:(NSDictionary *)aMessage;
-// FIXME: to be removed when UIKit implements the new one.
-- (void)addInputString:(NSString *)str fromVariantKey:(BOOL)isPopupVariant;
 - (void)addInputString:(NSString *)str withFlags:(NSUInteger)flags;
+// FIXME: remove deleteFromInput when UIKit implements deleteFromInputWithFlags.
 - (void)deleteFromInput;
+- (void)deleteFromInputWithFlags:(NSUInteger)flags;
 
 // Accelerated compositing
 - (void)_webthread_webView:(WebView*)webView attachRootLayer:(id)rootLayer;
index 9e3ae4bf5f7afab79493d18fab45d5b3c81cfa8b..94874a24e48c094b3aed3b377fdc5a5e48e4bbe0 100644 (file)
@@ -1,3 +1,17 @@
+2015-02-03  Enrica Casucci  <enrica@apple.com>
+
+        [iOS] Add support for deleteFromInputWithFlags.
+        https://bugs.webkit.org/show_bug.cgi?id=141216
+        rdar://problem/19130081
+
+        Reviewed by Benjamin Poulain.
+
+        Adopts the new method as soon as it is available.
+        The patch also removes some obsolete code used for staging.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _handleEditingKeyEvent:]):
+
 2015-02-02  Chris Dumez  <cdumez@apple.com>
 
         Access MemoryCache singleton using MemoryCache::singleton()
index 61b460e3a142d2b3aec03e01a134e15f45f8f615..1120674d499f57ef484d65091213c2013bb027ab 100644 (file)
@@ -5820,18 +5820,21 @@ static BOOL writingDirectionKeyBindingsEnabled()
                 NSString *s = [event characters];
                 if ([s length] == 0)
                     break;
+                WebView* webView = [self _webView];
                 switch ([s characterAtIndex:0]) {
                     case kWebBackspaceKey:
                     case kWebDeleteKey:
-                        [[[self _webView] _UIKitDelegateForwarder] deleteFromInput];
+                        // FIXME: remove the call to deleteFromInput when UIKit implements deleteFromInputWithFlags.
+                        if ([webView respondsToSelector:@selector(deleteFromInputWithFlags:)])
+                            [[webView _UIKitDelegateForwarder] deleteFromInputWithFlags:event.keyboardFlags];
+                        else
+                            [[webView _UIKitDelegateForwarder] deleteFromInput];
                         return YES;
-                    case kWebEnterKey:                        
+                    case kWebEnterKey:
                     case kWebReturnKey:
                         if (platformEvent->type() == PlatformKeyboardEvent::Char) {
                             // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
-                            // FIXME: remove the first call when UIKit implements the new method.
-                            [[[self _webView] _UIKitDelegateForwarder] addInputString:@"\n" fromVariantKey:NO];
-                            [[[self _webView] _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
+                            [[webView _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
                             return YES;
                         }
                         return NO;
@@ -5840,10 +5843,7 @@ static BOOL writingDirectionKeyBindingsEnabled()
                         return YES;
                     default: {                    
                         if (platformEvent->type() == PlatformKeyboardEvent::Char) {
-                            //NSString *string = event.characters;
-                            // FIXME: remove the first call when UIKit implements the new method.
-                            [[[self _webView] _UIKitDelegateForwarder] addInputString:event.characters fromVariantKey:event.popupVariant];
-                            [[[self _webView] _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
+                            [[webView _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
                             return YES;
                         }
                         return NO;
index 19be606b3585112ebebb2377b03e918911a841c7..e055d97e1c3e85fa16ca5c8afa04d9f5436ecf32 100644 (file)
@@ -1,3 +1,18 @@
+2015-02-03  Enrica Casucci  <enrica@apple.com>
+
+        [iOS] Add support for deleteFromInputWithFlags.
+        https://bugs.webkit.org/show_bug.cgi?id=141216
+        rdar://problem/19130081
+
+        Reviewed by Benjamin Poulain.
+
+        Adopts the new method as soon as it is available.
+        The patch also removes some obsolete code used for staging.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _interpretKeyEvent:isCharEvent:]):
+
 2015-02-03  Joseph Pecoraro  <pecoraro@apple.com>
 
         [iOS] Selection Callout should not immediately disappear on pages with frequent layouts
index b575777825e73b353363f20da1a3a5ea6352c316..d65fb9383d06fc12110eab00b3ed75a0f6245b9a 100644 (file)
@@ -154,6 +154,7 @@ typedef enum {
 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags;
 - (BOOL)autocorrectSpellingEnabled;
 - (void)deleteFromInput;
+- (void)deleteFromInputWithFlags:(NSUInteger)flags;
 - (void)replaceText:(id)replacement;
 @property (nonatomic, readwrite, retain) UIResponder <UIKeyInput> *delegate;
 @end
index cadfe2d083a92d92b3481736fae6be5c4bc3b2e4..fca8d2fcc34dc6beaf501da8725c36cdf6745f33 100644 (file)
@@ -187,6 +187,7 @@ const CGFloat minimumTapHighlightRadius = 2.0;
 
 @interface UIKeyboardImpl (StagingToRemove)
 - (void)didHandleWebKeyEvent;
+- (void)deleteFromInputWithFlags:(NSUInteger)flags;
 @end
 
 @interface UIView (UIViewInternalHack)
@@ -2461,17 +2462,22 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
         NSString *characters = [event characters];
         if ([characters length] == 0)
             break;
+        UIKeyboardImpl *keyboard = [UIKeyboardImpl sharedInstance];
         switch ([characters characterAtIndex:0]) {
         case kWebBackspaceKey:
         case kWebDeleteKey:
-            [[UIKeyboardImpl sharedInstance] deleteFromInput];
+            // FIXME: remove deleteFromInput once UIKit adopts deleteFromInputWithFlags
+            if ([keyboard respondsToSelector:@selector(deleteFromInputWithFlags:)])
+                [keyboard deleteFromInputWithFlags:event.keyboardFlags];
+            else
+                [keyboard deleteFromInput];
             return YES;
 
         case kWebEnterKey:
         case kWebReturnKey:
             if (isCharEvent) {
                 // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
-                [[UIKeyboardImpl sharedInstance] addInputString:@"\n" withFlags:0];
+                [keyboard addInputString:@"\n" withFlags:0];
                 return YES;
             }
             return NO;
@@ -2482,7 +2488,7 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
 
         default: {
             if (isCharEvent) {
-                [[UIKeyboardImpl sharedInstance] addInputString:event.characters withFlags:event.keyboardFlags];
+                [keyboard addInputString:event.characters withFlags:event.keyboardFlags];
                 return YES;
             }
             return NO;