Changeset 118001 in webkit
- Timestamp:
- May 22, 2012 10:45:13 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r118000 r118001 1 2012-05-22 Takashi Sakamoto <tasak@google.com> 2 3 Implement DOM_KEY_LOCATION_LEFT and RIGHT of KeyboardEvent's location property 4 https://bugs.webkit.org/show_bug.cgi?id=86694 5 6 Reviewed by Alexey Proskuryakov. 7 8 * fast/events/keydown-leftright-keys-expected.txt: Added. 9 * fast/events/keydown-leftright-keys.html: Added. 10 1 11 2012-05-22 Christophe Dumez <christophe.dumez@intel.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r117999 r118001 1 2012-05-22 Takashi Sakamoto <tasak@google.com> 2 3 Implement DOM_KEY_LOCATION_LEFT and RIGHT of KeyboardEvent's location property 4 https://bugs.webkit.org/show_bug.cgi?id=86694 5 6 As KeyboardEvent for left/right location key, e.g. left-control, 7 right-control, provides DOM_KEY_LOCATION_STANDARD as keyLocation property, 8 modified KeyCodeConversion to make PlatformKeyboardEvent 9 provide virtual keycodes with location information, e.g. VK_LCONTROL or 10 VK_RCONTROL, and modified KeyboardEvent to generate location information 11 from the virtual keycodes, e.g. genrating DOM_KEY_LOCATION_LEFT for 12 VK_LCONTROL. KeyboardEvent also removes location information from 13 the virtual keycodes, e.g. genrating VK_CONTROL for VK_LCONTROL. 14 The location property is defined in the W3C DOM3 specification: 15 http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents 16 17 Reviewed by Alexey Proskuryakov. 18 19 Test: fast/events/keydown-leftright-keys.html 20 21 * dom/KeyboardEvent.cpp: 22 (WebCore::windowsVirtualKeyCodeWithoutLocation): 23 Added a function which removes location information from a given 24 keycode. For example, when VK_LCONTROL is given, returns VK_CONTROL. 25 (WebCore::keyLocationCode): 26 Added a function which provides location information from a given 27 keycode. For example, when VK_LCONTROL is given, 28 returns DOM_KEY_LOCATION_LEFT. 29 (WebCore::KeyboardEvent::KeyboardEvent): 30 Initialized m_keyLocation by using the above keyLocationCode. 31 (WebCore::KeyboardEvent::keyCode): 32 Modified to use the above two functions to initialize keycode property 33 and keylocation property. 34 * platform/chromium/KeyCodeConversionAndroid.cpp: 35 (WebCore::windowsKeyCodeForKeyEvent): 36 * platform/chromium/KeyCodeConversionGtk.cpp: 37 (WebCore::windowsKeyCodeForKeyEvent): 38 * platform/cocoa/KeyEventCocoa.mm: 39 (WebCore::windowsKeyCodeForKeyCode): 40 Modified these keycode conversions to return keycodes with location 41 information, e.g. modified keycode conversions returns VK_LCONTROL 42 for left control. 43 1 44 2012-05-22 Pavel Feldman <pfeldman@chromium.org> 2 45 -
trunk/Source/WebCore/dom/KeyboardEvent.cpp
r103112 r118001 32 32 #include "PlatformKeyboardEvent.h" 33 33 #include "Settings.h" 34 #include "WindowsKeyboardCodes.h" 34 35 35 36 namespace WebCore { … … 54 55 } 55 56 57 static inline int windowsVirtualKeyCodeWithoutLocation(int keycode) 58 { 59 switch (keycode) { 60 case VK_LCONTROL: 61 case VK_RCONTROL: 62 return VK_CONTROL; 63 case VK_LSHIFT: 64 case VK_RSHIFT: 65 return VK_SHIFT; 66 case VK_LMENU: 67 case VK_RMENU: 68 return VK_MENU; 69 default: 70 return keycode; 71 } 72 } 73 74 static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeyboardEvent& key) 75 { 76 if (key.isKeypad()) 77 return KeyboardEvent::DOM_KEY_LOCATION_NUMPAD; 78 79 switch (key.windowsVirtualKeyCode()) { 80 case VK_LCONTROL: 81 case VK_LSHIFT: 82 case VK_LMENU: 83 case VK_LWIN: 84 return KeyboardEvent::DOM_KEY_LOCATION_LEFT; 85 case VK_RCONTROL: 86 case VK_RSHIFT: 87 case VK_RMENU: 88 case VK_RWIN: 89 return KeyboardEvent::DOM_KEY_LOCATION_RIGHT; 90 default: 91 return KeyboardEvent::DOM_KEY_LOCATION_STANDARD; 92 } 93 } 94 56 95 KeyboardEvent::KeyboardEvent() 57 96 : m_keyLocation(DOM_KEY_LOCATION_STANDARD) … … 65 104 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) 66 105 , m_keyIdentifier(key.keyIdentifier()) 67 , m_keyLocation(key .isKeypad() ? DOM_KEY_LOCATION_NUMPAD : DOM_KEY_LOCATION_STANDARD) // FIXME: differentiate right/left, too106 , m_keyLocation(keyLocationCode(key)) 68 107 , m_altGraphKey(false) 69 108 { … … 123 162 return 0; 124 163 if (type() == eventNames().keydownEvent || type() == eventNames().keyupEvent) 125 return m_keyEvent->windowsVirtualKeyCode(); 164 return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKeyCode()); 165 126 166 return charCode(); 127 167 } -
trunk/Source/WebCore/platform/chromium/KeyCodeConversionAndroid.cpp
r117022 r118001 97 97 return VKEY_RETURN; 98 98 case AKEYCODE_SHIFT_LEFT: 99 return VKEY_LSHIFT; 99 100 case AKEYCODE_SHIFT_RIGHT: 100 return VKEY_ SHIFT;101 return VKEY_RSHIFT; 101 102 // Back will serve as escape, although we may not have access to it. 102 103 case AKEYCODE_BACK: … … 228 229 return VKEY_END; 229 230 case AKEYCODE_ALT_LEFT: 231 return VKEY_LMENU; 230 232 case AKEYCODE_ALT_RIGHT: 231 return VKEY_ MENU;233 return VKEY_RMENU; 232 234 case AKEYCODE_GRAVE: 233 235 return VKEY_OEM_3; … … 245 247 return VKEY_DELETE; 246 248 case AKEYCODE_CTRL_LEFT: 249 return VKEY_LCONTROL; 247 250 case AKEYCODE_CTRL_RIGHT: 248 return VKEY_ CONTROL;251 return VKEY_RCONTROL; 249 252 case AKEYCODE_CAPS_LOCK: 250 253 return VKEY_CAPITAL; -
trunk/Source/WebCore/platform/chromium/KeyCodeConversionGtk.cpp
r95901 r118001 103 103 return VKEY_RETURN; //(0D) Return key 104 104 case GDK_Shift_L: 105 return VKEY_LSHIFT; // (A0) Left SHIFT key 105 106 case GDK_Shift_R: 106 return VKEY_ SHIFT; // (10)SHIFT key107 return VKEY_RSHIFT; // (A1) Right SHIFT key 107 108 case GDK_Control_L: 109 return VKEY_LCONTROL; // (A2) Left CTRL key 108 110 case GDK_Control_R: 109 return VKEY_ CONTROL; // (11)CTRL key111 return VKEY_RCONTROL; // (A3) Right CTRL key 110 112 case GDK_Menu: 111 113 return VKEY_APPS; // (5D) Applications key (Natural keyboard) 112 114 case GDK_Alt_L: 115 return VKEY_LMENU; // (A4) Left ALT key 113 116 case GDK_Alt_R: 114 return VKEY_ MENU; // (12)ALT key117 return VKEY_RMENU; // (A5) Right ALT key 115 118 116 119 case GDK_Pause: -
trunk/Source/WebCore/platform/cocoa/KeyEventCocoa.mm
r101867 r118001 389 389 /* 0x36 */ VK_APPS, // Right Command 390 390 /* 0x37 */ VK_LWIN, // Left Command 391 /* 0x38 */ VK_ SHIFT, // Left Shift391 /* 0x38 */ VK_LSHIFT, // Left Shift 392 392 /* 0x39 */ VK_CAPITAL, // Caps Lock 393 /* 0x3A */ VK_ MENU, // Left Option394 /* 0x3B */ VK_ CONTROL, // Left Ctrl395 /* 0x3C */ VK_ SHIFT, // Right Shift396 /* 0x3D */ VK_ MENU, // Right Option397 /* 0x3E */ VK_ CONTROL, // Right Ctrl393 /* 0x3A */ VK_LMENU, // Left Option 394 /* 0x3B */ VK_LCONTROL, // Left Ctrl 395 /* 0x3C */ VK_RSHIFT, // Right Shift 396 /* 0x3D */ VK_RMENU, // Right Option 397 /* 0x3E */ VK_RCONTROL, // Right Ctrl 398 398 /* 0x3F */ 0, // fn 399 399 /* 0x40 */ VK_F17, -
trunk/Tools/ChangeLog
r118000 r118001 1 2012-05-22 Takashi Sakamoto <tasak@google.com> 2 3 Implement DOM_KEY_LOCATION_LEFT and RIGHT of KeyboardEvent's location property 4 https://bugs.webkit.org/show_bug.cgi?id=86694 5 6 Modify keyDown to create left- and right- control, shift, and alt 7 keyevent for a test to check that keyLocation property can have 8 DOM_KEY_LOCATION_LEFT for left-control, shift, and alt, and 9 DOM_KEY_LOCATION_RIGHT for right-control, shift, and alt. 10 11 Reviewed by Alexey Proskuryakov. 12 13 * DumpRenderTree/chromium/EventSender.cpp: 14 (EventSender::keyDown): 15 * DumpRenderTree/mac/EventSendingController.mm: 16 (-[EventSendingController keyDown:withModifiers:withLocation:]): 17 1 18 2012-05-22 Christophe Dumez <christophe.dumez@intel.com> 2 19 -
trunk/Tools/DumpRenderTree/chromium/EventSender.cpp
r116671 r118001 558 558 // FIXME: Change this to webkit_support::VKEY_APPS. 559 559 code = 0x5D; 560 else if ("leftControl" == codeStr) 561 // FIXME: Change this to webkit_support::VKEY_LCONTROL. 562 code = 0xA2; 563 else if ("rightControl" == codeStr) 564 // FIXME: Change this to webkit_support::VKEY_RCONTROL. 565 code = 0xA3; 566 else if ("leftShift" == codeStr) 567 // FIXME: Change this to webkit_support::VKEY_LSHIFT. 568 code = 0xA0; 569 else if ("rightShift" == codeStr) 570 // FIXME: Change this to webkit_support::VKEY_RSHIFT. 571 code = 0xA1; 572 else if ("leftAlt" == codeStr) 573 // FIXME: Change this to webkit_support::VKEY_LMENU. 574 code = 0xA4; 575 else if ("rightAlt" == codeStr) 576 // FIXME: Change this to webkit_support::VKEY_RMENU. 577 code = 0xA5; 560 578 else { 561 579 // Compare the input string with the function-key names defined by the -
trunk/Tools/DumpRenderTree/mac/EventSendingController.mm
r107008 r118001 622 622 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 623 623 keyCode = 0x3; // Shares key with "F" on Russian layout. 624 } else if ([character isEqualToString:@"leftControl"]) { 625 const unichar ch = 0xFFE3; 626 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 627 keyCode = 0x3B; 628 } else if ([character isEqualToString:@"leftShift"]) { 629 const unichar ch = 0xFFE1; 630 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 631 keyCode = 0x38; 632 } else if ([character isEqualToString:@"leftAlt"]) { 633 const unichar ch = 0xFFE7; 634 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 635 keyCode = 0x3A; 636 } else if ([character isEqualToString:@"rightControl"]) { 637 const unichar ch = 0xFFE4; 638 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 639 keyCode = 0x3E; 640 } else if ([character isEqualToString:@"rightShift"]) { 641 const unichar ch = 0xFFE2; 642 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 643 keyCode = 0x3C; 644 } else if ([character isEqualToString:@"rightAlt"]) { 645 const unichar ch = 0xFFE8; 646 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 647 keyCode = 0x3D; 624 648 } 625 649
Note: See TracChangeset
for help on using the changeset viewer.