Log Message
[iOS] WebKit should dispatch DOM events when a modifier key is pressed https://bugs.webkit.org/show_bug.cgi?id=190487
Reviewed by Tim Horton. Source/WebCore: Add support for modifier flags change events. * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::modifiersForEvent): Modifier keys do not have an associated character and do not participate in key repeat. (WebCore::keyIdentifierForKeyEvent): Identify modifier keys, returning "Unidentified" if the modifier key is unidentified. This matches the behavior on Mac. (WebCore::keyForKeyEvent): Identify modifier keys, returning the empty string if the modifier key is unidentified. This matches the behavior on Mac. (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): * 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:withFlags:withInputManagerHint:keyCode:isTabKey:]): Modifier keys do not have an associated character and do not participate in key repeat. (-[WebEvent _eventDescription]): Modified to print a description for a keydown or keyup event that represents a modifier flags change. (-[WebEvent characters]): Modifier keys do not have an associated character. Assert this invariant as it is a programming error. On Mac, the same operation would result in a NSInternalInconsistencyException exception being raised. (-[WebEvent charactersIgnoringModifiers]): Ditto. Source/WebKit: Add support for modifier flags change events dispatched by UIKit. * Shared/ios/WebIOSEventFactory.mm: (modifiersForEvent): Update for renamed enumerations. (WebIOSEventFactory::createWebKeyboardEvent): Modifier keys do not have an associated character and do not participate in key repeat. * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Update for renamed enumerations. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _interpretKeyEvent:isCharEvent:]): Return NO if the event represents a modifier flags change to allow the default handling. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): Update for renamed enumerations. Source/WebKitLegacy/mac: Having Legacy WebKit return NO if the editing event represents a modifier flags change to allow the default handling. * WebView/WebHTMLView.mm: (-[WebHTMLView _handleEditingKeyEvent:]): Tools: Update the code for renamed enumerations. For WebKitTestRunner, removed comment that does not match my observations when using the simulator to simulate iOS 12 and add support for testing right-hand side modifiers. * DumpRenderTree/mac/EventSendingController.mm: (modifierFlags): (-[EventSendingController keyDown:withModifiers:withLocation:]): (-[EventSendingController setTouchModifier:value:]): * WebKitTestRunner/ios/HIDEventGenerator.mm: (hidUsageCodeForCharacter): LayoutTests: Update expected results of an existing test now that we identify modifier keys. * fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
- trunk/Source/WebCore/platform/ios/WebEvent.h
- trunk/Source/WebCore/platform/ios/WebEvent.mm
- trunk/Source/WebKit/ChangeLog
- trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm
- trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm
- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
- trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm
- trunk/Source/WebKitLegacy/mac/ChangeLog
- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
- trunk/Tools/ChangeLog
- trunk/Tools/DumpRenderTree/mac/EventSendingController.mm
- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
Diff
Modified: trunk/LayoutTests/ChangeLog (237737 => 237738)
--- trunk/LayoutTests/ChangeLog 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/LayoutTests/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
@@ -1,3 +1,14 @@
+2018-11-02 Daniel Bates <[email protected]>
+
+ [iOS] WebKit should dispatch DOM events when a modifier key is pressed
+ https://bugs.webkit.org/show_bug.cgi?id=190487
+
+ Reviewed by Tim Horton.
+
+ Update expected results of an existing test now that we identify modifier keys.
+
+ * fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
+
2018-11-02 Ali Juma <[email protected]>
Allow cross-document intersection observing
Modified: trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt (237737 => 237738)
--- trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt 2018-11-02 17:17:09 UTC (rev 237738)
@@ -20,14 +20,14 @@
type: keyup, key: Dead, code: Home, keyIdentifier: Unidentified, keyCode: 36, charCode: 0, keyCode: 36, which: 36
type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 45, charCode: 0, keyCode: 45, which: 45
type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 45, charCode: 0, keyCode: 45, which: 45
-type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
-type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
-type: keydown, key: Dead, code: MetaLeft, keyIdentifier: Unidentified, keyCode: 91, charCode: 0, keyCode: 91, which: 91
-type: keyup, key: Dead, code: MetaLeft, keyIdentifier: Unidentified, keyCode: 91, charCode: 0, keyCode: 91, which: 91
-type: keydown, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
-type: keyup, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
-type: keydown, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
-type: keyup, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
+type: keydown, key: Alt, code: Unidentified, keyIdentifier: Alt, keyCode: 18, charCode: 0, keyCode: 18, which: 18
+type: keyup, key: Alt, code: Unidentified, keyIdentifier: Alt, keyCode: 18, charCode: 0, keyCode: 18, which: 18
+type: keydown, key: Meta, code: MetaLeft, keyIdentifier: Meta, keyCode: 91, charCode: 0, keyCode: 91, which: 91
+type: keyup, key: Meta, code: MetaLeft, keyIdentifier: Meta, keyCode: 91, charCode: 0, keyCode: 91, which: 91
+type: keydown, key: Control, code: ControlLeft, keyIdentifier: Control, keyCode: 17, charCode: 0, keyCode: 17, which: 17
+type: keyup, key: Control, code: ControlLeft, keyIdentifier: Control, keyCode: 17, charCode: 0, keyCode: 17, which: 17
+type: keydown, key: Shift, code: ShiftLeft, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
+type: keyup, key: Shift, code: ShiftLeft, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
type: keydown, key: PageDown, code: PageDown, keyIdentifier: PageDown, keyCode: 34, charCode: 0, keyCode: 34, which: 34
type: keyup, key: PageDown, code: PageDown, keyIdentifier: PageDown, keyCode: 34, charCode: 0, keyCode: 34, which: 34
type: keydown, key: PageUp, code: PageUp, keyIdentifier: PageUp, keyCode: 33, charCode: 0, keyCode: 33, which: 33
@@ -34,14 +34,14 @@
type: keyup, key: PageUp, code: PageUp, keyIdentifier: PageUp, keyCode: 33, charCode: 0, keyCode: 33, which: 33
type: keydown, key: Enter, code: Enter, keyIdentifier: Enter, keyCode: 13, charCode: 0, keyCode: 13, which: 13
type: keyup, key: Dead, code: Enter, keyIdentifier: Unidentified, keyCode: 13, charCode: 0, keyCode: 13, which: 13
-type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
-type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
-type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 93, charCode: 0, keyCode: 93, which: 93
-type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 93, charCode: 0, keyCode: 93, which: 93
-type: keydown, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
-type: keyup, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
-type: keydown, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
-type: keyup, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
+type: keydown, key: Alt, code: Unidentified, keyIdentifier: Alt, keyCode: 18, charCode: 0, keyCode: 18, which: 18
+type: keyup, key: Alt, code: Unidentified, keyIdentifier: Alt, keyCode: 18, charCode: 0, keyCode: 18, which: 18
+type: keydown, key: Meta, code: Unidentified, keyIdentifier: Meta, keyCode: 93, charCode: 0, keyCode: 93, which: 93
+type: keyup, key: Meta, code: Unidentified, keyIdentifier: Meta, keyCode: 93, charCode: 0, keyCode: 93, which: 93
+type: keydown, key: Control, code: ControlRight, keyIdentifier: Control, keyCode: 17, charCode: 0, keyCode: 17, which: 17
+type: keyup, key: Control, code: ControlRight, keyIdentifier: Control, keyCode: 17, charCode: 0, keyCode: 17, which: 17
+type: keydown, key: Shift, code: ShiftRight, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
+type: keyup, key: Shift, code: ShiftRight, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
type: keydown, key: , code: F1, keyIdentifier: U+0010, keyCode: 112, charCode: 0, keyCode: 112, which: 112
type: keyup, key: Dead, code: F1, keyIdentifier: Unidentified, keyCode: 112, charCode: 0, keyCode: 112, which: 112
type: keydown, key: , code: F2, keyIdentifier: U+0010, keyCode: 113, charCode: 0, keyCode: 113, which: 113
Modified: trunk/Source/WebCore/ChangeLog (237737 => 237738)
--- trunk/Source/WebCore/ChangeLog 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebCore/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
@@ -1,3 +1,34 @@
+2018-11-02 Daniel Bates <[email protected]>
+
+ [iOS] WebKit should dispatch DOM events when a modifier key is pressed
+ https://bugs.webkit.org/show_bug.cgi?id=190487
+
+ Reviewed by Tim Horton.
+
+ Add support for modifier flags change events.
+
+ * platform/ios/PlatformEventFactoryIOS.mm:
+ (WebCore::modifiersForEvent): Modifier keys do not have an associated character and do not
+ participate in key repeat.
+ (WebCore::keyIdentifierForKeyEvent): Identify modifier keys, returning "Unidentified" if
+ the modifier key is unidentified. This matches the behavior on Mac.
+ (WebCore::keyForKeyEvent): Identify modifier keys, returning the empty string if the modifier
+ key is unidentified. This matches the behavior on Mac.
+ (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
+ * 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:withFlags:withInputManagerHint:keyCode:isTabKey:]):
+ Modifier keys do not have an associated character and do not participate in key repeat.
+
+ (-[WebEvent _eventDescription]): Modified to print a description for a keydown or keyup event
+ that represents a modifier flags change.
+ (-[WebEvent characters]): Modifier keys do not have an associated character. Assert this
+ invariant as it is a programming error. On Mac, the same operation would result in a
+ NSInternalInconsistencyException exception being raised.
+ (-[WebEvent charactersIgnoringModifiers]): Ditto.
+
2018-11-02 Ali Juma <[email protected]>
Allow cross-document intersection observing
Modified: trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm (237737 => 237738)
--- trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -44,15 +44,15 @@
{
OptionSet<PlatformEvent::Modifier> modifiers;
- if (event.modifierFlags & WebEventFlagMaskShift)
+ if (event.modifierFlags & WebEventFlagMaskShiftKey)
modifiers.add(PlatformEvent::Modifier::ShiftKey);
- if (event.modifierFlags & WebEventFlagMaskControl)
+ if (event.modifierFlags & WebEventFlagMaskControlKey)
modifiers.add(PlatformEvent::Modifier::CtrlKey);
- if (event.modifierFlags & WebEventFlagMaskAlternate)
+ if (event.modifierFlags & WebEventFlagMaskOptionKey)
modifiers.add(PlatformEvent::Modifier::AltKey);
- if (event.modifierFlags & WebEventFlagMaskCommand)
+ if (event.modifierFlags & WebEventFlagMaskCommandKey)
modifiers.add(PlatformEvent::Modifier::MetaKey);
- if (event.modifierFlags & WebEventFlagMaskAlphaShift)
+ if (event.modifierFlags & WebEventFlagMaskLeftCapsLockKey)
modifiers.add(PlatformEvent::Modifier::CapsLockKey);
return modifiers;
@@ -127,6 +127,32 @@
String keyIdentifierForKeyEvent(WebEvent *event)
{
+ if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged) {
+ switch (event.keyCode) {
+ case VK_LWIN: // Left Command
+ case VK_APPS: // Right Command
+ return "Meta"_s;
+
+ case VK_CAPITAL: // Caps Lock
+ return "CapsLock"_s;
+
+ case VK_LSHIFT: // Left Shift
+ case VK_RSHIFT: // Right Shift
+ return "Shift"_s;
+
+ case VK_LMENU: // Left Alt
+ case VK_RMENU: // Right Alt
+ return "Alt"_s;
+
+ case VK_LCONTROL: // Left Ctrl
+ case VK_RCONTROL: // Right Ctrl
+ return "Control"_s;
+
+ default:
+ ASSERT_NOT_REACHED();
+ return emptyString();
+ }
+ }
NSString *characters = event.charactersIgnoringModifiers;
if ([characters length] != 1) {
LOG(Events, "received an unexpected number of characters in key event: %u", [characters length]);
@@ -137,6 +163,33 @@
String keyForKeyEvent(WebEvent *event)
{
+ if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged) {
+ switch (event.keyCode) {
+ case VK_LWIN: // Left Command
+ case VK_APPS: // Right Command
+ return "Meta"_s;
+
+ case VK_CAPITAL: // Caps Lock
+ return "CapsLock"_s;
+
+ case VK_LSHIFT: // Left Shift
+ case VK_RSHIFT: // Right Shift
+ return "Shift"_s;
+
+ case VK_LMENU: // Left Alt
+ case VK_RMENU: // Right Alt
+ return "Alt"_s;
+
+ case VK_LCONTROL: // Left Ctrl
+ case VK_RCONTROL: // Right Ctrl
+ return "Control"_s;
+
+ default:
+ ASSERT_NOT_REACHED();
+ return "Unidentified"_s;
+ }
+ }
+
NSString *characters = event.characters;
auto length = [characters length];
// characters return an empty string for dead keys.
@@ -371,13 +424,19 @@
m_modifiers = modifiersForEvent(event);
m_timestamp = WallTime::now();
- m_text = event.characters;
- m_unmodifiedText = event.charactersIgnoringModifiers;
+ if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged) {
+ m_text = emptyString();
+ m_unmodifiedText = emptyString();
+ m_autoRepeat = false;
+ } else {
+ m_text = event.characters;
+ m_unmodifiedText = event.charactersIgnoringModifiers;
+ m_autoRepeat = event.isKeyRepeating;
+ }
m_key = keyForKeyEvent(event);
m_code = codeForKeyEvent(event);
m_keyIdentifier = keyIdentifierForKeyEvent(event);
m_windowsVirtualKeyCode = event.keyCode;
- m_autoRepeat = event.isKeyRepeating;
m_isKeypad = false; // iOS does not distinguish the numpad. See <rdar://problem/7190835>.
m_isSystemKey = false;
m_Event = event;
Modified: trunk/Source/WebCore/platform/ios/WebEvent.h (237737 => 237738)
--- trunk/Source/WebCore/platform/ios/WebEvent.h 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebCore/platform/ios/WebEvent.h 2018-11-02 17:17:09 UTC (rev 237738)
@@ -56,17 +56,43 @@
WebEventTouchPhaseCancelled
} WebEventTouchPhaseType;
-// These enum values are copied directly from GSEvent for compatibility.
+// These enum values correspond to the GraphicsServices kGSEvent* enumerators for compatibility.
+enum {
+ WebEventLeftCommandKey,
+ WebEventLeftShiftKey,
+ WebEventLeftCapsLockKey,
+ WebEventLeftOptionKey,
+ WebEventLeftControlKey,
+ WebEventRightShiftKey,
+ WebEventRightOptionKey,
+ WebEventRightControlKey,
+ WebEventRightCommandKey,
+ WebEventDeadKey,
+};
+
+// These enum values correspond to the GraphicsServices kGSEventFlagMask* enumerators for compatibility.
typedef enum {
- WebEventFlagMaskAlphaShift = 0x00010000,
- WebEventFlagMaskShift = 0x00020000,
- WebEventFlagMaskControl = 0x00040000,
- WebEventFlagMaskAlternate = 0x00080000,
- WebEventFlagMaskCommand = 0x00100000,
+ WebEventFlagMaskLeftCommandKey = 1 << (WebEventLeftCommandKey + 16),
+ WebEventFlagMaskLeftShiftKey = 1 << (WebEventLeftShiftKey + 16),
+ WebEventFlagMaskLeftCapsLockKey = 1 << (WebEventLeftCapsLockKey + 16),
+ WebEventFlagMaskLeftOptionKey = 1 << (WebEventLeftOptionKey + 16),
+ WebEventFlagMaskLeftControlKey = 1 << (WebEventLeftControlKey + 16),
+ WebEventFlagMaskRightControlKey = 1 << (WebEventRightControlKey + 16),
+ WebEventFlagMaskRightShiftKey = 1 << (WebEventRightShiftKey + 16),
+ WebEventFlagMaskRightOptionKey = 1 << (WebEventRightOptionKey + 16),
+ WebEventFlagMaskRightCommandKey = 1 << (WebEventRightCommandKey + 16),
} WebEventFlagValues;
typedef unsigned WebEventFlags;
-// These enum values are copied directly from GSEvent for compatibility.
+// These enum values correspond to the GraphicsServices kGSEventFlagMask* enumerators for compatibility.
+enum {
+ WebEventFlagMaskCommandKey = WebEventFlagMaskLeftCommandKey | WebEventFlagMaskRightCommandKey,
+ WebEventFlagMaskOptionKey = WebEventFlagMaskLeftOptionKey | WebEventFlagMaskRightOptionKey,
+ WebEventFlagMaskControlKey = WebEventFlagMaskLeftControlKey | WebEventFlagMaskRightControlKey,
+ WebEventFlagMaskShiftKey = WebEventFlagMaskLeftShiftKey | WebEventFlagMaskRightShiftKey,
+};
+
+// These enum values correspond to the GraphicsServices kGSCharacterSet* constants for compatibility.
typedef enum {
WebEventCharacterSetASCII = 0,
WebEventCharacterSetSymbol = 1,
@@ -78,6 +104,7 @@
// These enum values are copied directly from UIKit for compatibility.
typedef enum {
WebEventKeyboardInputRepeat = 1 << 0,
+ WebEventKeyboardInputModifierFlagsChanged = 1 << 5,
} WebKeyboardInputFlagValues;
typedef NSUInteger WebKeyboardInputFlags;
Modified: trunk/Source/WebCore/platform/ios/WebEvent.mm (237737 => 237738)
--- trunk/Source/WebCore/platform/ios/WebEvent.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebCore/platform/ios/WebEvent.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -184,14 +184,8 @@
_type = type;
_timestamp = timeStamp;
-
- _characters = [normalizedStringWithAppKitCompatibilityMapping(characters) retain];
- _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers) retain];
+ _keyboardFlags = flags;
_modifierFlags = modifiers;
- _keyRepeating = repeating;
- _keyboardFlags = flags;
- _tabKey = tabKey;
-
if (keyCode)
_keyCode = windowsKeyCodeForKeyCode(keyCode);
else if ([charactersIgnoringModifiers length] == 1) {
@@ -199,6 +193,13 @@
_keyCode = windowsKeyCodeForCharCodeIOS([charactersIgnoringModifiers characterAtIndex:0]);
}
+ if (!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)) {
+ _characters = [normalizedStringWithAppKitCompatibilityMapping(characters) retain];
+ _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers) retain];
+ _tabKey = tabKey;
+ _keyRepeating = repeating;
+ }
+
return self;
}
@@ -219,15 +220,9 @@
_type = type;
_timestamp = timeStamp;
-
- _characters = [normalizedStringWithAppKitCompatibilityMapping(characters) retain];
- _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers) retain];
_modifierFlags = modifiers;
- _keyRepeating = repeating;
_keyboardFlags = flags;
_inputManagerHint = [hint retain];
- _tabKey = tabKey;
-
if (keyCode)
_keyCode = windowsKeyCodeForKeyCode(keyCode);
else if ([charactersIgnoringModifiers length] == 1) {
@@ -235,6 +230,13 @@
_keyCode = windowsKeyCodeForCharCodeIOS([charactersIgnoringModifiers characterAtIndex:0]);
}
+ if (!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)) {
+ _characters = [normalizedStringWithAppKitCompatibilityMapping(characters) retain];
+ _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers) retain];
+ _tabKey = tabKey;
+ _keyRepeating = repeating;
+ }
+
return self;
}
@@ -373,6 +375,8 @@
return [NSString stringWithFormat:@"location: (%f, %f) deltaX: %f deltaY: %f", _locationInWindow.x, _locationInWindow.y, _deltaX, _deltaY];
case WebEventKeyDown:
case WebEventKeyUp:
+ if (_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)
+ return [NSString stringWithFormat:@"flags: %d keyboardFlags: %lu keyCode %d", _modifierFlags, static_cast<unsigned long>(_keyboardFlags), _keyCode];
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:
@@ -402,6 +406,7 @@
- (NSString *)characters
{
ASSERT(_type == WebEventKeyDown || _type == WebEventKeyUp);
+ ASSERT(!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged));
return [[_characters retain] autorelease];
}
@@ -408,6 +413,7 @@
- (NSString *)charactersIgnoringModifiers
{
ASSERT(_type == WebEventKeyDown || _type == WebEventKeyUp);
+ ASSERT(!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged));
return [[_charactersIgnoringModifiers retain] autorelease];
}
Modified: trunk/Source/WebKit/ChangeLog (237737 => 237738)
--- trunk/Source/WebKit/ChangeLog 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKit/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
@@ -1,3 +1,24 @@
+2018-11-02 Daniel Bates <[email protected]>
+
+ [iOS] WebKit should dispatch DOM events when a modifier key is pressed
+ https://bugs.webkit.org/show_bug.cgi?id=190487
+
+ Reviewed by Tim Horton.
+
+ Add support for modifier flags change events dispatched by UIKit.
+
+ * Shared/ios/WebIOSEventFactory.mm:
+ (modifiersForEvent): Update for renamed enumerations.
+ (WebIOSEventFactory::createWebKeyboardEvent): Modifier keys do not have an associated
+ character and do not participate in key repeat.
+ * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
+ (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Update for renamed enumerations.
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _interpretKeyEvent:isCharEvent:]): Return NO if the event represents a
+ modifier flags change to allow the default handling.
+ * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
+ (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): Update for renamed enumerations.
+
2018-11-02 Chris Dumez <[email protected]>
[PSON] Reuse SuspendedPages' process when possible, for performance
Modified: trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm (237737 => 237738)
--- trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -36,15 +36,15 @@
unsigned modifiers = 0;
WebEventFlags eventModifierFlags = event.modifierFlags;
- if (eventModifierFlags & WebEventFlagMaskShift)
+ if (eventModifierFlags & WebEventFlagMaskShiftKey)
modifiers |= WebKit::WebEvent::ShiftKey;
- if (eventModifierFlags & WebEventFlagMaskControl)
+ if (eventModifierFlags & WebEventFlagMaskControlKey)
modifiers |= WebKit::WebEvent::ControlKey;
- if (eventModifierFlags & WebEventFlagMaskAlternate)
+ if (eventModifierFlags & WebEventFlagMaskOptionKey)
modifiers |= WebKit::WebEvent::AltKey;
- if (eventModifierFlags & WebEventFlagMaskCommand)
+ if (eventModifierFlags & WebEventFlagMaskCommandKey)
modifiers |= WebKit::WebEvent::MetaKey;
- if (eventModifierFlags & WebEventFlagMaskAlphaShift)
+ if (eventModifierFlags & WebEventFlagMaskLeftCapsLockKey)
modifiers |= WebKit::WebEvent::CapsLockKey;
return static_cast<WebKit::WebEvent::Modifiers>(modifiers);
@@ -53,8 +53,18 @@
WebKit::WebKeyboardEvent WebIOSEventFactory::createWebKeyboardEvent(::WebEvent *event)
{
WebKit::WebEvent::Type type = (event.type == WebEventKeyUp) ? WebKit::WebEvent::KeyUp : WebKit::WebEvent::KeyDown;
- String text = event.characters;
- String unmodifiedText = event.charactersIgnoringModifiers;
+ String text;
+ String unmodifiedText;
+ bool autoRepeat;
+ if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged) {
+ text = emptyString();
+ unmodifiedText = emptyString();
+ autoRepeat = false;
+ } else {
+ text = event.characters;
+ unmodifiedText = event.charactersIgnoringModifiers;
+ autoRepeat = event.isKeyRepeating;
+ }
String key = WebCore::keyForKeyEvent(event);
String code = WebCore::codeForKeyEvent(event);
String keyIdentifier = WebCore::keyIdentifierForKeyEvent(event);
@@ -62,7 +72,6 @@
// FIXME: This is not correct. WebEvent.keyCode represents the Windows native virtual key code.
int nativeVirtualKeyCode = event.keyCode;
int macCharCode = 0;
- bool autoRepeat = event.isKeyRepeating;
bool isKeypad = false;
bool isSystemKey = false;
WebKit::WebEvent::Modifiers modifiers = modifiersForEvent(event);
Modified: trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm (237737 => 237738)
--- trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -83,19 +83,19 @@
switch (virtualKey) {
case VirtualKey::Shift:
- changedModifiers |= WebEventFlagMaskShift;
+ changedModifiers |= WebEventFlagMaskShiftKey;
break;
case VirtualKey::Control:
- changedModifiers |= WebEventFlagMaskControl;
+ changedModifiers |= WebEventFlagMaskControlKey;
break;
case VirtualKey::Alternate:
- changedModifiers |= WebEventFlagMaskAlternate;
+ changedModifiers |= WebEventFlagMaskOptionKey;
break;
case VirtualKey::Meta:
// The 'meta' key does not exist on Apple keyboards and is usually
// mapped to the Command key when using third-party keyboards.
case VirtualKey::Command:
- changedModifiers |= WebEventFlagMaskCommand;
+ changedModifiers |= WebEventFlagMaskCommandKey;
break;
default:
break;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (237737 => 237738)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -3786,7 +3786,7 @@
handler(event, eventWasHandled);
return;
}
-
+
// If we aren't interacting with editable content, we still need to call [super _handleKeyUIEvent:]
// so that keyboard repeat will work correctly. If we are interacting with editable content,
// we already did so in _handleKeyUIEvent.
@@ -3816,6 +3816,9 @@
static const unsigned kWebDeleteForwardKey = 0xF728;
static const unsigned kWebSpaceKey = 0x20;
+ if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)
+ return NO;
+
BOOL contentEditable = _page->editorState().isContentEditable;
if (!contentEditable && event.isTabKey)
Modified: trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm (237737 => 237738)
--- trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -216,9 +216,9 @@
if (key == Key::Other)
return std::nullopt;
- BOOL shiftPressed = event.modifierFlags & WebEventFlagMaskShift;
- BOOL altPressed = event.modifierFlags & WebEventFlagMaskAlternate;
- BOOL cmdPressed = event.modifierFlags & WebEventFlagMaskCommand;
+ BOOL shiftPressed = event.modifierFlags & WebEventFlagMaskShiftKey;
+ BOOL altPressed = event.modifierFlags & WebEventFlagMaskOptionKey;
+ BOOL cmdPressed = event.modifierFlags & WebEventFlagMaskCommandKey;
auto increment = ^{
switch (key) {
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (237737 => 237738)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
@@ -1,3 +1,16 @@
+2018-11-02 Daniel Bates <[email protected]>
+
+ [iOS] WebKit should dispatch DOM events when a modifier key is pressed
+ https://bugs.webkit.org/show_bug.cgi?id=190487
+
+ Reviewed by Tim Horton.
+
+ Having Legacy WebKit return NO if the editing event represents a modifier flags change to
+ allow the default handling.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _handleEditingKeyEvent:]):
+
2018-11-01 Sihui Liu <[email protected]>
Add a storage limit for IndexedDB
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (237737 => 237738)
--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -6067,6 +6067,8 @@
if (auto* platformEvent = wcEvent->underlyingPlatformEvent()) {
WebEvent *event = platformEvent->event();
+ if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)
+ return NO;
if (![[self _webView] isEditable] && event.isTabKey)
return NO;
Modified: trunk/Tools/ChangeLog (237737 => 237738)
--- trunk/Tools/ChangeLog 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Tools/ChangeLog 2018-11-02 17:17:09 UTC (rev 237738)
@@ -1,3 +1,21 @@
+2018-11-02 Daniel Bates <[email protected]>
+
+ [iOS] WebKit should dispatch DOM events when a modifier key is pressed
+ https://bugs.webkit.org/show_bug.cgi?id=190487
+
+ Reviewed by Tim Horton.
+
+ Update the code for renamed enumerations. For WebKitTestRunner, removed comment that does not
+ match my observations when using the simulator to simulate iOS 12 and add support for testing
+ right-hand side modifiers.
+
+ * DumpRenderTree/mac/EventSendingController.mm:
+ (modifierFlags):
+ (-[EventSendingController keyDown:withModifiers:withLocation:]):
+ (-[EventSendingController setTouchModifier:value:]):
+ * WebKitTestRunner/ios/HIDEventGenerator.mm:
+ (hidUsageCodeForCharacter):
+
2018-11-02 Chris Dumez <[email protected]>
[PSON] Reuse SuspendedPages' process when possible, for performance
Modified: trunk/Tools/DumpRenderTree/mac/EventSendingController.mm (237737 => 237738)
--- trunk/Tools/DumpRenderTree/mac/EventSendingController.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Tools/DumpRenderTree/mac/EventSendingController.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -525,11 +525,11 @@
const int commandKeyMask = NSEventModifierFlagCommand;
const int capsLockKeyMask = NSEventModifierFlagCapsLock;
#else
- const int controlKeyMask = WebEventFlagMaskControl;
- const int shiftKeyMask = WebEventFlagMaskShift;
- const int alternateKeyMask = WebEventFlagMaskAlternate;
- const int commandKeyMask = WebEventFlagMaskCommand;
- const int capsLockKeyMask = WebEventFlagMaskAlphaShift;
+ const int controlKeyMask = WebEventFlagMaskLeftControlKey;
+ const int shiftKeyMask = WebEventFlagMaskLeftShiftKey;
+ const int alternateKeyMask = WebEventFlagMaskLeftOptionKey;
+ const int commandKeyMask = WebEventFlagMaskLeftCommandKey;
+ const int capsLockKeyMask = WebEventFlagMaskLeftCapsLockKey;
#endif
int flags = 0;
@@ -1110,7 +1110,7 @@
#if !PLATFORM(IOS_FAMILY)
modifierFlags |= NSEventModifierFlagShift;
#else
- modifierFlags |= WebEventFlagMaskAlphaShift;
+ modifierFlags |= WebEventFlagMaskLeftShiftKey;
#endif
charactersIgnoringModifiers = [character lowercaseString];
}
@@ -1436,13 +1436,13 @@
unsigned modifier = 0;
if ([modifierName isEqualToString:@"alt"])
- modifier = WebEventFlagMaskAlternate;
+ modifier = WebEventFlagMaskLeftOptionKey;
else if ([modifierName isEqualToString:@"shift"])
- modifier = WebEventFlagMaskShift;
+ modifier = WebEventFlagMaskLeftShiftKey;
else if ([modifierName isEqualToString:@"meta"])
- modifier = WebEventFlagMaskCommand;
+ modifier = WebEventFlagMaskLeftCommandKey;
else if ([modifierName isEqualToString:@"ctrl"])
- modifier = WebEventFlagMaskControl;
+ modifier = WebEventFlagMaskLeftControlKey;
if (!modifier)
return;
Modified: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm (237737 => 237738)
--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm 2018-11-02 16:55:13 UTC (rev 237737)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm 2018-11-02 17:17:09 UTC (rev 237738)
@@ -960,13 +960,18 @@
return kHIDUsage_KeyboardRightGUI;
if ([key isEqualToString:@"clear"]) // Num Lock / Clear
return kHIDUsage_KeypadNumLock;
- // The simulator keyboard interprets both left and right modifier keys using the left version of the usage code.
- if ([key isEqualToString:@"leftControl"] || [key isEqualToString:@"rightControl"])
+ if ([key isEqualToString:@"leftControl"])
return kHIDUsage_KeyboardLeftControl;
- if ([key isEqualToString:@"leftShift"] || [key isEqualToString:@"rightShift"])
+ if ([key isEqualToString:@"rightControl"])
+ return kHIDUsage_KeyboardRightControl;
+ if ([key isEqualToString:@"leftShift"])
return kHIDUsage_KeyboardLeftShift;
- if ([key isEqualToString:@"leftAlt"] || [key isEqualToString:@"rightAlt"])
+ if ([key isEqualToString:@"rightShift"])
+ return kHIDUsage_KeyboardRightShift;
+ if ([key isEqualToString:@"leftAlt"])
return kHIDUsage_KeyboardLeftAlt;
+ if ([key isEqualToString:@"rightAlt"])
+ return kHIDUsage_KeyboardRightAlt;
return 0;
}
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
