REGRESSION (r236678): Keyboard scrolling with arrow keys doesn't work on iOS
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Oct 2018 18:43:20 +0000 (18:43 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Oct 2018 18:43:20 +0000 (18:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190433
<rdar://problem/45111986>

Reviewed by Simon Fraser.

* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
(-[WKKeyboardScrollingAnimator beginWithEvent:]): Deleted.
(-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted.
r236678 changes the characters in charactersIgnoringModifiers to match AppKit.
We similarly need to update WKKeyboardScrollingAnimator's comparison.

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm

index 25b345d..db7f361 100644 (file)
@@ -1,3 +1,18 @@
+2018-10-10  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r236678): Keyboard scrolling with arrow keys doesn't work on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=190433
+        <rdar://problem/45111986>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
+        (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
+        (-[WKKeyboardScrollingAnimator beginWithEvent:]): Deleted.
+        (-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted.
+        r236678 changes the characters in charactersIgnoringModifiers to match AppKit.
+        We similarly need to update WKKeyboardScrollingAnimator's comparison.
+
 2018-10-10  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
 
         [JSC] Rename createXXX to tryCreateXXX if it can return RefPtr
index dd5d408..65e922c 100644 (file)
@@ -31,6 +31,7 @@
 #import "UIKitSPI.h"
 #import <QuartzCore/CADisplayLink.h>
 #import <WebCore/FloatPoint.h>
+#import <WebCore/KeyEventCodesIOS.h>
 #import <WebCore/RectEdges.h>
 #import <WebCore/WebEvent.h>
 #import <WebKit/UIKitSPI.h>
@@ -190,21 +191,25 @@ static WebCore::PhysicalBoxSide boxSide(WebKit::ScrollingDirection direction)
     enum class Key : uint8_t { Other, LeftArrow, RightArrow, UpArrow, DownArrow, PageUp, PageDown, Space };
     
     auto key = ^{
-        if ([charactersIgnoringModifiers isEqualToString:UIKeyInputLeftArrow])
+        auto firstCharacter = [charactersIgnoringModifiers characterAtIndex:0];
+        switch (firstCharacter) {
+        case NSLeftArrowFunctionKey:
             return Key::LeftArrow;
-        if ([charactersIgnoringModifiers isEqualToString:UIKeyInputRightArrow])
+        case NSRightArrowFunctionKey:
             return Key::RightArrow;
-        if ([charactersIgnoringModifiers isEqualToString:UIKeyInputUpArrow])
+        case NSUpArrowFunctionKey:
             return Key::UpArrow;
-        if ([charactersIgnoringModifiers isEqualToString:UIKeyInputDownArrow])
+        case NSDownArrowFunctionKey:
             return Key::DownArrow;
-        if ([charactersIgnoringModifiers isEqualToString:UIKeyInputPageDown])
+        case NSPageDownFunctionKey:
             return Key::PageDown;
-        if ([charactersIgnoringModifiers isEqualToString:UIKeyInputPageUp])
+        case NSPageUpFunctionKey:
             return Key::PageUp;
-        if ([charactersIgnoringModifiers characterAtIndex:0] == kWebSpaceKey)
+        case kWebSpaceKey:
             return Key::Space;
-        return Key::Other;
+        default:
+            return Key::Other;
+        };
     }();
     
     if (key == Key::Other)