Changeset 240604 in webkit
- Timestamp:
- Jan 28, 2019 3:00:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r240579 r240604 1 2019-01-28 Daniel Bates <dabates@apple.com> 2 3 [iOS] Make Window virtual key code computation match Mac 4 https://bugs.webkit.org/show_bug.cgi?id=193452 5 6 Reviewed by Ryosuke Niwa. 7 8 Add a test that ensures we do not regress DOM key events dispatches for combinations 9 of Option and Command + Option key commands. 10 11 * fast/events/ios/key-events-meta-alt-combinations-expected.txt: Added. 12 * fast/events/ios/key-events-meta-alt-combinations.html: Added. 13 * fast/events/ios/resources/key-tester.js: Added. 14 (computeDifference): 15 (areArraysEqual): 16 (areKeyCommandsEqual): 17 (KeyCommand): 18 (KeyCommand.prototype.toString): 19 (keyCommandsHasCommand): 20 (computeSubsets.compareByModifierOrder): 21 (handleKeyUp): 22 (handleKeyPress): 23 (log): 24 (logKeyEvent): 25 (displayNameForTest): 26 (nextKeyPress): 27 (runTest): 28 (setUp): 29 1 30 2019-01-28 Antoine Quint <graouts@apple.com> 2 31 -
trunk/Source/WebCore/ChangeLog
r240596 r240604 1 2019-01-28 Daniel Bates <dabates@apple.com> 2 3 [iOS] Make Window virtual key code computation match Mac 4 https://bugs.webkit.org/show_bug.cgi?id=193452 5 6 Reviewed by Ryosuke Niwa. 7 8 Use the same approach for computing the Windows virtual key code on iOS as we do on Mac for 9 web compatibility. On Mac, we prefer to compute the Windows virtual key code from the input 10 strings of the key event and use the key event's keycode as a last resort. 11 12 Test: fast/events/ios/key-events-meta-alt-combinations.html 13 14 * platform/ios/PlatformEventFactoryIOS.h: 15 * platform/ios/PlatformEventFactoryIOS.mm: 16 (WebCore::isKeypadEvent): Added. 17 (WebCore::windowsKeyCodeForKeyEvent): Added. 18 (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Modified to call 19 WebCore::windowsKeyCodeForKeyEvent() to compute the Windows virtual key code. 20 1 21 2019-01-28 Antoine Quint <graouts@apple.com> 2 22 -
trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.h
r237266 r240604 54 54 WEBCORE_EXPORT String codeForKeyEvent(WebEvent *); 55 55 WEBCORE_EXPORT String keyIdentifierForKeyEvent(WebEvent *); 56 WEBCORE_EXPORT int windowsKeyCodeForKeyEvent(WebEvent*); 56 57 57 58 } // namespace WebCore -
trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
r239361 r240604 1 1 /* 2 * Copyright (C) 2004, 2006 , 2007, 2008, 2009, 2010, 2011, 2014Apple Inc. All rights reserved.2 * Copyright (C) 2004, 2006-2011, 2014, 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 421 421 } 422 422 423 static bool isKeypadEvent(WebEvent* event) 424 { 425 // Check that this is the type of event that has a keyCode. 426 if (event.type != WebEventKeyDown && event.type != WebEventKeyUp) 427 return false; 428 429 // With the exception of keypad comma, the following corresponds to the criterion for UIKeyModifierNumericPad. 430 // FIXME: Recognize keypad comma. 431 switch (event.keyCode) { 432 case VK_CLEAR: // Num Pad Clear 433 case VK_OEM_PLUS: // Num Pad = 434 case VK_DIVIDE: 435 case VK_MULTIPLY: 436 case VK_SUBTRACT: 437 case VK_ADD: 438 case VK_RETURN: // Num Pad Enter 439 case VK_DECIMAL: // Num Pad . 440 case VK_NUMPAD0: 441 case VK_NUMPAD1: 442 case VK_NUMPAD2: 443 case VK_NUMPAD3: 444 case VK_NUMPAD4: 445 case VK_NUMPAD5: 446 case VK_NUMPAD6: 447 case VK_NUMPAD7: 448 case VK_NUMPAD8: 449 case VK_NUMPAD9: 450 return true; 451 } 452 return false; 453 } 454 455 int windowsKeyCodeForKeyEvent(WebEvent* event) 456 { 457 if (event.keyboardFlags & WebEventKeyboardInputModifierFlagsChanged) 458 return event.keyCode; 459 460 // There are several kinds of characters for which we produce key code from char code: 461 // 1. Roman letters. Windows keyboard layouts affect both virtual key codes and character codes for these, 462 // so e.g. 'A' gets the same keyCode on QWERTY, AZERTY or Dvorak layouts. 463 // 2. Keys for which there is no known iOS virtual key codes, like PrintScreen. 464 // 3. Certain punctuation keys. On Windows, these are also remapped depending on current keyboard layout, 465 // but see comment in windowsKeyCodeForCharCode(). 466 if (!isKeypadEvent(event) && (event.type == WebEventKeyDown || event.type == WebEventKeyUp)) { 467 // Cmd switches Roman letters for Dvorak-QWERTY layout, so try modified characters first. 468 NSString *string = event.characters; 469 int code = string.length > 0 ? windowsKeyCodeForCharCode([string characterAtIndex:0]) : 0; 470 if (code) 471 return code; 472 473 // Ctrl+A on an AZERTY keyboard would get VK_Q keyCode if we relied on -[WebEvent keyCode] below. 474 string = event.charactersIgnoringModifiers; 475 code = string.length > 0 ? windowsKeyCodeForCharCode([string characterAtIndex:0]) : 0; 476 if (code) 477 return code; 478 } 479 480 // Use iOS virtual key code directly for any keys not handled above. 481 // E.g. the key next to Caps Lock has the same Event.keyCode on U.S. keyboard ('A') and on 482 // Russian keyboard (CYRILLIC LETTER EF). 483 return event.keyCode; 484 } 485 423 486 class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent { 424 487 public: … … 443 506 m_code = codeForKeyEvent(event); 444 507 m_keyIdentifier = keyIdentifierForKeyEvent(event); 445 m_windowsVirtualKeyCode = event.keyCode;508 m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event); 446 509 m_isKeypad = false; // iOS does not distinguish the numpad. See <rdar://problem/7190835>. 447 510 m_isSystemKey = false; -
trunk/Source/WebKit/ChangeLog
r240602 r240604 1 2019-01-28 Daniel Bates <dabates@apple.com> 2 3 [iOS] Make Window virtual key code computation match Mac 4 https://bugs.webkit.org/show_bug.cgi?id=193452 5 6 Reviewed by Ryosuke Niwa. 7 8 Compute the Windows virtual key code from the WebEvent. 9 10 * Shared/ios/WebIOSEventFactory.mm: 11 (WebIOSEventFactory::createWebKeyboardEvent): 12 1 13 2019-01-28 Brent Fulgham <bfulgham@apple.com> 2 14 -
trunk/Source/WebKit/Shared/ios/WebIOSEventFactory.mm
r237738 r240604 69 69 String code = WebCore::codeForKeyEvent(event); 70 70 String keyIdentifier = WebCore::keyIdentifierForKeyEvent(event); 71 int windowsVirtualKeyCode = event.keyCode;71 int windowsVirtualKeyCode = WebCore::windowsKeyCodeForKeyEvent(event); 72 72 // FIXME: This is not correct. WebEvent.keyCode represents the Windows native virtual key code. 73 73 int nativeVirtualKeyCode = event.keyCode;
Note: See TracChangeset
for help on using the changeset viewer.