Title: [237739] trunk/Source/WebCore
- Revision
- 237739
- Author
- dba...@webkit.org
- Date
- 2018-11-02 10:20:28 -0700 (Fri, 02 Nov 2018)
Log Message
[iOS] Normalize character string based on key code
https://bugs.webkit.org/show_bug.cgi?id=191120
Reviewed by Tim Horton.
Source/WebCore:
Following r236417 (https://bugs.webkit.org/show_bug.cgi?id=189604) we always have a valid key code
for a special key (e.g. page up) and can simplify the character string normalization code.
No functionality changed. So, no new tests.
* platform/ios/WebEvent.mm:
(normalizedStringWithAppKitCompatibilityMapping): Modified to take a key code and wrote algorithm
in terms of it.
(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
Pass the key code for the event to normalizedStringWithAppKitCompatibilityMapping().
Source/WebCore/PAL:
Remove forward declarations that are no longer needed now that we check key code.
* pal/spi/ios/UIKitSPI.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (237738 => 237739)
--- trunk/Source/WebCore/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
+++ trunk/Source/WebCore/ChangeLog 2018-11-02 17:20:28 UTC (rev 237739)
@@ -1,5 +1,25 @@
2018-11-02 Daniel Bates <daba...@apple.com>
+ [iOS] Normalize character string based on key code
+ https://bugs.webkit.org/show_bug.cgi?id=191120
+
+ Reviewed by Tim Horton.
+
+ Following r236417 (https://bugs.webkit.org/show_bug.cgi?id=189604) we always have a valid key code
+ for a special key (e.g. page up) and can simplify the character string normalization code.
+
+ No functionality changed. So, no new tests.
+
+ * platform/ios/WebEvent.mm:
+ (normalizedStringWithAppKitCompatibilityMapping): Modified to take a key code and wrote algorithm
+ in terms of it.
+
+ (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
+ (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
+ Pass the key code for the event to normalizedStringWithAppKitCompatibilityMapping().
+
+2018-11-02 Daniel Bates <daba...@apple.com>
+
[iOS] WebKit should dispatch DOM events when a modifier key is pressed
https://bugs.webkit.org/show_bug.cgi?id=190487
Modified: trunk/Source/WebCore/PAL/ChangeLog (237738 => 237739)
--- trunk/Source/WebCore/PAL/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
+++ trunk/Source/WebCore/PAL/ChangeLog 2018-11-02 17:20:28 UTC (rev 237739)
@@ -1,3 +1,14 @@
+2018-11-02 Daniel Bates <daba...@apple.com>
+
+ [iOS] Normalize character string based on key code
+ https://bugs.webkit.org/show_bug.cgi?id=191120
+
+ Reviewed by Tim Horton.
+
+ Remove forward declarations that are no longer needed now that we check key code.
+
+ * pal/spi/ios/UIKitSPI.h:
+
2018-11-01 Said Abou-Hallawa <sabouhall...@apple.com>
[CG] Adopt CG SPI for non-even cornered rounded rects
Modified: trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h (237738 => 237739)
--- trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h 2018-11-02 17:17:09 UTC (rev 237738)
+++ trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h 2018-11-02 17:20:28 UTC (rev 237739)
@@ -31,7 +31,6 @@
#import <UIKit/UIApplication_Private.h>
#import <UIKit/UIColor_Private.h>
#import <UIKit/UIInterface_Private.h>
-#import <UIKit/UIResponder_Private.h>
#import <UIKit/UIScreen_Private.h>
#import <UIKit/UIViewController_Private.h>
@@ -153,16 +152,4 @@
#endif
-NS_ASSUME_NONNULL_BEGIN
-
-WTF_EXTERN_C_BEGIN
-
-extern NSString *const UIKeyInputPageUp;
-extern NSString *const UIKeyInputPageDown;
-extern NSString *const UIKeyInputEscape;
-
-WTF_EXTERN_C_END
-
-NS_ASSUME_NONNULL_END
-
#endif
Modified: trunk/Source/WebCore/platform/ios/WebEvent.mm (237738 => 237739)
--- trunk/Source/WebCore/platform/ios/WebEvent.mm 2018-11-02 17:17:09 UTC (rev 237738)
+++ trunk/Source/WebCore/platform/ios/WebEvent.mm 2018-11-02 17:20:28 UTC (rev 237739)
@@ -35,26 +35,8 @@
#import "KeyEventCodesIOS.h"
#import "WAKAppKitStubs.h"
-#import <pal/spi/ios/UIKitSPI.h>
-#import <wtf/SoftLinking.h>
+#import <pal/spi/cocoa/IOKitSPI.h>
-SOFT_LINK_FRAMEWORK(UIKit)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputUpArrow, NSString *)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputDownArrow, NSString *)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputLeftArrow, NSString *)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputRightArrow, NSString *)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputPageUp, NSString *)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputPageDown, NSString *)
-SOFT_LINK_CONSTANT(UIKit, UIKeyInputEscape, NSString *)
-
-#define UIKeyInputUpArrow getUIKeyInputUpArrow()
-#define UIKeyInputDownArrow getUIKeyInputDownArrow()
-#define UIKeyInputLeftArrow getUIKeyInputLeftArrow()
-#define UIKeyInputRightArrow getUIKeyInputRightArrow()
-#define UIKeyInputPageUp getUIKeyInputPageUp()
-#define UIKeyInputPageDown getUIKeyInputPageDown()
-#define UIKeyInputEscape getUIKeyInputEscape()
-
using WebCore::windowsKeyCodeForKeyCode;
using WebCore::windowsKeyCodeForCharCode;
@@ -142,26 +124,28 @@
return windowsKeyCodeForCharCode(charCode);
}
-static NSString* normalizedStringWithAppKitCompatibilityMapping(NSString *characters)
+static NSString *normalizedStringWithAppKitCompatibilityMapping(NSString *characters, uint16_t keyCode)
{
auto makeNSStringWithCharacter = [] (unichar c) { return [NSString stringWithCharacters:&c length:1]; };
- if ([characters isEqualToString:UIKeyInputUpArrow])
+ switch (keyCode) {
+ case kHIDUsage_KeyboardUpArrow:
return makeNSStringWithCharacter(NSUpArrowFunctionKey);
- if ([characters isEqualToString:UIKeyInputDownArrow])
+ case kHIDUsage_KeyboardDownArrow:
return makeNSStringWithCharacter(NSDownArrowFunctionKey);
- if ([characters isEqualToString:UIKeyInputLeftArrow])
+ case kHIDUsage_KeyboardLeftArrow:
return makeNSStringWithCharacter(NSLeftArrowFunctionKey);
- if ([characters isEqualToString:UIKeyInputRightArrow])
+ case kHIDUsage_KeyboardRightArrow:
return makeNSStringWithCharacter(NSRightArrowFunctionKey);
- if ([characters isEqualToString:UIKeyInputPageUp])
+ case kHIDUsage_KeyboardPageUp:
return makeNSStringWithCharacter(NSPageUpFunctionKey);
- if ([characters isEqualToString:UIKeyInputPageDown])
+ case kHIDUsage_KeyboardPageDown:
return makeNSStringWithCharacter(NSPageDownFunctionKey);
- if ([characters isEqualToString:UIKeyInputEscape])
+ case kHIDUsage_KeyboardEscape:
return @"\x1B";
- if ([characters isEqualToString:@"\x1B"]) // Num Lock / Clear
+ case kHIDUsage_KeypadNumLock: // Num Lock / Clear
return makeNSStringWithCharacter(NSClearLineFunctionKey);
+ }
return characters;
}
@@ -194,8 +178,8 @@
}
if (!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)) {
- _characters = [normalizedStringWithAppKitCompatibilityMapping(characters) retain];
- _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers) retain];
+ _characters = [normalizedStringWithAppKitCompatibilityMapping(characters, keyCode) retain];
+ _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers, keyCode) retain];
_tabKey = tabKey;
_keyRepeating = repeating;
}
@@ -231,8 +215,8 @@
}
if (!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)) {
- _characters = [normalizedStringWithAppKitCompatibilityMapping(characters) retain];
- _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers) retain];
+ _characters = [normalizedStringWithAppKitCompatibilityMapping(characters, keyCode) retain];
+ _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers, keyCode) retain];
_tabKey = tabKey;
_keyRepeating = repeating;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes