⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245161 in webkit


Ignore:
Timestamp:
May 9, 2019, 3:59:36 PM (7 years ago)
Author:
dbates@webkit.org
Message:

[iOS] Numpad comma key has incorrect keyIdentifier property
https://bugs.webkit.org/show_bug.cgi?id=197753
<rdar://problem/50636274>

Reviewed by Brent Fulgham.

Source/WebCore:

Map the Numpad Comma HID usage code to its Window virtual key code, VK_SEPARATOR,
so that can compute the keyIdentifier property for the Numpad Comma key. Also
consider this key as a keypad key just like we do on Mac. There is no discernable
difference for doing so on iOS because the non-keypad code path computes the same result
due to GraphicsServices having fixed up the input string for the Numpad Comma to be
",", which is want.

  • platform/ios/KeyEventIOS.mm:

(WebCore::windowsKeyCodeForKeyCode): Map kHIDUsage_KeypadComma to VK_SEPARATOR.

  • platform/ios/PlatformEventFactoryIOS.mm:

(WebCore::codeForKeyEvent): Add a comment to explain that this key is only on
JIS keyboards.
(WebCore::isKeypadEvent): Return true for the Numpad Comma key.

Source/WebCore/PAL:

Expose enumerator for Numpad Comma.

  • pal/spi/cocoa/IOKitSPI.h:

Tools:

Recognize "numpadComma" and return the appropriate HID usage code.

  • WebKitTestRunner/ios/HIDEventGenerator.mm:

(hidUsageCodeForCharacter):

LayoutTests:

Update test results.

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245158 r245161  
     12019-05-09  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Numpad comma key has incorrect keyIdentifier property
     4        https://bugs.webkit.org/show_bug.cgi?id=197753
     5        <rdar://problem/50636274>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Update test results.
     10
     11        * fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
     12        * fast/events/ios/keydown-keyup-special-keys-in-non-editable-element.html:
     13
    1142019-05-08  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt

    r241734 r245161  
    1 This tests that DOM keydown and keyup events are dispatched to a non-editable <body> on iOS when pressing special keys on a hardware keyboard. To run this test manually, verify that two messages are emitted when you press the following keys: Tab, ↑, ↓, ←, →, Delete, End, Enter, Escape, Home, left Alt, left ⌘ Command, left Ctrl, left ⇧ Shift, Page Down, Page Up, Return, right Alt, right ⌘ Command, right Ctrl, right ⇧ Shift, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16.
     1This tests that DOM keydown and keyup events are dispatched to a non-editable <body> on iOS when pressing special keys on a hardware keyboard. To run this test manually, verify that two messages are emitted when you press the following keys: Tab, ↑, ↓, ←, →, Delete, End, Enter, Escape, Home, left Alt, left ⌘ Command, left Ctrl, left ⇧ Shift, Page Down, Page Up, Return, right Alt, right ⌘ Command, right Ctrl, right ⇧ Shift, Numpad ,, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16.
    22
    33type: keydown, key: Tab, code: Tab, keyIdentifier: U+0009, keyCode: 9, charCode: 0, keyCode: 9, which: 9
     
    4545type: keydown, key: Shift, code: ShiftRight, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
    4646type: keyup, key: Shift, code: ShiftRight, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
     47type: keydown, key: ,, code: NumpadComma, keyIdentifier: U+002C, keyCode: 108, charCode: 0, keyCode: 108, which: 108
     48type: keyup, key: ,, code: NumpadComma, keyIdentifier: U+002C, keyCode: 108, charCode: 0, keyCode: 108, which: 108
    4749type: keydown, key: , code: F1, keyIdentifier: U+0010, keyCode: 112, charCode: 0, keyCode: 112, which: 112
    4850type: keyup, key: Dead, code: F1, keyIdentifier: Unidentified, keyCode: 112, charCode: 0, keyCode: 112, which: 112
  • trunk/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element.html

    r241734 r245161  
    1313</head>
    1414<body onkeydown="handleKeyDown(event)" onkeyup="handleKeyUp(event)">
    15 <p>This tests that DOM keydown and keyup events are dispatched to a non-editable &lt;body&gt; on iOS when pressing special keys on a hardware keyboard. To run this test manually, verify that two messages are emitted when you press the following keys: <kbd>Tab</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>, <kbd>←</kbd>, <kbd>→</kbd>, <kbd>Delete</kbd>, <kbd>End</kbd>, <kbd>Enter</kbd>, <kbd>Escape</kbd>, <kbd>Home</kbd><!-- FIXME: Add <kbd>Insert</kbd> once <rdar://problem/47128940> is fixed. -->, left <kbd>Alt</kbd>, left <kbd>⌘ Command</kbd>, left <kbd>Ctrl</kbd>, left <kbd>⇧ Shift</kbd>, <kbd>Page Down</kbd>, <kbd>Page Up</kbd>, <kbd>Return</kbd>, right <kbd>Alt</kbd>, right <kbd>⌘ Command</kbd>, right <kbd>Ctrl</kbd>, right <kbd>⇧ Shift</kbd>, <kbd>F1</kbd>, <kbd>F2</kbd>, <kbd>F3</kbd>, <kbd>F4</kbd>, <kbd>F5</kbd>, <kbd>F6</kbd>, <kbd>F7</kbd>, <kbd>F8</kbd>, <kbd>F9</kbd>, <kbd>F10</kbd>, <kbd>F11</kbd>, <kbd>F12</kbd>, <kbd>F13</kbd>, <kbd>F14</kbd>, <kbd>F15</kbd>, <kbd>F16</kbd><!-- FIXME: Add <kbd>F17</kbd>, <kbd>F18</kbd>, <kbd>F19</kbd>, <kbd>F20</kbd>, <kbd>F21</kbd>, <kbd>F22</kbd>, <kbd>F23</kbd>, <kbd>F24</kbd> once <rdar://problem/47128940> is fixed.-->.
     15<p>This tests that DOM keydown and keyup events are dispatched to a non-editable &lt;body&gt; on iOS when pressing special keys on a hardware keyboard. To run this test manually, verify that two messages are emitted when you press the following keys: <kbd>Tab</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>, <kbd>←</kbd>, <kbd>→</kbd>, <kbd>Delete</kbd>, <kbd>End</kbd>, <kbd>Enter</kbd>, <kbd>Escape</kbd>, <kbd>Home</kbd><!-- FIXME: Add <kbd>Insert</kbd> once <rdar://problem/47128940> is fixed. -->, left <kbd>Alt</kbd>, left <kbd>⌘ Command</kbd>, left <kbd>Ctrl</kbd>, left <kbd>⇧ Shift</kbd>, <kbd>Page Down</kbd>, <kbd>Page Up</kbd>, <kbd>Return</kbd>, right <kbd>Alt</kbd>, right <kbd>⌘ Command</kbd>, right <kbd>Ctrl</kbd>, right <kbd>⇧ Shift</kbd>, <kbd>Numpad ,</kbd>, </kbd><kbd>F1</kbd>, <kbd>F2</kbd>, <kbd>F3</kbd>, <kbd>F4</kbd>, <kbd>F5</kbd>, <kbd>F6</kbd>, <kbd>F7</kbd>, <kbd>F8</kbd>, <kbd>F9</kbd>, <kbd>F10</kbd>, <kbd>F11</kbd>, <kbd>F12</kbd>, <kbd>F13</kbd>, <kbd>F14</kbd>, <kbd>F15</kbd>, <kbd>F16</kbd><!-- FIXME: Add <kbd>F17</kbd>, <kbd>F18</kbd>, <kbd>F19</kbd>, <kbd>F20</kbd>, <kbd>F21</kbd>, <kbd>F22</kbd>, <kbd>F23</kbd>, <kbd>F24</kbd> once <rdar://problem/47128940> is fixed.-->.
    1616</p>
    1717<pre id="console"></pre>
     
    4040    "rightControl",
    4141    "rightShift",
     42    "numpadComma",
    4243];
    4344
  • trunk/Source/WebCore/ChangeLog

    r245158 r245161  
     12019-05-09  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Numpad comma key has incorrect keyIdentifier property
     4        https://bugs.webkit.org/show_bug.cgi?id=197753
     5        <rdar://problem/50636274>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Map the Numpad Comma HID usage code to its Window virtual key code, VK_SEPARATOR,
     10        so that can compute the keyIdentifier property for the Numpad Comma key. Also
     11        consider this key as a keypad key just like we do on Mac. There is no discernable
     12        difference for doing so on iOS because the non-keypad code path computes the same result
     13        due to GraphicsServices having fixed up the input string for the Numpad Comma to be
     14        ",", which is want.
     15
     16        * platform/ios/KeyEventIOS.mm:
     17        (WebCore::windowsKeyCodeForKeyCode): Map kHIDUsage_KeypadComma to VK_SEPARATOR.
     18        * platform/ios/PlatformEventFactoryIOS.mm:
     19        (WebCore::codeForKeyEvent): Add a comment to explain that this key is only on
     20        JIS keyboards.
     21        (WebCore::isKeypadEvent): Return true for the Numpad Comma key.
     22
    1232019-05-09  Zalan Bujtas  <zalan@apple.com>
    224
  • trunk/Source/WebCore/PAL/ChangeLog

    r245075 r245161  
     12019-05-09  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Numpad comma key has incorrect keyIdentifier property
     4        https://bugs.webkit.org/show_bug.cgi?id=197753
     5        <rdar://problem/50636274>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Expose enumerator for Numpad Comma.
     10
     11        * pal/spi/cocoa/IOKitSPI.h:
     12
    1132019-05-08  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/IOKitSPI.h

    r242325 r245161  
    198198    kHIDUsage_KeyboardF24 = 0x73,
    199199    kHIDUsage_KeyboardMenu = 0x76,
     200    kHIDUsage_KeypadComma = 0x85,
    200201    kHIDUsage_KeyboardLeftControl = 0xE0,
    201202    kHIDUsage_KeyboardLeftShift = 0xE1,
  • trunk/Source/WebCore/platform/ios/KeyEventIOS.mm

    r242915 r245161  
    173173        /* 0x81 */ VK_VOLUME_DOWN, // Volume Down
    174174    };
    175     // Check if key is a modifier.
     175    // Check if key is a modifier or the keypad comma (on JIS keyboard).
    176176    switch (keyCode) {
     177    case kHIDUsage_KeypadComma:
     178        return VK_SEPARATOR;
    177179    case kHIDUsage_KeyboardLeftControl:
    178180        return VK_LCONTROL;
  • trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm

    r241282 r245161  
    323323    // NumpadClear.
    324324    // NumpadClearEntry.
    325     case VK_SEPARATOR: return "NumpadComma"_s;
     325    case VK_SEPARATOR: return "NumpadComma"_s; // On JIS keyboard
    326326    case VK_DECIMAL: return "NumpadDecimal"_s;
    327327    case VK_DIVIDE: return "NumpadDivide"_s;
     
    428428        return false;
    429429
    430     // With the exception of keypad comma, the following corresponds to the criterion for UIKeyModifierNumericPad.
    431     // FIXME: Recognize keypad comma.
    432430    switch (event.keyCode) {
    433431    case VK_CLEAR: // Num Pad Clear
     
    439437    case VK_RETURN: // Num Pad Enter
    440438    case VK_DECIMAL: // Num Pad .
     439    case VK_SEPARATOR: // Num Pad , (on JIS keyboard)
    441440    case VK_NUMPAD0:
    442441    case VK_NUMPAD1:
  • trunk/Tools/ChangeLog

    r245156 r245161  
     12019-05-09  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Numpad comma key has incorrect keyIdentifier property
     4        https://bugs.webkit.org/show_bug.cgi?id=197753
     5        <rdar://problem/50636274>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Recognize "numpadComma" and return the appropriate HID usage code.
     10
     11        * WebKitTestRunner/ios/HIDEventGenerator.mm:
     12        (hidUsageCodeForCharacter):
     13
    1142019-05-09  Eric Carlson  <eric.carlson@apple.com>
    215
  • trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm

    r244955 r245161  
    974974    if ([key isEqualToString:@"rightAlt"])
    975975        return kHIDUsage_KeyboardRightAlt;
     976    if ([key isEqualToString:@"numpadComma"])
     977        return kHIDUsage_KeypadComma;
    976978
    977979    return 0;
Note: See TracChangeset for help on using the changeset viewer.