Changeset 247232 in webkit


Ignore:
Timestamp:
Jul 8, 2019 4:07:03 PM (5 years ago)
Author:
dbates@webkit.org
Message:

Command + . generates Escape with key identifier Period, should be Escape
https://bugs.webkit.org/show_bug.cgi?id=199393
<rdar://problem/52498001>

Reviewed by Wenson Hsieh.

Source/WebCore:

Remap the key code for Command + . before we compute the Windows virtual key code.
Otherwise, the Windows virtual key code reveals the pre-mapped key code.

  • platform/ios/WebEvent.mm:

(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):

LayoutTests:

Update test result.

  • fast/events/ios/key-events-comprehensive/key-events-meta-expected.txt:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r247229 r247232  
     12019-07-08  Daniel Bates  <dabates@apple.com>
     2
     3        Command + . generates Escape with key identifier Period, should be Escape
     4        https://bugs.webkit.org/show_bug.cgi?id=199393
     5        <rdar://problem/52498001>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Update test result.
     10
     11        * fast/events/ios/key-events-comprehensive/key-events-meta-expected.txt:
     12
    1132019-07-08  Charlie Turner  <cturner@igalia.com>
    214
  • trunk/LayoutTests/fast/events/ios/key-events-comprehensive/key-events-meta-expected.txt

    r246450 r247232  
    147147Test Command + .:
    148148type: keydown, key: Meta, code: MetaLeft, keyIdentifier: Meta, keyCode: 91, charCode: 0, keyCode: 91, which: 91, altKey: false, ctrlKey: false, metaKey: true, shiftKey: false, location: 1, keyLocation: 1
    149 type: keydown, key: Escape, code: Period, keyIdentifier: U+001B, keyCode: 27, charCode: 0, keyCode: 27, which: 27, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, location: 0, keyLocation: 0
    150 type: keypress, key: Escape, code: Period, keyIdentifier: , keyCode: 27, charCode: 27, keyCode: 27, which: 27, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, location: 0, keyLocation: 0
     149type: keydown, key: Escape, code: Escape, keyIdentifier: U+001B, keyCode: 27, charCode: 0, keyCode: 27, which: 27, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, location: 0, keyLocation: 0
     150type: keypress, key: Escape, code: Escape, keyIdentifier: , keyCode: 27, charCode: 27, keyCode: 27, which: 27, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, location: 0, keyLocation: 0
    151151type: keyup, key: Meta, code: MetaLeft, keyIdentifier: Meta, keyCode: 91, charCode: 0, keyCode: 91, which: 91, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, location: 1, keyLocation: 1
    152152
  • trunk/Source/WebCore/ChangeLog

    r247231 r247232  
     12019-07-08  Daniel Bates  <dabates@apple.com>
     2
     3        Command + . generates Escape with key identifier Period, should be Escape
     4        https://bugs.webkit.org/show_bug.cgi?id=199393
     5        <rdar://problem/52498001>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Remap the key code for Command + . before we compute the Windows virtual key code.
     10        Otherwise, the Windows virtual key code reveals the pre-mapped key code.
     11
     12        * platform/ios/WebEvent.mm:
     13        (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
     14
    1152019-07-08  Alex Christensen  <achristensen@webkit.org>
    216
  • trunk/Source/WebCore/platform/ios/WebEvent.mm

    r245644 r247232  
    186186    _keyboardFlags = flags;
    187187    _inputManagerHint = [hint retain];
     188
     189    BOOL flagsChanged = _keyboardFlags & WebEventKeyboardInputModifierFlagsChanged;
     190    if (!flagsChanged) {
     191        // Map Command + . to Escape since Apple Smart Keyboards lack an Escape key.
     192        // FIXME: This doesn't work for some keyboard layouts, like French. See <rdar://problem/51047011>.
     193        if ([charactersIgnoringModifiers isEqualToString:@"."] && (modifiers & WebEventFlagMaskCommandKey)) {
     194            keyCode = kHIDUsage_KeyboardEscape;
     195            _modifierFlags &= ~WebEventFlagMaskCommandKey;
     196        }
     197    }
     198
    188199    if (keyCode)
    189200        _keyCode = windowsKeyCodeForKeyCode(keyCode);
     
    193204    }
    194205
    195     if (!(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged)) {
    196         // Map Command + . to Escape since Apple Smart Keyboards lack an Escape key.
    197         if ([charactersIgnoringModifiers isEqualToString:@"."] && (modifiers & WebEventFlagMaskCommandKey)) {
    198             keyCode = kHIDUsage_KeyboardEscape;
    199             _modifierFlags &= ~WebEventFlagMaskCommandKey;
    200         }
     206    if (!flagsChanged) {
    201207        _characters = [normalizedStringWithAppKitCompatibilityMapping(characters, keyCode) retain];
    202208        _charactersIgnoringModifiers = [normalizedStringWithAppKitCompatibilityMapping(charactersIgnoringModifiers, keyCode) retain];
Note: See TracChangeset for help on using the changeset viewer.