Changeset 236417 in webkit


Ignore:
Timestamp:
Sep 24, 2018 12:13:14 PM (5 years ago)
Author:
dbates@webkit.org
Message:

[iOS] Key code is 0 for many hardware keyboard keys
https://bugs.webkit.org/show_bug.cgi?id=189604

Reviewed by Wenson Hsieh.

Source/WebCore:

Based off a patch by Jeremy Jones.

Add iOS-specific implementation of windowsKeyCodeForKeyCode() to map an iOS virtual key code to
the corresponding Windows virtual key code. Only hardware keyboard-generated events have a
virtual key code. For software-generated keyboard events we do what we do now and compute the
Windows virtual key code from the character string associated with the event.

When a WebEvent is instantiated with a non-zero iOS virtual key code (keyCode) we now always
convert it to its corresponding Windows virtual key code without considering the specified
charactersIgnoringModifiers character string. Currently we prefer computing the key code from
charactersIgnoringModifiers regardless of whether a non-zero iOS virtual key code was given.
However this causes special keys, including function keys (e.g. F10) to be misidentified because
keyboard layouts in iOS (at least iOS 12) map such special keys to ASCII control characters (e.g.
F10 maps to ASCII control character "data link escape" = 0x10) as opposed to special 16-bit
integral constants as we do on Mac (e.g. F10 maps to NSF10FunctionKey = 0xF70D on Mac). I will
look to fix up the computation of a Windows virtual key code from a char code on iOS in a
subsequent commit(s). For now, computing the Windows virtual key code directly from the iOS
virtual key code specified to the WebEvent constructor avoids the misidentification using
an ANSI US keyboard layout.

  • platform/cocoa/KeyEventCocoa.mm:

(WebCore::windowsKeyCodeForKeyCode): Deleted; moved to KeyEventMac.mm as this mapping is specific to Mac.

  • platform/ios/KeyEventIOS.mm:

(WebCore::windowsKeyCodeForKeyCode): Added.

  • platform/ios/WebEvent.mm:

(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]): Address the NOTE comment and compute the Windows virtual key code from
the iOS virtual key code when we have one. Also inline the value of an unncessary local variable.
(-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]): Ditto.

  • platform/mac/KeyEventMac.mm:

(WebCore::windowsKeyCodeForKeyCode): Moved from KeyEventCocoa.mm. Updated code to make use of WTF_ARRAY_LENGTH() instead
of hardcoding the upper bound of the lookup table.

Source/WebKit:

For a hardware keyboard-generated event (an event with a non-nill event._hidEvent) pass
the key code for the event. Otherwise, do what we do now and pass 0 as the event is likely
a software keyboard-generated event.

  • Platform/spi/ios/UIKitSPI.h: Add some more SPI.
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView handleKeyEvent:]):

LayoutTests:

Update existing test and test result and add a new test to ensure we dispatch DOM keydown
and DOM keyup events dispatched for special keys.

  • fast/events/ios/keydown-keyup-in-non-editable-content-expected.txt: Update expected result.
  • fast/events/ios/keydown-keyup-in-non-editable-content.html: Remove logic to test arrow keys

as these are tested in test keydown-keyup-special-keys-in-non-editable-element.html. Also
update manual instructions to use <kbd> to format keyboard keys.

  • fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r236416 r236417  
     12018-09-24  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Key code is 0 for many hardware keyboard keys
     4        https://bugs.webkit.org/show_bug.cgi?id=189604
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Update existing test and test result and add a new test to ensure we dispatch DOM keydown
     9        and DOM keyup events dispatched for special keys.
     10
     11        * fast/events/ios/keydown-keyup-in-non-editable-content-expected.txt: Update expected result.
     12        * fast/events/ios/keydown-keyup-in-non-editable-content.html: Remove logic to test arrow keys
     13        as these are tested in test keydown-keyup-special-keys-in-non-editable-element.html. Also
     14        update manual instructions to use <kbd> to format keyboard keys.
     15        * fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
     16
    1172018-09-24  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/LayoutTests/fast/events/ios/keydown-keyup-in-non-editable-content-expected.txt

    r235860 r236417  
    1 This tests that DOM keydown and keyup events are dispatched to a non-editable <body> on iOS for hardware key presses. To run this test manually, verify that two messages are emitted when you press the following keys: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -, =, [, ], \, ;, ', ,, ., /, <return>, ↑, ↓, ←, →.
     1This tests that DOM keydown and keyup events are dispatched to a non-editable <body> on iOS for hardware key presses of non-special keys. To run this test manually, verify that two messages are emitted when you press the following keys: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -, =, [, ], \, ;, ', ,, ., /.
    22
    33type: keydown, key: a, code: KeyA, keyIdentifier: U+0041, keyCode: 65, charCode: 0, keyCode: 65, which: 65
    4 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     4type: keyup, key: Dead, code: KeyA, keyIdentifier: Unidentified, keyCode: 65, charCode: 0, keyCode: 65, which: 65
    55type: keydown, key: b, code: KeyB, keyIdentifier: U+0042, keyCode: 66, charCode: 0, keyCode: 66, which: 66
    6 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     6type: keyup, key: Dead, code: KeyB, keyIdentifier: Unidentified, keyCode: 66, charCode: 0, keyCode: 66, which: 66
    77type: keydown, key: c, code: KeyC, keyIdentifier: U+0043, keyCode: 67, charCode: 0, keyCode: 67, which: 67
    8 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     8type: keyup, key: Dead, code: KeyC, keyIdentifier: Unidentified, keyCode: 67, charCode: 0, keyCode: 67, which: 67
    99type: keydown, key: d, code: KeyD, keyIdentifier: U+0044, keyCode: 68, charCode: 0, keyCode: 68, which: 68
    10 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     10type: keyup, key: Dead, code: KeyD, keyIdentifier: Unidentified, keyCode: 68, charCode: 0, keyCode: 68, which: 68
    1111type: keydown, key: e, code: KeyE, keyIdentifier: U+0045, keyCode: 69, charCode: 0, keyCode: 69, which: 69
    12 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     12type: keyup, key: Dead, code: KeyE, keyIdentifier: Unidentified, keyCode: 69, charCode: 0, keyCode: 69, which: 69
    1313type: keydown, key: f, code: KeyF, keyIdentifier: U+0046, keyCode: 70, charCode: 0, keyCode: 70, which: 70
    14 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     14type: keyup, key: Dead, code: KeyF, keyIdentifier: Unidentified, keyCode: 70, charCode: 0, keyCode: 70, which: 70
    1515type: keydown, key: g, code: KeyG, keyIdentifier: U+0047, keyCode: 71, charCode: 0, keyCode: 71, which: 71
    16 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     16type: keyup, key: Dead, code: KeyG, keyIdentifier: Unidentified, keyCode: 71, charCode: 0, keyCode: 71, which: 71
    1717type: keydown, key: h, code: KeyH, keyIdentifier: U+0048, keyCode: 72, charCode: 0, keyCode: 72, which: 72
    18 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     18type: keyup, key: Dead, code: KeyH, keyIdentifier: Unidentified, keyCode: 72, charCode: 0, keyCode: 72, which: 72
    1919type: keydown, key: i, code: KeyI, keyIdentifier: U+0049, keyCode: 73, charCode: 0, keyCode: 73, which: 73
    20 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     20type: keyup, key: Dead, code: KeyI, keyIdentifier: Unidentified, keyCode: 73, charCode: 0, keyCode: 73, which: 73
    2121type: keydown, key: j, code: KeyJ, keyIdentifier: U+004A, keyCode: 74, charCode: 0, keyCode: 74, which: 74
    22 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     22type: keyup, key: Dead, code: KeyJ, keyIdentifier: Unidentified, keyCode: 74, charCode: 0, keyCode: 74, which: 74
    2323type: keydown, key: k, code: KeyK, keyIdentifier: U+004B, keyCode: 75, charCode: 0, keyCode: 75, which: 75
    24 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     24type: keyup, key: Dead, code: KeyK, keyIdentifier: Unidentified, keyCode: 75, charCode: 0, keyCode: 75, which: 75
    2525type: keydown, key: l, code: KeyL, keyIdentifier: U+004C, keyCode: 76, charCode: 0, keyCode: 76, which: 76
    26 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     26type: keyup, key: Dead, code: KeyL, keyIdentifier: Unidentified, keyCode: 76, charCode: 0, keyCode: 76, which: 76
    2727type: keydown, key: m, code: KeyM, keyIdentifier: U+004D, keyCode: 77, charCode: 0, keyCode: 77, which: 77
    28 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     28type: keyup, key: Dead, code: KeyM, keyIdentifier: Unidentified, keyCode: 77, charCode: 0, keyCode: 77, which: 77
    2929type: keydown, key: n, code: KeyN, keyIdentifier: U+004E, keyCode: 78, charCode: 0, keyCode: 78, which: 78
    30 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     30type: keyup, key: Dead, code: KeyN, keyIdentifier: Unidentified, keyCode: 78, charCode: 0, keyCode: 78, which: 78
    3131type: keydown, key: o, code: KeyO, keyIdentifier: U+004F, keyCode: 79, charCode: 0, keyCode: 79, which: 79
    32 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     32type: keyup, key: Dead, code: KeyO, keyIdentifier: Unidentified, keyCode: 79, charCode: 0, keyCode: 79, which: 79
    3333type: keydown, key: p, code: KeyP, keyIdentifier: U+0050, keyCode: 80, charCode: 0, keyCode: 80, which: 80
    34 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     34type: keyup, key: Dead, code: KeyP, keyIdentifier: Unidentified, keyCode: 80, charCode: 0, keyCode: 80, which: 80
    3535type: keydown, key: q, code: KeyQ, keyIdentifier: U+0051, keyCode: 81, charCode: 0, keyCode: 81, which: 81
    36 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     36type: keyup, key: Dead, code: KeyQ, keyIdentifier: Unidentified, keyCode: 81, charCode: 0, keyCode: 81, which: 81
    3737type: keydown, key: r, code: KeyR, keyIdentifier: U+0052, keyCode: 82, charCode: 0, keyCode: 82, which: 82
    38 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     38type: keyup, key: Dead, code: KeyR, keyIdentifier: Unidentified, keyCode: 82, charCode: 0, keyCode: 82, which: 82
    3939type: keydown, key: s, code: KeyS, keyIdentifier: U+0053, keyCode: 83, charCode: 0, keyCode: 83, which: 83
    40 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     40type: keyup, key: Dead, code: KeyS, keyIdentifier: Unidentified, keyCode: 83, charCode: 0, keyCode: 83, which: 83
    4141type: keydown, key: t, code: KeyT, keyIdentifier: U+0054, keyCode: 84, charCode: 0, keyCode: 84, which: 84
    42 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     42type: keyup, key: Dead, code: KeyT, keyIdentifier: Unidentified, keyCode: 84, charCode: 0, keyCode: 84, which: 84
    4343type: keydown, key: u, code: KeyU, keyIdentifier: U+0055, keyCode: 85, charCode: 0, keyCode: 85, which: 85
    44 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     44type: keyup, key: Dead, code: KeyU, keyIdentifier: Unidentified, keyCode: 85, charCode: 0, keyCode: 85, which: 85
    4545type: keydown, key: v, code: KeyV, keyIdentifier: U+0056, keyCode: 86, charCode: 0, keyCode: 86, which: 86
    46 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     46type: keyup, key: Dead, code: KeyV, keyIdentifier: Unidentified, keyCode: 86, charCode: 0, keyCode: 86, which: 86
    4747type: keydown, key: w, code: KeyW, keyIdentifier: U+0057, keyCode: 87, charCode: 0, keyCode: 87, which: 87
    48 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     48type: keyup, key: Dead, code: KeyW, keyIdentifier: Unidentified, keyCode: 87, charCode: 0, keyCode: 87, which: 87
    4949type: keydown, key: x, code: KeyX, keyIdentifier: U+0058, keyCode: 88, charCode: 0, keyCode: 88, which: 88
    50 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     50type: keyup, key: Dead, code: KeyX, keyIdentifier: Unidentified, keyCode: 88, charCode: 0, keyCode: 88, which: 88
    5151type: keydown, key: y, code: KeyY, keyIdentifier: U+0059, keyCode: 89, charCode: 0, keyCode: 89, which: 89
    52 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     52type: keyup, key: Dead, code: KeyY, keyIdentifier: Unidentified, keyCode: 89, charCode: 0, keyCode: 89, which: 89
    5353type: keydown, key: z, code: KeyZ, keyIdentifier: U+005A, keyCode: 90, charCode: 0, keyCode: 90, which: 90
    54 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     54type: keyup, key: Dead, code: KeyZ, keyIdentifier: Unidentified, keyCode: 90, charCode: 0, keyCode: 90, which: 90
    5555type: keydown, key: 0, code: Digit0, keyIdentifier: U+0030, keyCode: 48, charCode: 0, keyCode: 48, which: 48
    56 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     56type: keyup, key: Dead, code: Digit0, keyIdentifier: Unidentified, keyCode: 48, charCode: 0, keyCode: 48, which: 48
    5757type: keydown, key: 1, code: Digit1, keyIdentifier: U+0031, keyCode: 49, charCode: 0, keyCode: 49, which: 49
    58 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     58type: keyup, key: Dead, code: Digit1, keyIdentifier: Unidentified, keyCode: 49, charCode: 0, keyCode: 49, which: 49
    5959type: keydown, key: 2, code: Digit2, keyIdentifier: U+0032, keyCode: 50, charCode: 0, keyCode: 50, which: 50
    60 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     60type: keyup, key: Dead, code: Digit2, keyIdentifier: Unidentified, keyCode: 50, charCode: 0, keyCode: 50, which: 50
    6161type: keydown, key: 3, code: Digit3, keyIdentifier: U+0033, keyCode: 51, charCode: 0, keyCode: 51, which: 51
    62 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     62type: keyup, key: Dead, code: Digit3, keyIdentifier: Unidentified, keyCode: 51, charCode: 0, keyCode: 51, which: 51
    6363type: keydown, key: 4, code: Digit4, keyIdentifier: U+0034, keyCode: 52, charCode: 0, keyCode: 52, which: 52
    64 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     64type: keyup, key: Dead, code: Digit4, keyIdentifier: Unidentified, keyCode: 52, charCode: 0, keyCode: 52, which: 52
    6565type: keydown, key: 5, code: Digit5, keyIdentifier: U+0035, keyCode: 53, charCode: 0, keyCode: 53, which: 53
    66 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     66type: keyup, key: Dead, code: Digit5, keyIdentifier: Unidentified, keyCode: 53, charCode: 0, keyCode: 53, which: 53
    6767type: keydown, key: 6, code: Digit6, keyIdentifier: U+0036, keyCode: 54, charCode: 0, keyCode: 54, which: 54
    68 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     68type: keyup, key: Dead, code: Digit6, keyIdentifier: Unidentified, keyCode: 54, charCode: 0, keyCode: 54, which: 54
    6969type: keydown, key: 7, code: Digit7, keyIdentifier: U+0037, keyCode: 55, charCode: 0, keyCode: 55, which: 55
    70 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     70type: keyup, key: Dead, code: Digit7, keyIdentifier: Unidentified, keyCode: 55, charCode: 0, keyCode: 55, which: 55
    7171type: keydown, key: 8, code: Digit8, keyIdentifier: U+0038, keyCode: 56, charCode: 0, keyCode: 56, which: 56
    72 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     72type: keyup, key: Dead, code: Digit8, keyIdentifier: Unidentified, keyCode: 56, charCode: 0, keyCode: 56, which: 56
    7373type: keydown, key: 9, code: Digit9, keyIdentifier: U+0039, keyCode: 57, charCode: 0, keyCode: 57, which: 57
    74 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     74type: keyup, key: Dead, code: Digit9, keyIdentifier: Unidentified, keyCode: 57, charCode: 0, keyCode: 57, which: 57
    7575type: keydown, key: -, code: Minus, keyIdentifier: U+002D, keyCode: 189, charCode: 0, keyCode: 189, which: 189
    76 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     76type: keyup, key: Dead, code: Minus, keyIdentifier: Unidentified, keyCode: 189, charCode: 0, keyCode: 189, which: 189
    7777type: keydown, key: =, code: Equal, keyIdentifier: U+003D, keyCode: 187, charCode: 0, keyCode: 187, which: 187
    78 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     78type: keyup, key: Dead, code: Equal, keyIdentifier: Unidentified, keyCode: 187, charCode: 0, keyCode: 187, which: 187
    7979type: keydown, key: [, code: BracketLeft, keyIdentifier: U+005B, keyCode: 219, charCode: 0, keyCode: 219, which: 219
    80 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     80type: keyup, key: Dead, code: BracketLeft, keyIdentifier: Unidentified, keyCode: 219, charCode: 0, keyCode: 219, which: 219
    8181type: keydown, key: ], code: BracketRight, keyIdentifier: U+005D, keyCode: 221, charCode: 0, keyCode: 221, which: 221
    82 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     82type: keyup, key: Dead, code: BracketRight, keyIdentifier: Unidentified, keyCode: 221, charCode: 0, keyCode: 221, which: 221
    8383type: keydown, key: \, code: Backslash, keyIdentifier: U+005C, keyCode: 220, charCode: 0, keyCode: 220, which: 220
    84 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     84type: keyup, key: Dead, code: Backslash, keyIdentifier: Unidentified, keyCode: 220, charCode: 0, keyCode: 220, which: 220
    8585type: keydown, key: ;, code: Semicolon, keyIdentifier: U+003B, keyCode: 186, charCode: 0, keyCode: 186, which: 186
    86 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     86type: keyup, key: Dead, code: Semicolon, keyIdentifier: Unidentified, keyCode: 186, charCode: 0, keyCode: 186, which: 186
    8787type: keydown, key: ', code: Quote, keyIdentifier: U+0027, keyCode: 222, charCode: 0, keyCode: 222, which: 222
    88 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     88type: keyup, key: Dead, code: Quote, keyIdentifier: Unidentified, keyCode: 222, charCode: 0, keyCode: 222, which: 222
    8989type: keydown, key: ,, code: Comma, keyIdentifier: U+002C, keyCode: 188, charCode: 0, keyCode: 188, which: 188
    90 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     90type: keyup, key: Dead, code: Comma, keyIdentifier: Unidentified, keyCode: 188, charCode: 0, keyCode: 188, which: 188
    9191type: keydown, key: ., code: Period, keyIdentifier: U+002E, keyCode: 190, charCode: 0, keyCode: 190, which: 190
    92 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     92type: keyup, key: Dead, code: Period, keyIdentifier: Unidentified, keyCode: 190, charCode: 0, keyCode: 190, which: 190
    9393type: keydown, key: /, code: Slash, keyIdentifier: U+002F, keyCode: 191, charCode: 0, keyCode: 191, which: 191
    94 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    95 type: keydown, key: Enter, code: Enter, keyIdentifier: Enter, keyCode: 13, charCode: 0, keyCode: 13, which: 13
    96 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    97 type: keydown, key: ArrowUp, code: ArrowUp, keyIdentifier: Up, keyCode: 38, charCode: 0, keyCode: 38, which: 38
    98 type: keyup, key: ArrowUp, code: ArrowUp, keyIdentifier: Up, keyCode: 38, charCode: 0, keyCode: 38, which: 38
    99 type: keyup, key: ArrowDown, code: ArrowDown, keyIdentifier: Down, keyCode: 40, charCode: 0, keyCode: 40, which: 40
    100 type: keydown, key: ArrowLeft, code: ArrowLeft, keyIdentifier: Left, keyCode: 37, charCode: 0, keyCode: 37, which: 37
    101 type: keyup, key: ArrowLeft, code: ArrowLeft, keyIdentifier: Left, keyCode: 37, charCode: 0, keyCode: 37, which: 37
    102 type: keyup, key: ArrowRight, code: ArrowRight, keyIdentifier: Right, keyCode: 39, charCode: 0, keyCode: 39, which: 39
     94type: keyup, key: Dead, code: Slash, keyIdentifier: Unidentified, keyCode: 191, charCode: 0, keyCode: 191, which: 191
    10395
  • trunk/LayoutTests/fast/events/ios/keydown-keyup-in-non-editable-content.html

    r235858 r236417  
    1212</head>
    1313<body onkeydown="handleKeyDown(event)" onkeyup="handleKeyUp(event)">
    14 <p>This tests that DOM keydown and keyup events are dispatched to a non-editable &lt;body&gt; on iOS for hardware key presses. To run this test manually, verify that two messages are emitted when you press the following keys: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -, =, [, ], \, ;, ', ,, ., /, &lt;return&gt;, &#x2191;, &#x2193;, &#x2190;, &#x2192;.</p>
     14<p>This tests that DOM keydown and keyup events are dispatched to a non-editable &lt;body&gt; on iOS for hardware key presses of non-special keys. To run this test manually, verify that two messages are emitted when you press the following keys: <kbd>a</kbd>, <kbd>b</kbd>, <kbd>c</kbd>, <kbd>d</kbd>, <kbd>e</kbd>, <kbd>f</kbd>, <kbd>g</kbd>, <kbd>h</kbd>, <kbd>i</kbd>, <kbd>j</kbd>, <kbd>k</kbd>, <kbd>l</kbd>, <kbd>m</kbd>, <kbd>n</kbd>, <kbd>o</kbd>, <kbd>p</kbd>, <kbd>q</kbd>, <kbd>r</kbd>, <kbd>s</kbd>, <kbd>t</kbd>, <kbd>u</kbd>, <kbd>v</kbd>, <kbd>w</kbd>, <kbd>x</kbd>, <kbd>y</kbd>, <kbd>z</kbd>, <kbd>0</kbd>, <kbd>1</kbd>, <kbd>2</kbd>, <kbd>3</kbd>, <kbd>4</kbd>, <kbd>5</kbd>, <kbd>6</kbd>, <kbd>7</kbd>, <kbd>8</kbd>, <kbd>9</kbd>, <kbd>-</kbd>, <kbd>=</kbd>, <kbd>[</kbd>, <kbd>]</kbd>, <kbd>\</kbd>, <kbd>;</kbd>, <kbd>'</kbd>, <kbd>,</kbd>, <kbd>.</kbd>, <kbd>/</kbd>.</p>
    1515<pre id="console"></pre>
    1616<script>
    17 const asciiCharacters = "abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;',./\r".split("");
    18 const specialKeys = ["upArrow", "downArrow", "leftArrow", "rightArrow"];
    19 
    20 var remainingKeysToPress = asciiCharacters.concat(specialKeys);
     17const asciiCharacters = "abcdefghijklmnopqrstuvwxyz0123456789-=[]\\;',./".split("");
     18var remainingKeysToPress = asciiCharacters;
    2119
    2220async function nextKeyPress()
  • trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt

    r236271 r236417  
    88type: keyup, key: ArrowRight, code: ArrowRight, keyIdentifier: Right, keyCode: 39, charCode: 0, keyCode: 39, which: 39
    99type: keydown, key: Backspace, code: Backspace, keyIdentifier: U+0008, keyCode: 8, charCode: 0, keyCode: 8, which: 8
    10 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    11 type: keydown, key: , code: Unidentified, keyIdentifier: U+0004, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    12 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     10type: keyup, key: Dead, code: Backspace, keyIdentifier: Unidentified, keyCode: 8, charCode: 0, keyCode: 8, which: 8
     11type: keydown, key: , code: End, keyIdentifier: U+0004, keyCode: 35, charCode: 0, keyCode: 35, which: 35
     12type: keyup, key: Dead, code: End, keyIdentifier: Unidentified, keyCode: 35, charCode: 0, keyCode: 35, which: 35
    1313type: keydown, key: Enter, code: Enter, keyIdentifier: Enter, keyCode: 13, charCode: 0, keyCode: 13, which: 13
    14 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    15 type: keydown, key: UIKeyInputEscape, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    16 type: keyup, key: UIKeyInputEscape, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    17 type: keydown, key: , code: Unidentified, keyIdentifier: U+0001, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    18 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     14type: keyup, key: Dead, code: Enter, keyIdentifier: Unidentified, keyCode: 13, charCode: 0, keyCode: 13, which: 13
     15type: keydown, key: UIKeyInputEscape, code: Escape, keyIdentifier: Unidentified, keyCode: 27, charCode: 0, keyCode: 27, which: 27
     16type: keyup, key: UIKeyInputEscape, code: Escape, keyIdentifier: Unidentified, keyCode: 27, charCode: 0, keyCode: 27, which: 27
     17type: keydown, key: , code: Home, keyIdentifier: U+0001, keyCode: 36, charCode: 0, keyCode: 36, which: 36
     18type: keyup, key: Dead, code: Home, keyIdentifier: Unidentified, keyCode: 36, charCode: 0, keyCode: 36, which: 36
     19type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 45, charCode: 0, keyCode: 45, which: 45
     20type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 45, charCode: 0, keyCode: 45, which: 45
     21type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
     22type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
     23type: keydown, key: Dead, code: MetaLeft, keyIdentifier: Unidentified, keyCode: 91, charCode: 0, keyCode: 91, which: 91
     24type: keyup, key: Dead, code: MetaLeft, keyIdentifier: Unidentified, keyCode: 91, charCode: 0, keyCode: 91, which: 91
     25type: keydown, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
     26type: keyup, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
     27type: keydown, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
     28type: keyup, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
     29type: keydown, key: UIKeyInputPageDown, code: PageDown, keyIdentifier: Unidentified, keyCode: 34, charCode: 0, keyCode: 34, which: 34
     30type: keyup, key: UIKeyInputPageDown, code: PageDown, keyIdentifier: Unidentified, keyCode: 34, charCode: 0, keyCode: 34, which: 34
     31type: keyup, key: UIKeyInputPageUp, code: PageUp, keyIdentifier: Unidentified, keyCode: 33, charCode: 0, keyCode: 33, which: 33
     32type: keydown, key: Enter, code: Enter, keyIdentifier: Enter, keyCode: 13, charCode: 0, keyCode: 13, which: 13
     33type: keyup, key: Dead, code: Enter, keyIdentifier: Unidentified, keyCode: 13, charCode: 0, keyCode: 13, which: 13
     34type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
     35type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 18, charCode: 0, keyCode: 18, which: 18
     36type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 93, charCode: 0, keyCode: 93, which: 93
     37type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 93, charCode: 0, keyCode: 93, which: 93
     38type: keydown, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
     39type: keyup, key: Dead, code: ControlLeft, keyIdentifier: Unidentified, keyCode: 17, charCode: 0, keyCode: 17, which: 17
     40type: keydown, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
     41type: keyup, key: Dead, code: ShiftLeft, keyIdentifier: Unidentified, keyCode: 16, charCode: 0, keyCode: 16, which: 16
     42type: keydown, key: , code: F1, keyIdentifier: U+0010, keyCode: 112, charCode: 0, keyCode: 112, which: 112
     43type: keyup, key: Dead, code: F1, keyIdentifier: Unidentified, keyCode: 112, charCode: 0, keyCode: 112, which: 112
     44type: keydown, key: , code: F2, keyIdentifier: U+0010, keyCode: 113, charCode: 0, keyCode: 113, which: 113
     45type: keyup, key: Dead, code: F2, keyIdentifier: Unidentified, keyCode: 113, charCode: 0, keyCode: 113, which: 113
     46type: keydown, key: , code: F3, keyIdentifier: U+0010, keyCode: 114, charCode: 0, keyCode: 114, which: 114
     47type: keyup, key: Dead, code: F3, keyIdentifier: Unidentified, keyCode: 114, charCode: 0, keyCode: 114, which: 114
     48type: keydown, key: , code: F4, keyIdentifier: U+0010, keyCode: 115, charCode: 0, keyCode: 115, which: 115
     49type: keyup, key: Dead, code: F4, keyIdentifier: Unidentified, keyCode: 115, charCode: 0, keyCode: 115, which: 115
     50type: keydown, key: , code: F5, keyIdentifier: U+0010, keyCode: 116, charCode: 0, keyCode: 116, which: 116
     51type: keyup, key: Dead, code: F5, keyIdentifier: Unidentified, keyCode: 116, charCode: 0, keyCode: 116, which: 116
     52type: keydown, key: , code: F6, keyIdentifier: U+0010, keyCode: 117, charCode: 0, keyCode: 117, which: 117
     53type: keyup, key: Dead, code: F6, keyIdentifier: Unidentified, keyCode: 117, charCode: 0, keyCode: 117, which: 117
     54type: keydown, key: , code: F7, keyIdentifier: U+0010, keyCode: 118, charCode: 0, keyCode: 118, which: 118
     55type: keyup, key: Dead, code: F7, keyIdentifier: Unidentified, keyCode: 118, charCode: 0, keyCode: 118, which: 118
     56type: keydown, key: , code: F8, keyIdentifier: U+0010, keyCode: 119, charCode: 0, keyCode: 119, which: 119
     57type: keyup, key: Dead, code: F8, keyIdentifier: Unidentified, keyCode: 119, charCode: 0, keyCode: 119, which: 119
     58type: keydown, key: , code: F9, keyIdentifier: U+0010, keyCode: 120, charCode: 0, keyCode: 120, which: 120
     59type: keyup, key: Dead, code: F9, keyIdentifier: Unidentified, keyCode: 120, charCode: 0, keyCode: 120, which: 120
     60type: keydown, key: , code: F10, keyIdentifier: U+0010, keyCode: 121, charCode: 0, keyCode: 121, which: 121
     61type: keyup, key: Dead, code: F10, keyIdentifier: Unidentified, keyCode: 121, charCode: 0, keyCode: 121, which: 121
     62type: keydown, key: , code: F11, keyIdentifier: U+0010, keyCode: 122, charCode: 0, keyCode: 122, which: 122
     63type: keyup, key: Dead, code: F11, keyIdentifier: Unidentified, keyCode: 122, charCode: 0, keyCode: 122, which: 122
     64type: keydown, key: , code: F12, keyIdentifier: U+0010, keyCode: 123, charCode: 0, keyCode: 123, which: 123
     65type: keyup, key: Dead, code: F12, keyIdentifier: Unidentified, keyCode: 123, charCode: 0, keyCode: 123, which: 123
     66type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 43, charCode: 0, keyCode: 43, which: 43
     67type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 43, charCode: 0, keyCode: 43, which: 43
     68type: keydown, key: , code: Unidentified, keyIdentifier: U+0005, keyCode: 45, charCode: 0, keyCode: 45, which: 45
     69type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 45, charCode: 0, keyCode: 45, which: 45
    1970type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    2071type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    21 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    22 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    23 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    24 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    25 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    26 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    27 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    28 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    29 type: keydown, key: UIKeyInputPageDown, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    30 type: keyup, key: UIKeyInputPageDown, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    31 type: keyup, key: UIKeyInputPageUp, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    32 type: keydown, key: Enter, code: Enter, keyIdentifier: Enter, keyCode: 13, charCode: 0, keyCode: 13, which: 13
    33 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    34 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    35 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    36 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    37 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    38 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    39 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    40 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    41 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    42 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    43 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    44 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    45 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    46 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    47 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    48 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    49 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    50 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    51 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    52 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    53 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    54 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    55 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    56 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    57 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    58 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    59 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    60 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    61 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    62 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    63 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    64 type: keydown, key: , code: Unidentified, keyIdentifier: U+0010, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    65 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    66 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    67 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    68 type: keydown, key: , code: Unidentified, keyIdentifier: U+0005, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    69 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     72type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 41, charCode: 0, keyCode: 41, which: 41
     73type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 41, charCode: 0, keyCode: 41, which: 41
    7074type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    7175type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     
    8286type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    8387type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    84 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    85 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    86 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    87 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    88 type: keydown, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
    89 type: keyup, key: Dead, code: Unidentified, keyIdentifier: Unidentified, keyCode: 0, charCode: 0, keyCode: 0, which: 0
     88type: keydown, key: Dead, code: AudioVolumeMute, keyIdentifier: Unidentified, keyCode: 173, charCode: 0, keyCode: 173, which: 173
     89type: keyup, key: Dead, code: AudioVolumeMute, keyIdentifier: Unidentified, keyCode: 173, charCode: 0, keyCode: 173, which: 173
    9090
  • trunk/Source/WebCore/ChangeLog

    r236416 r236417  
     12018-09-24  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Key code is 0 for many hardware keyboard keys
     4        https://bugs.webkit.org/show_bug.cgi?id=189604
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Based off a patch by Jeremy Jones.
     9
     10        Add iOS-specific implementation of windowsKeyCodeForKeyCode() to map an iOS virtual key code to
     11        the corresponding Windows virtual key code. Only hardware keyboard-generated events have a
     12        virtual key code. For software-generated keyboard events we do what we do now and compute the
     13        Windows virtual key code from the character string associated with the event.
     14
     15        When a WebEvent is instantiated with a non-zero iOS virtual key code (keyCode) we now always
     16        convert it to its corresponding Windows virtual key code without considering the specified
     17        charactersIgnoringModifiers character string. Currently we prefer computing the key code from
     18        charactersIgnoringModifiers regardless of whether a non-zero iOS virtual key code was given.
     19        However this causes special keys, including function keys (e.g. F10) to be misidentified because
     20        keyboard layouts in iOS (at least iOS 12) map such special keys to ASCII control characters (e.g.
     21        F10 maps to ASCII control character "data link escape" = 0x10) as opposed to special 16-bit
     22        integral constants as we do on Mac (e.g. F10 maps to NSF10FunctionKey = 0xF70D on Mac). I will
     23        look to fix up the computation of a Windows virtual key code from a char code on iOS in a
     24        subsequent commit(s). For now, computing the Windows virtual key code directly from the iOS
     25        virtual key code specified to the WebEvent constructor avoids the misidentification using
     26        an ANSI US keyboard layout.
     27
     28        * platform/cocoa/KeyEventCocoa.mm:
     29        (WebCore::windowsKeyCodeForKeyCode): Deleted; moved to KeyEventMac.mm as this mapping is specific to Mac.
     30        * platform/ios/KeyEventIOS.mm:
     31        (WebCore::windowsKeyCodeForKeyCode): Added.
     32        * platform/ios/WebEvent.mm:
     33        (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]): Address the NOTE comment and compute the Windows virtual key code from
     34        the iOS virtual key code when we have one. Also inline the value of an unncessary local variable.
     35        (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]): Ditto.
     36        * platform/mac/KeyEventMac.mm:
     37        (WebCore::windowsKeyCodeForKeyCode): Moved from KeyEventCocoa.mm. Updated code to make use of WTF_ARRAY_LENGTH() instead
     38        of hardcoding the upper bound of the lookup table.
     39
    1402018-09-24  Simon Fraser  <simon.fraser@apple.com>
    241
  • trunk/Source/WebCore/platform/cocoa/KeyEventCocoa.mm

    r234501 r236417  
    485485}
    486486
    487 int windowsKeyCodeForKeyCode(uint16_t keyCode)
    488 {
    489     static const int windowsKeyCode[] = {
    490         /* 0 */ VK_A,
    491         /* 1 */ VK_S,
    492         /* 2 */ VK_D,
    493         /* 3 */ VK_F,
    494         /* 4 */ VK_H,
    495         /* 5 */ VK_G,
    496         /* 6 */ VK_Z,
    497         /* 7 */ VK_X,
    498         /* 8 */ VK_C,
    499         /* 9 */ VK_V,
    500         /* 0x0A */ VK_OEM_3, // "Section" - key to the left from 1 (ISO Keyboard Only)
    501         /* 0x0B */ VK_B,
    502         /* 0x0C */ VK_Q,
    503         /* 0x0D */ VK_W,
    504         /* 0x0E */ VK_E,
    505         /* 0x0F */ VK_R,
    506         /* 0x10 */ VK_Y,
    507         /* 0x11 */ VK_T,
    508         /* 0x12 */ VK_1,
    509         /* 0x13 */ VK_2,
    510         /* 0x14 */ VK_3,
    511         /* 0x15 */ VK_4,
    512         /* 0x16 */ VK_6,
    513         /* 0x17 */ VK_5,
    514         /* 0x18 */ VK_OEM_PLUS, // =+
    515         /* 0x19 */ VK_9,
    516         /* 0x1A */ VK_7,
    517         /* 0x1B */ VK_OEM_MINUS, // -_
    518         /* 0x1C */ VK_8,
    519         /* 0x1D */ VK_0,
    520         /* 0x1E */ VK_OEM_6, // ]}
    521         /* 0x1F */ VK_O,
    522         /* 0x20 */ VK_U,
    523         /* 0x21 */ VK_OEM_4, // {[
    524         /* 0x22 */ VK_I,
    525         /* 0x23 */ VK_P,
    526         /* 0x24 */ VK_RETURN, // Return
    527         /* 0x25 */ VK_L,
    528         /* 0x26 */ VK_J,
    529         /* 0x27 */ VK_OEM_7, // '"
    530         /* 0x28 */ VK_K,
    531         /* 0x29 */ VK_OEM_1, // ;:
    532         /* 0x2A */ VK_OEM_5, // \|
    533         /* 0x2B */ VK_OEM_COMMA, // ,<
    534         /* 0x2C */ VK_OEM_2, // /?
    535         /* 0x2D */ VK_N,
    536         /* 0x2E */ VK_M,
    537         /* 0x2F */ VK_OEM_PERIOD, // .>
    538         /* 0x30 */ VK_TAB,
    539         /* 0x31 */ VK_SPACE,
    540         /* 0x32 */ VK_OEM_3, // `~
    541         /* 0x33 */ VK_BACK, // Backspace
    542         /* 0x34 */ 0, // n/a
    543         /* 0x35 */ VK_ESCAPE,
    544         /* 0x36 */ VK_APPS, // Right Command
    545         /* 0x37 */ VK_LWIN, // Left Command
    546         /* 0x38 */ VK_LSHIFT, // Left Shift
    547         /* 0x39 */ VK_CAPITAL, // Caps Lock
    548         /* 0x3A */ VK_LMENU, // Left Option
    549         /* 0x3B */ VK_LCONTROL, // Left Ctrl
    550         /* 0x3C */ VK_RSHIFT, // Right Shift
    551         /* 0x3D */ VK_RMENU, // Right Option
    552         /* 0x3E */ VK_RCONTROL, // Right Ctrl
    553         /* 0x3F */ 0, // fn
    554         /* 0x40 */ VK_F17,
    555         /* 0x41 */ VK_DECIMAL, // Num Pad .
    556         /* 0x42 */ 0, // n/a
    557         /* 0x43 */ VK_MULTIPLY, // Num Pad *
    558         /* 0x44 */ 0, // n/a
    559         /* 0x45 */ VK_ADD, // Num Pad +
    560         /* 0x46 */ 0, // n/a
    561         /* 0x47 */ VK_CLEAR, // Num Pad Clear
    562         /* 0x48 */ VK_VOLUME_UP,
    563         /* 0x49 */ VK_VOLUME_DOWN,
    564         /* 0x4A */ VK_VOLUME_MUTE,
    565         /* 0x4B */ VK_DIVIDE, // Num Pad /
    566         /* 0x4C */ VK_RETURN, // Num Pad Enter
    567         /* 0x4D */ 0, // n/a
    568         /* 0x4E */ VK_SUBTRACT, // Num Pad -
    569         /* 0x4F */ VK_F18,
    570         /* 0x50 */ VK_F19,
    571         /* 0x51 */ VK_OEM_PLUS, // Num Pad =. There is no such key on common PC keyboards, mapping to normal "+=".
    572         /* 0x52 */ VK_NUMPAD0,
    573         /* 0x53 */ VK_NUMPAD1,
    574         /* 0x54 */ VK_NUMPAD2,
    575         /* 0x55 */ VK_NUMPAD3,
    576         /* 0x56 */ VK_NUMPAD4,
    577         /* 0x57 */ VK_NUMPAD5,
    578         /* 0x58 */ VK_NUMPAD6,
    579         /* 0x59 */ VK_NUMPAD7,
    580         /* 0x5A */ VK_F20,
    581         /* 0x5B */ VK_NUMPAD8,
    582         /* 0x5C */ VK_NUMPAD9,
    583         /* 0x5D */ 0, // Yen (JIS Keyboard Only)
    584         /* 0x5E */ 0, // Underscore (JIS Keyboard Only)
    585         /* 0x5F */ 0, // KeypadComma (JIS Keyboard Only)
    586         /* 0x60 */ VK_F5,
    587         /* 0x61 */ VK_F6,
    588         /* 0x62 */ VK_F7,
    589         /* 0x63 */ VK_F3,
    590         /* 0x64 */ VK_F8,
    591         /* 0x65 */ VK_F9,
    592         /* 0x66 */ 0, // Eisu (JIS Keyboard Only)
    593         /* 0x67 */ VK_F11,
    594         /* 0x68 */ 0, // Kana (JIS Keyboard Only)
    595         /* 0x69 */ VK_F13,
    596         /* 0x6A */ VK_F16,
    597         /* 0x6B */ VK_F14,
    598         /* 0x6C */ 0, // n/a
    599         /* 0x6D */ VK_F10,
    600         /* 0x6E */ 0, // n/a (Windows95 key?)
    601         /* 0x6F */ VK_F12,
    602         /* 0x70 */ 0, // n/a
    603         /* 0x71 */ VK_F15,
    604         /* 0x72 */ VK_INSERT, // Help
    605         /* 0x73 */ VK_HOME, // Home
    606         /* 0x74 */ VK_PRIOR, // Page Up
    607         /* 0x75 */ VK_DELETE, // Forward Delete
    608         /* 0x76 */ VK_F4,
    609         /* 0x77 */ VK_END, // End
    610         /* 0x78 */ VK_F2,
    611         /* 0x79 */ VK_NEXT, // Page Down
    612         /* 0x7A */ VK_F1,
    613         /* 0x7B */ VK_LEFT, // Left Arrow
    614         /* 0x7C */ VK_RIGHT, // Right Arrow
    615         /* 0x7D */ VK_DOWN, // Down Arrow
    616         /* 0x7E */ VK_UP, // Up Arrow
    617         /* 0x7F */ 0 // n/a
    618     };
    619 
    620     if (keyCode >= 0x80)
    621         return 0;
    622 
    623      return windowsKeyCode[keyCode];
    624 }
    625 
    626487int windowsKeyCodeForCharCode(unichar charCode)
    627488{
  • trunk/Source/WebCore/platform/ios/KeyEventIOS.mm

    r165676 r236417  
    2929#if PLATFORM(IOS)
    3030
     31#import "KeyEventCocoa.h"
    3132#import "NotImplemented.h"
     33#import "WindowsKeyboardCodes.h"
     34#import <pal/spi/cocoa/IOKitSPI.h>
    3235
    3336using namespace WTF;
    3437
    3538namespace WebCore {
     39
     40int windowsKeyCodeForKeyCode(uint16_t keyCode)
     41{
     42    static const int windowsKeyCode[] = {
     43        /* 0 */ 0, // n/a
     44        /* 1 */ 0, // n/a
     45        /* 2 */ 0, // n/a
     46        /* 3 */ 0, // n/a
     47        /* 4 */ VK_A,
     48        /* 5 */ VK_B,
     49        /* 6 */ VK_C,
     50        /* 7 */ VK_D,
     51        /* 8 */ VK_E,
     52        /* 9 */ VK_F,
     53        /* 0x0A */ VK_G,
     54        /* 0x0B */ VK_H,
     55        /* 0x0C */ VK_I,
     56        /* 0x0D */ VK_J,
     57        /* 0x0E */ VK_K,
     58        /* 0x0F */ VK_L,
     59        /* 0x10 */ VK_M,
     60        /* 0x11 */ VK_N,
     61        /* 0x12 */ VK_O,
     62        /* 0x13 */ VK_P,
     63        /* 0x14 */ VK_Q,
     64        /* 0x15 */ VK_R,
     65        /* 0x16 */ VK_S,
     66        /* 0x17 */ VK_T,
     67        /* 0x18 */ VK_U,
     68        /* 0x19 */ VK_V,
     69        /* 0x1A */ VK_W,
     70        /* 0x1B */ VK_X,
     71        /* 0x1C */ VK_Y,
     72        /* 0x1D */ VK_Z,
     73        /* 0x1E */ VK_1,
     74        /* 0x1F */ VK_2,
     75        /* 0x20 */ VK_3,
     76        /* 0x21 */ VK_4,
     77        /* 0x22 */ VK_5,
     78        /* 0x23 */ VK_6,
     79        /* 0x24 */ VK_7,
     80        /* 0x25 */ VK_8,
     81        /* 0x26 */ VK_9,
     82        /* 0x27 */ VK_0,
     83        /* 0x28 */ VK_RETURN, // Return
     84        /* 0x29 */ VK_ESCAPE,
     85        /* 0x2A */ VK_BACK, // Backspace
     86        /* 0x2B */ VK_TAB,
     87        /* 0x2C */ VK_SPACE,
     88        /* 0x2D */ VK_OEM_MINUS, // -_
     89        /* 0x2E */ VK_OEM_PLUS, // =+
     90        /* 0x2F */ VK_OEM_4, // [{
     91        /* 0x30 */ VK_OEM_6, // ]}
     92        /* 0x31 */ VK_OEM_5, // \|
     93        /* 0x32 */ 0, // kHIDUsage_KeyboardNonUSPound
     94        /* 0x33 */ VK_OEM_1, // ;:
     95        /* 0x34 */ VK_OEM_7, // '"
     96        /* 0x35 */ VK_OEM_3, // `~
     97        /* 0x36 */ VK_OEM_COMMA, // ,<
     98        /* 0x37 */ VK_OEM_PERIOD, // .>
     99        /* 0x38 */ VK_OEM_2, // /?
     100        /* 0x39 */ VK_CAPITAL, // Caps Lock
     101        /* 0x3A */ VK_F1,
     102        /* 0x3B */ VK_F2,
     103        /* 0x3C */ VK_F3,
     104        /* 0x3D */ VK_F4,
     105        /* 0x3E */ VK_F5,
     106        /* 0x3F */ VK_F6,
     107        /* 0x40 */ VK_F7,
     108        /* 0x41 */ VK_F8,
     109        /* 0x42 */ VK_F9,
     110        /* 0x43 */ VK_F10,
     111        /* 0x44 */ VK_F11,
     112        /* 0x45 */ VK_F12,
     113        /* 0x46 */ VK_SNAPSHOT, // Print Screen
     114        /* 0x47 */ VK_SCROLL, // Scroll Lock
     115        /* 0x48 */ VK_PAUSE,
     116        /* 0x49 */ VK_INSERT,
     117        /* 0x4A */ VK_HOME, // Home
     118        /* 0x4B */ VK_PRIOR, // Page Up
     119        /* 0x4C */ VK_DELETE, // Forward Delete
     120        /* 0x4D */ VK_END, // End
     121        /* 0x4E */ VK_NEXT, // Page Down
     122        /* 0x4F */ VK_RIGHT, // Right Arrow
     123        /* 0x50 */ VK_LEFT, // Left Arrow
     124        /* 0x51 */ VK_DOWN, // Down Arrow
     125        /* 0x52 */ VK_UP, // Up Arrow
     126        /* 0x53 */ VK_CLEAR, // Num Pad Clear
     127        /* 0x54 */ VK_DIVIDE, // Num Pad /
     128        /* 0x55 */ VK_MULTIPLY, // Num Pad *
     129        /* 0x56 */ VK_SUBTRACT, // Num Pad -
     130        /* 0x57 */ VK_ADD, // Num Pad +
     131        /* 0x58 */ VK_RETURN, // Num Pad Enter
     132        /* 0x59 */ VK_NUMPAD1,
     133        /* 0x5A */ VK_NUMPAD2,
     134        /* 0x5B */ VK_NUMPAD3,
     135        /* 0x5C */ VK_NUMPAD4,
     136        /* 0x5D */ VK_NUMPAD5,
     137        /* 0x5E */ VK_NUMPAD6,
     138        /* 0x5F */ VK_NUMPAD7,
     139        /* 0x60 */ VK_NUMPAD8,
     140        /* 0x61 */ VK_NUMPAD9,
     141        /* 0x62 */ VK_NUMPAD0,
     142        /* 0x63 */ VK_DECIMAL, // Num Pad .
     143        /* 0x64 */ 0, // Non-ANSI \|
     144        /* 0x65 */ 0, // Application
     145        /* 0x66 */ 0, // Power
     146        /* 0x67 */ VK_OEM_PLUS, // Num Pad =. There is no such key on common PC keyboards, mapping to normal "+=".
     147        /* 0x68 */ VK_F13,
     148        /* 0x69 */ VK_F14,
     149        /* 0x6A */ VK_F15,
     150        /* 0x6B */ VK_F16,
     151        /* 0x6C */ VK_F17,
     152        /* 0x6D */ VK_F18,
     153        /* 0x6E */ VK_F19,
     154        /* 0x6F */ VK_F20,
     155        /* 0x70 */ VK_F21,
     156        /* 0x71 */ VK_F22,
     157        /* 0x72 */ VK_F23,
     158        /* 0x73 */ VK_F24,
     159        /* 0x74 */ VK_EXECUTE,
     160        /* 0x75 */ VK_INSERT, // Help
     161        /* 0x76 */ 0, // Menu
     162        /* 0x77 */ VK_SELECT,
     163        /* 0x78 */ 0, // Stop
     164        /* 0x79 */ 0, // Again
     165        /* 0x7A */ 0, // Undo
     166        /* 0x7B */ 0, // Cut
     167        /* 0x7C */ 0, // Copy
     168        /* 0x7D */ 0, // Paste
     169        /* 0x7E */ 0, // Find
     170        /* 0x7F */ VK_VOLUME_MUTE, // Mute
     171        /* 0x80 */ VK_VOLUME_UP, // Volume Up
     172        /* 0x81 */ VK_VOLUME_DOWN, // Volume Down
     173    };
     174    // Check if key is a modifier.
     175    switch (keyCode) {
     176    case kHIDUsage_KeyboardLeftControl:
     177        return VK_LCONTROL;
     178    case kHIDUsage_KeyboardLeftShift:
     179        return VK_LSHIFT;
     180    case kHIDUsage_KeyboardLeftAlt: // Left Option
     181        return VK_LMENU;
     182    case kHIDUsage_KeyboardLeftGUI: // Left Command
     183        return VK_LWIN;
     184    case kHIDUsage_KeyboardRightControl:
     185        return VK_RCONTROL;
     186    case kHIDUsage_KeyboardRightShift:
     187        return VK_RSHIFT;
     188    case kHIDUsage_KeyboardRightAlt: // Right Option
     189        return VK_RMENU;
     190    case kHIDUsage_KeyboardRightGUI: // Right Command
     191        return VK_APPS;
     192    }
     193    // Otherwise check all other known keys.
     194    if (keyCode < WTF_ARRAY_LENGTH(windowsKeyCode))
     195        return windowsKeyCode[keyCode];
     196    return 0; // Unknown key
     197}
    36198
    37199void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode)
  • trunk/Source/WebCore/platform/ios/WebEvent.mm

    r223476 r236417  
    151151    if (keyCode)
    152152        _keyCode = windowsKeyCodeForKeyCode(keyCode);
    153 
    154     // NOTE: this preserves the original semantics which used the
    155     // characters string for the keyCode. This should be changed in iOS 4.0 to
    156     // allow the client to explicitly specify a keyCode, otherwise default to
    157     // mapping the characters string to a keyCode.
    158     // e.g. add an 'else' before this 'if'.
    159     if ([charactersIgnoringModifiers length] == 1) {
    160         unichar ch = [charactersIgnoringModifiers characterAtIndex:0];
    161         _keyCode = windowsKeyCodeForCharCodeIOS(ch);
     153    else if ([charactersIgnoringModifiers length] == 1) {
     154        // This event is likely for a software keyboard-generated event.
     155        _keyCode = windowsKeyCodeForCharCodeIOS([charactersIgnoringModifiers characterAtIndex:0]);
    162156    }
    163157
     
    193187    if (keyCode)
    194188        _keyCode = windowsKeyCodeForKeyCode(keyCode);
    195    
    196     // NOTE: this preserves the original semantics which used the
    197     // characters string for the keyCode. This should be changed in iOS 4.0 to
    198     // allow the client to explicitly specify a keyCode, otherwise default to
    199     // mapping the characters string to a keyCode.
    200     // e.g. add an 'else' before this 'if'.
    201     if ([charactersIgnoringModifiers length] == 1) {
    202         unichar ch = [charactersIgnoringModifiers characterAtIndex:0];
    203         _keyCode = windowsKeyCodeForCharCodeIOS(ch);
    204     }
    205    
     189    else if ([charactersIgnoringModifiers length] == 1) {
     190        // This event is likely for a software keyboard-generated event.
     191        _keyCode = windowsKeyCodeForCharCodeIOS([charactersIgnoringModifiers characterAtIndex:0]);
     192    }
     193
    206194    return self;
    207195}
  • trunk/Source/WebCore/platform/mac/KeyEventMac.mm

    r223476 r236417  
    3737using namespace WTF;
    3838
     39int windowsKeyCodeForKeyCode(uint16_t keyCode)
     40{
     41    static const int windowsKeyCode[] = {
     42        /* 0 */ VK_A,
     43        /* 1 */ VK_S,
     44        /* 2 */ VK_D,
     45        /* 3 */ VK_F,
     46        /* 4 */ VK_H,
     47        /* 5 */ VK_G,
     48        /* 6 */ VK_Z,
     49        /* 7 */ VK_X,
     50        /* 8 */ VK_C,
     51        /* 9 */ VK_V,
     52        /* 0x0A */ VK_OEM_3, // "Section" - key to the left from 1 (ISO Keyboard Only)
     53        /* 0x0B */ VK_B,
     54        /* 0x0C */ VK_Q,
     55        /* 0x0D */ VK_W,
     56        /* 0x0E */ VK_E,
     57        /* 0x0F */ VK_R,
     58        /* 0x10 */ VK_Y,
     59        /* 0x11 */ VK_T,
     60        /* 0x12 */ VK_1,
     61        /* 0x13 */ VK_2,
     62        /* 0x14 */ VK_3,
     63        /* 0x15 */ VK_4,
     64        /* 0x16 */ VK_6,
     65        /* 0x17 */ VK_5,
     66        /* 0x18 */ VK_OEM_PLUS, // =+
     67        /* 0x19 */ VK_9,
     68        /* 0x1A */ VK_7,
     69        /* 0x1B */ VK_OEM_MINUS, // -_
     70        /* 0x1C */ VK_8,
     71        /* 0x1D */ VK_0,
     72        /* 0x1E */ VK_OEM_6, // ]}
     73        /* 0x1F */ VK_O,
     74        /* 0x20 */ VK_U,
     75        /* 0x21 */ VK_OEM_4, // {[
     76        /* 0x22 */ VK_I,
     77        /* 0x23 */ VK_P,
     78        /* 0x24 */ VK_RETURN, // Return
     79        /* 0x25 */ VK_L,
     80        /* 0x26 */ VK_J,
     81        /* 0x27 */ VK_OEM_7, // '"
     82        /* 0x28 */ VK_K,
     83        /* 0x29 */ VK_OEM_1, // ;:
     84        /* 0x2A */ VK_OEM_5, // \|
     85        /* 0x2B */ VK_OEM_COMMA, // ,<
     86        /* 0x2C */ VK_OEM_2, // /?
     87        /* 0x2D */ VK_N,
     88        /* 0x2E */ VK_M,
     89        /* 0x2F */ VK_OEM_PERIOD, // .>
     90        /* 0x30 */ VK_TAB,
     91        /* 0x31 */ VK_SPACE,
     92        /* 0x32 */ VK_OEM_3, // `~
     93        /* 0x33 */ VK_BACK, // Backspace
     94        /* 0x34 */ 0, // n/a
     95        /* 0x35 */ VK_ESCAPE,
     96        /* 0x36 */ VK_APPS, // Right Command
     97        /* 0x37 */ VK_LWIN, // Left Command
     98        /* 0x38 */ VK_LSHIFT, // Left Shift
     99        /* 0x39 */ VK_CAPITAL, // Caps Lock
     100        /* 0x3A */ VK_LMENU, // Left Option
     101        /* 0x3B */ VK_LCONTROL, // Left Ctrl
     102        /* 0x3C */ VK_RSHIFT, // Right Shift
     103        /* 0x3D */ VK_RMENU, // Right Option
     104        /* 0x3E */ VK_RCONTROL, // Right Ctrl
     105        /* 0x3F */ 0, // fn
     106        /* 0x40 */ VK_F17,
     107        /* 0x41 */ VK_DECIMAL, // Num Pad .
     108        /* 0x42 */ 0, // n/a
     109        /* 0x43 */ VK_MULTIPLY, // Num Pad *
     110        /* 0x44 */ 0, // n/a
     111        /* 0x45 */ VK_ADD, // Num Pad +
     112        /* 0x46 */ 0, // n/a
     113        /* 0x47 */ VK_CLEAR, // Num Pad Clear
     114        /* 0x48 */ VK_VOLUME_UP,
     115        /* 0x49 */ VK_VOLUME_DOWN,
     116        /* 0x4A */ VK_VOLUME_MUTE,
     117        /* 0x4B */ VK_DIVIDE, // Num Pad /
     118        /* 0x4C */ VK_RETURN, // Num Pad Enter
     119        /* 0x4D */ 0, // n/a
     120        /* 0x4E */ VK_SUBTRACT, // Num Pad -
     121        /* 0x4F */ VK_F18,
     122        /* 0x50 */ VK_F19,
     123        /* 0x51 */ VK_OEM_PLUS, // Num Pad =. There is no such key on common PC keyboards, mapping to normal "+=".
     124        /* 0x52 */ VK_NUMPAD0,
     125        /* 0x53 */ VK_NUMPAD1,
     126        /* 0x54 */ VK_NUMPAD2,
     127        /* 0x55 */ VK_NUMPAD3,
     128        /* 0x56 */ VK_NUMPAD4,
     129        /* 0x57 */ VK_NUMPAD5,
     130        /* 0x58 */ VK_NUMPAD6,
     131        /* 0x59 */ VK_NUMPAD7,
     132        /* 0x5A */ VK_F20,
     133        /* 0x5B */ VK_NUMPAD8,
     134        /* 0x5C */ VK_NUMPAD9,
     135        /* 0x5D */ 0, // Yen (JIS Keyboard Only)
     136        /* 0x5E */ 0, // Underscore (JIS Keyboard Only)
     137        /* 0x5F */ 0, // KeypadComma (JIS Keyboard Only)
     138        /* 0x60 */ VK_F5,
     139        /* 0x61 */ VK_F6,
     140        /* 0x62 */ VK_F7,
     141        /* 0x63 */ VK_F3,
     142        /* 0x64 */ VK_F8,
     143        /* 0x65 */ VK_F9,
     144        /* 0x66 */ 0, // Eisu (JIS Keyboard Only)
     145        /* 0x67 */ VK_F11,
     146        /* 0x68 */ 0, // Kana (JIS Keyboard Only)
     147        /* 0x69 */ VK_F13,
     148        /* 0x6A */ VK_F16,
     149        /* 0x6B */ VK_F14,
     150        /* 0x6C */ 0, // n/a
     151        /* 0x6D */ VK_F10,
     152        /* 0x6E */ 0, // n/a (Windows95 key?)
     153        /* 0x6F */ VK_F12,
     154        /* 0x70 */ 0, // n/a
     155        /* 0x71 */ VK_F15,
     156        /* 0x72 */ VK_INSERT, // Help
     157        /* 0x73 */ VK_HOME, // Home
     158        /* 0x74 */ VK_PRIOR, // Page Up
     159        /* 0x75 */ VK_DELETE, // Forward Delete
     160        /* 0x76 */ VK_F4,
     161        /* 0x77 */ VK_END, // End
     162        /* 0x78 */ VK_F2,
     163        /* 0x79 */ VK_NEXT, // Page Down
     164        /* 0x7A */ VK_F1,
     165        /* 0x7B */ VK_LEFT, // Left Arrow
     166        /* 0x7C */ VK_RIGHT, // Right Arrow
     167        /* 0x7D */ VK_DOWN, // Down Arrow
     168        /* 0x7E */ VK_UP, // Up Arrow
     169    };
     170    if (keyCode < WTF_ARRAY_LENGTH(windowsKeyCode))
     171        return windowsKeyCode[keyCode];
     172    return 0;
     173}
     174
    39175void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode)
    40176{
  • trunk/Source/WebKit/ChangeLog

    r236411 r236417  
     12018-09-24  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Key code is 0 for many hardware keyboard keys
     4        https://bugs.webkit.org/show_bug.cgi?id=189604
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        For a hardware keyboard-generated event (an event with a non-nill event._hidEvent) pass
     9        the key code for the event. Otherwise, do what we do now and pass 0 as the event is likely
     10        a software keyboard-generated event.
     11
     12        * Platform/spi/ios/UIKitSPI.h: Add some more SPI.
     13        * UIProcess/ios/WKContentViewInteraction.mm:
     14        (-[WKContentView handleKeyEvent:]):
     15
    1162018-09-24  Brian Burg  <bburg@apple.com>
    217
  • trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h

    r235878 r236417  
    999999#endif // USE(APPLE_INTERNAL_SDK)
    10001000
     1001@interface UIPhysicalKeyboardEvent : UIPressesEvent
     1002@end
     1003
     1004@interface UIPhysicalKeyboardEvent ()
     1005@property (nonatomic, readonly) CFIndex _keyCode;
     1006@end
     1007
    10011008@interface UIColor (IPI)
    10021009+ (UIColor *)insertionPointColor;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r235955 r236417  
    37493749                                                         isRepeating:(event._inputFlags & kUIKeyboardInputRepeat)
    37503750                                                           withFlags:event._inputFlags
    3751                                                              keyCode:0
     3751                                                             keyCode:event._hidEvent ? ((UIPhysicalKeyboardEvent *)event)._keyCode : 0
    37523752                                                            isTabKey:[event._modifiedInput isEqualToString:@"\t"]
    37533753                                                        characterSet:WebEventCharacterSetUnicode] autorelease];
Note: See TracChangeset for help on using the changeset viewer.