| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // Set up a WebKeyboardEvent KEY_DOWN event with key code and modifiers. | 62 // Set up a WebKeyboardEvent KEY_DOWN event with key code and modifiers. |
| 63 void setupKeyDownEvent(WebKeyboardEvent* keyboardEvent, | 63 void setupKeyDownEvent(WebKeyboardEvent* keyboardEvent, |
| 64 char keyCode, | 64 char keyCode, |
| 65 int modifiers) | 65 int modifiers) |
| 66 { | 66 { |
| 67 keyboardEvent->windowsKeyCode = keyCode; | 67 keyboardEvent->windowsKeyCode = keyCode; |
| 68 keyboardEvent->modifiers = modifiers; | 68 keyboardEvent->modifiers = modifiers; |
| 69 keyboardEvent->type = WebInputEvent::KeyDown; | 69 keyboardEvent->type = WebInputEvent::KeyDown; |
| 70 keyboardEvent->text[0] = keyCode; | 70 keyboardEvent->text[0] = keyCode; |
| 71 keyboardEvent->setKeyIdentifierFromWindowsKeyCode(); | |
| 72 } | 71 } |
| 73 | 72 |
| 74 // Like interpretKeyEvent, but with pressing down OSModifier+|keyCode|. | 73 // Like interpretKeyEvent, but with pressing down OSModifier+|keyCode|. |
| 75 // OSModifier is the platform's standard modifier key: control on most | 74 // OSModifier is the platform's standard modifier key: control on most |
| 76 // platforms, but meta (command) on Mac. | 75 // platforms, but meta (command) on Mac. |
| 77 const char* interpretOSModifierKeyPress(char keyCode) | 76 const char* interpretOSModifierKeyPress(char keyCode) |
| 78 { | 77 { |
| 79 WebKeyboardEvent keyboardEvent; | 78 WebKeyboardEvent keyboardEvent; |
| 80 #if OS(MACOSX) | 79 #if OS(MACOSX) |
| 81 WebInputEvent::Modifiers osModifier = WebInputEvent::MetaKey; | 80 WebInputEvent::Modifiers osModifier = WebInputEvent::MetaKey; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 { | 184 { |
| 186 EXPECT_STREQ("InsertNewline", interpretNewLine(noModifiers)); | 185 EXPECT_STREQ("InsertNewline", interpretNewLine(noModifiers)); |
| 187 } | 186 } |
| 188 | 187 |
| 189 TEST_F(KeyboardTest, TestInsertLineBreak) | 188 TEST_F(KeyboardTest, TestInsertLineBreak) |
| 190 { | 189 { |
| 191 EXPECT_STREQ("InsertLineBreak", interpretNewLine(WebInputEvent::ShiftKey)); | 190 EXPECT_STREQ("InsertLineBreak", interpretNewLine(WebInputEvent::ShiftKey)); |
| 192 } | 191 } |
| 193 | 192 |
| 194 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |