Remove unused initializer for WebEvent on iOS.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 May 2016 23:39:00 +0000 (23:39 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 May 2016 23:39:00 +0000 (23:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157689

Reviewed by Anders Carlsson.

Source/WebCore:

This is no longer used and can be removed.
The logic tied to isPopupVariant has been incorporated
in keyboard flags. The characterSet property is no longer needed too.

* platform/ios/WebEvent.h:
* platform/ios/WebEvent.mm:
(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:isPopupVariant:keyCode:isTabKey:characterSet:]): Deleted.
(-[WebEvent _characterSetDescription]): Deleted.
(-[WebEvent isPopupVariant]): Deleted.
(-[WebEvent characterSet]): Deleted.

Source/WebKit/mac:

Removing use of characterSet property.

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

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/WebEvent.h
Source/WebCore/platform/ios/WebEvent.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm

index 2c86d2e..c023a77 100644 (file)
@@ -1,3 +1,22 @@
+2016-05-13  Enrica Casucci  <enrica@apple.com>
+
+        Remove unused initializer for WebEvent on iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=157689
+
+        Reviewed by Anders Carlsson.
+
+        This is no longer used and can be removed.
+        The logic tied to isPopupVariant has been incorporated
+        in keyboard flags. The characterSet property is no longer needed too.
+
+        * platform/ios/WebEvent.h:
+        * platform/ios/WebEvent.mm:
+        (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
+        (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:isPopupVariant:keyCode:isTabKey:characterSet:]): Deleted.
+        (-[WebEvent _characterSetDescription]): Deleted.
+        (-[WebEvent isPopupVariant]): Deleted.
+        (-[WebEvent characterSet]): Deleted.
+
 2016-05-13  Simon Fraser  <simon.fraser@apple.com>
 
         cross-fade() rendering doesn't match expectation
index 8edadd6..9d72f00 100644 (file)
@@ -86,11 +86,9 @@ WEBCORE_EXPORT @interface WebEvent : NSObject {
     NSString *_charactersIgnoringModifiers;
     WebEventFlags _modifierFlags;
     BOOL _keyRepeating;
-    BOOL _popupVariant; // FIXME: to be removed
     NSUInteger _keyboardFlags;
     uint16_t _keyCode;
     BOOL _tabKey;
-    WebEventCharacterSet _characterSet;
     
     float _deltaX;
     float _deltaY;
@@ -127,18 +125,6 @@ WEBCORE_EXPORT @interface WebEvent : NSObject {
                         gestureScale:(float)gestureScale
                      gestureRotation:(float)gestureRotation;
 
-// FIXME: this is deprecated. It will be removed when UIKit adopts the new one below.
-- (WebEvent *)initWithKeyEventType:(WebEventType)type
-                         timeStamp:(CFTimeInterval)timeStamp
-                        characters:(NSString *)characters
-       charactersIgnoringModifiers:(NSString *)charactersIgnoringModifiers
-                         modifiers:(WebEventFlags)modifiers
-                       isRepeating:(BOOL)repeating
-                    isPopupVariant:(BOOL)popupVariant
-                           keyCode:(uint16_t)keyCode
-                          isTabKey:(BOOL)tabKey
-                      characterSet:(WebEventCharacterSet)characterSet;
-
 - (WebEvent *)initWithKeyEventType:(WebEventType)type
                          timeStamp:(CFTimeInterval)timeStamp
                         characters:(NSString *)characters
@@ -162,12 +148,9 @@ WEBCORE_EXPORT @interface WebEvent : NSObject {
 @property(nonatomic, readonly) WebEventFlags modifierFlags;
 @property(nonatomic, readonly, getter = isKeyRepeating) BOOL keyRepeating;
 
-// FIXME: this is deprecated. It will be removed when UIKit adopts the new initWithKeyEventType.
-@property(nonatomic, readonly, getter = isPopupVariant) BOOL popupVariant;
 @property(nonatomic, readonly) NSUInteger keyboardFlags;
 @property(nonatomic, readonly) uint16_t keyCode;
 @property(nonatomic, readonly, getter = isTabKey) BOOL tabKey;
-@property(nonatomic, readonly) WebEventCharacterSet characterSet;
 
 // Scroll Wheel
 @property(nonatomic, readonly) float deltaX;
index a169395..015db31 100644 (file)
@@ -127,54 +127,12 @@ static int windowsKeyCodeForCharCodeIOS(unichar charCode)
        charactersIgnoringModifiers:(NSString *)charactersIgnoringModifiers
                          modifiers:(WebEventFlags)modifiers
                        isRepeating:(BOOL)repeating
-                    isPopupVariant:(BOOL)popupVariant
-                           keyCode:(uint16_t)keyCode
-                          isTabKey:(BOOL)tabKey
-                      characterSet:(WebEventCharacterSet)characterSet
-{
-    self = [super init];
-    if (!self)
-        return nil;
-    
-    _type = type;
-    _timestamp = timeStamp;
-
-    _characters = [characters retain];
-    _charactersIgnoringModifiers = [charactersIgnoringModifiers retain];
-    _modifierFlags = modifiers;
-    _keyRepeating = repeating;
-    _popupVariant = popupVariant;
-    _tabKey = tabKey;
-    _characterSet = characterSet;
-
-    if (keyCode)
-        _keyCode = windowsKeyCodeForKeyCode(keyCode);
-
-    // NOTE: this preserves the original semantics which used the
-    // characters string for the keyCode. This should be changed in iOS 4.0 to
-    // allow the client to explicitly specify a keyCode, otherwise default to
-    // mapping the characters string to a keyCode.
-    // e.g. add an 'else' before this 'if'.
-    if ([charactersIgnoringModifiers length] == 1) {
-        unichar ch = [charactersIgnoringModifiers characterAtIndex:0];
-        _keyCode = windowsKeyCodeForCharCodeIOS(ch);
-    }
-
-    return self;
-}
-
-
-- (WebEvent *)initWithKeyEventType:(WebEventType)type
-                         timeStamp:(CFTimeInterval)timeStamp
-                        characters:(NSString *)characters
-       charactersIgnoringModifiers:(NSString *)charactersIgnoringModifiers
-                         modifiers:(WebEventFlags)modifiers
-                       isRepeating:(BOOL)repeating
                          withFlags:(NSUInteger)flags
                            keyCode:(uint16_t)keyCode
                           isTabKey:(BOOL)tabKey
                       characterSet:(WebEventCharacterSet)characterSet
 {
+    UNUSED_PARAM(characterSet);
     self = [super init];
     if (!self)
         return nil;
@@ -188,7 +146,6 @@ static int windowsKeyCodeForCharCodeIOS(unichar charCode)
     _keyRepeating = repeating;
     _keyboardFlags = flags;
     _tabKey = tabKey;
-    _characterSet = characterSet;
     
     if (keyCode)
         _keyCode = windowsKeyCodeForKeyCode(keyCode);
@@ -276,25 +233,6 @@ static int windowsKeyCodeForCharCodeIOS(unichar charCode)
     return @"Unknown";
 }
 
-- (NSString *)_characterSetDescription
-{
-    switch (_characterSet) {
-        case WebEventCharacterSetASCII:
-            return @"WebEventCharacterSetASCII";
-        case WebEventCharacterSetSymbol:
-            return @"WebEventCharacterSetSymbol";
-        case WebEventCharacterSetDingbats:
-            return @"WebEventCharacterSetDingbats";
-        case WebEventCharacterSetUnicode:
-            return @"WebEventCharacterSetUnicode";
-        case WebEventCharacterSetFunctionKeys:
-            return @"WebEventCharacterSetFunctionKeys";
-        default:
-            ASSERT_NOT_REACHED();
-    }
-    return @"Unknown";
-}
-
 - (NSString *)_touchLocationsDescription:(NSArray *)locations
 {
     BOOL shouldAddComma = NO;
@@ -359,7 +297,7 @@ static int windowsKeyCodeForCharCodeIOS(unichar charCode)
             return [NSString stringWithFormat:@"location: (%f, %f) deltaX: %f deltaY: %f", _locationInWindow.x, _locationInWindow.y, _deltaX, _deltaY];
         case WebEventKeyDown:
         case WebEventKeyUp:
-            return [NSString stringWithFormat:@"chars: %@ charsNoModifiers: %@ flags: %d repeating: %d keyboardFlags: %lu keyCode %d, isTab: %d charSet: %@", _characters, _charactersIgnoringModifiers, _modifierFlags, _keyRepeating, static_cast<unsigned long>(_keyboardFlags), _keyCode, _tabKey, [self _characterSetDescription]];
+            return [NSString stringWithFormat:@"chars: %@ charsNoModifiers: %@ flags: %d repeating: %d keyboardFlags: %lu keyCode %d, isTab: %d", _characters, _charactersIgnoringModifiers, _modifierFlags, _keyRepeating, static_cast<unsigned long>(_keyboardFlags), _keyCode, _tabKey];
         case WebEventTouchBegin:
         case WebEventTouchChange:
         case WebEventTouchEnd:
@@ -408,13 +346,6 @@ static int windowsKeyCodeForCharCodeIOS(unichar charCode)
     return _keyRepeating;
 }
 
-// FIXME: to be removed
-- (BOOL)isPopupVariant
-{
-    ASSERT(_type == WebEventKeyDown || _type == WebEventKeyUp);
-    return _popupVariant;
-}
-
 - (NSUInteger)keyboardFlags
 {
     ASSERT(_type == WebEventKeyDown || _type == WebEventKeyUp);
@@ -433,12 +364,6 @@ static int windowsKeyCodeForCharCodeIOS(unichar charCode)
     return _tabKey;
 }
 
-- (WebEventCharacterSet)characterSet
-{
-    ASSERT(_type == WebEventKeyDown || _type == WebEventKeyUp);
-    return _characterSet;
-}
-
 - (float)deltaX
 {
     ASSERT(_type == WebEventScrollWheel);
index ce62bf2..984049b 100644 (file)
@@ -1,3 +1,15 @@
+2016-05-13  Enrica Casucci  <enrica@apple.com>
+
+        Remove unused initializer for WebEvent on iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=157689
+
+        Reviewed by Anders Carlsson.
+
+        Removing use of characterSet property.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _handleEditingKeyEvent:]):
+
 2016-05-13  Beth Dakin  <bdakin@apple.com>
 
         Build fix.
index e0090f3..db097ae 100644 (file)
@@ -6511,10 +6511,6 @@ static BOOL writingDirectionKeyBindingsEnabled()
 #define kWebBackspaceKey     0x0008
 #define kWebReturnKey        0x000d
 #define kWebDeleteKey        0x007F
-#define kWebLeftArrowKey     0x00AC
-#define kWebUpArrowKey       0x00AD
-#define kWebRightArrowKey    0x00AE
-#define kWebDownArrowKey     0x00AF
 #define kWebDeleteForwardKey 0xF728
     
 - (BOOL)_handleEditingKeyEvent:(KeyboardEvent *)wcEvent
@@ -6526,79 +6522,36 @@ static BOOL writingDirectionKeyBindingsEnabled()
     // embedded as the whole view, as in Mail, and tabs should input tabs as expected
     // in a text editor.
     
-    // FIXME - this code will break when content editable is supported.
     if (const PlatformKeyboardEvent* platformEvent = wcEvent->keyEvent()) {
         WebEvent *event = platformEvent->event();
         if (![[self _webView] isEditable] && event.isTabKey) 
             return NO;
         
-        // Now process the key normally
-        BOOL shift = platformEvent->shiftKey();
-        
-        switch (event.characterSet) {
-            case WebEventCharacterSetSymbol: {
-                SEL sel = 0;
-                NSString *s = [event charactersIgnoringModifiers];
-                if ([s length] == 0)
-                    break;
-                switch ([s characterAtIndex:0]) {
-                    case kWebLeftArrowKey:
-                        sel = shift ? @selector(moveLeftAndModifySelection:) : @selector(moveLeft:);
-                        break;
-                    case kWebUpArrowKey:
-                        sel = shift ? @selector(moveUpAndModifySelection:) : @selector(moveUp:);
-                        break;
-                    case kWebRightArrowKey:
-                        sel = shift ? @selector(moveRightAndModifySelection:) : @selector(moveRight:);
-                        break;
-                    case kWebDownArrowKey:
-                        sel = shift ? @selector(moveDownAndModifySelection:) : @selector(moveDown:);
-                        break;
-                }
-                if (sel) {
-                    [self performSelector:sel withObject:self];
-                    return YES;
-                }
-                break;
+        NSString *s = [event characters];
+        if (!s.length)
+            return NO;
+        WebView* webView = [self _webView];
+        switch ([s characterAtIndex:0]) {
+        case kWebBackspaceKey:
+        case kWebDeleteKey:
+            [[webView _UIKitDelegateForwarder] deleteFromInputWithFlags:event.keyboardFlags];
+            return YES;
+        case kWebEnterKey:
+        case kWebReturnKey:
+            if (platformEvent->type() == PlatformKeyboardEvent::Char) {
+                // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
+                [[webView _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
+                return YES;
             }
-            case WebEventCharacterSetASCII:
-            case WebEventCharacterSetUnicode: {
-                NSString *s = [event characters];
-                if ([s length] == 0)
-                    break;
-                WebView* webView = [self _webView];
-                switch ([s characterAtIndex:0]) {
-                    case kWebBackspaceKey:
-                    case kWebDeleteKey:
-                        // 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 kWebReturnKey:
-                        if (platformEvent->type() == PlatformKeyboardEvent::Char) {
-                            // Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
-                            [[webView _UIKitDelegateForwarder] addInputString:@"\n" withFlags:0];
-                            return YES;
-                        }
-                        return NO;
-                    case kWebDeleteForwardKey:
-                        [self deleteForward:self];
-                        return YES;
-                    default: {                    
-                        if (platformEvent->type() == PlatformKeyboardEvent::Char) {
-                            [[webView _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
-                            return YES;
-                        }
-                        return NO;
-                    }
-                }
-                break;
+            break;
+        case kWebDeleteForwardKey:
+            [self deleteForward:self];
+            return YES;
+        default:
+            if (platformEvent->type() == PlatformKeyboardEvent::Char) {
+                [[webView _UIKitDelegateForwarder] addInputString:event.characters withFlags:event.keyboardFlags];
+                return YES;
             }
-            default:
-                return NO;
         }
     }
     return NO;