Title: [239361] trunk/Source/WebCore
- Revision
- 239361
- Author
- [email protected]
- Date
- 2018-12-18 16:23:21 -0800 (Tue, 18 Dec 2018)
Log Message
Wrong value for key property in keydown and keyup events generated holding Control key
https://bugs.webkit.org/show_bug.cgi?id=192788
<rdar://problem/46795214>
Reviewed by Wenson Hsieh.
Similar to what we do on Mac, compute the DOM key property from the characters ignoring
modifier keys input string when the Control key is held down.
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::keyForKeyEvent):
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::keyForKeyEvent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (239360 => 239361)
--- trunk/Source/WebCore/ChangeLog 2018-12-19 00:02:45 UTC (rev 239360)
+++ trunk/Source/WebCore/ChangeLog 2018-12-19 00:23:21 UTC (rev 239361)
@@ -1,3 +1,19 @@
+2018-12-18 Daniel Bates <[email protected]>
+
+ Wrong value for key property in keydown and keyup events generated holding Control key
+ https://bugs.webkit.org/show_bug.cgi?id=192788
+ <rdar://problem/46795214>
+
+ Reviewed by Wenson Hsieh.
+
+ Similar to what we do on Mac, compute the DOM key property from the characters ignoring
+ modifier keys input string when the Control key is held down.
+
+ * platform/ios/PlatformEventFactoryIOS.mm:
+ (WebCore::keyForKeyEvent):
+ * platform/mac/PlatformEventFactoryMac.mm:
+ (WebCore::keyForKeyEvent):
+
2018-12-18 Sihui Liu <[email protected]>
Clean up IndexedDB files between tests
Modified: trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm (239360 => 239361)
--- trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm 2018-12-19 00:02:45 UTC (rev 239360)
+++ trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm 2018-12-19 00:23:21 UTC (rev 239361)
@@ -190,7 +190,13 @@
}
}
- NSString *characters = event.characters;
+ // If more than one key is being pressed and the key combination includes one or more modifier keys
+ // that result in the key no longer producing a printable character (e.g., Control + a), then the
+ // key value should be the printable key value that would have been produced if the key had been
+ // typed with the default keyboard layout with no modifier keys except for Shift and AltGr applied.
+ // See <https://www.w3.org/TR/2015/WD-uievents-20151215/#keys-guidelines>.
+ bool isControlDown = event.modifierFlags & WebEventFlagMaskControlKey;
+ NSString *characters = isControlDown ? event.charactersIgnoringModifiers : event.characters;
auto length = [characters length];
// characters return an empty string for dead keys.
// https://developer.apple.com/reference/appkit/nsevent/1534183-characters
Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (239360 => 239361)
--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2018-12-19 00:02:45 UTC (rev 239360)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2018-12-19 00:23:21 UTC (rev 239361)
@@ -260,7 +260,7 @@
// that result in the key no longer producing a printable character (e.g., Control + a), then the
// key value should be the printable key value that would have been produced if the key had been
// typed with the default keyboard layout with no modifier keys except for Shift and AltGr applied.
- // https://w3c.github.io/uievents/#keys-guidelines
+ // See <https://www.w3.org/TR/2015/WD-uievents-20151215/#keys-guidelines>.
bool isControlDown = ([event modifierFlags] & NSEventModifierFlagControl);
NSString *s = isControlDown ? [event charactersIgnoringModifiers] : [event characters];
auto length = [s length];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes