| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #pragma warning(push, 0) | 7 #pragma warning(push, 0) |
| 8 #include "EventNames.h" | 8 #include "EventNames.h" |
| 9 #include "EventTarget.h" | 9 #include "EventTarget.h" |
| 10 #include "KeyboardEvent.h" | 10 #include "KeyboardEvent.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 MakePlatformKeyboardEvent evt(keyboard_event); | 27 MakePlatformKeyboardEvent evt(keyboard_event); |
| 28 evt.SetKeyType(key_type); | 28 evt.SetKeyType(key_type); |
| 29 RefPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(evt, NULL); | 29 RefPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(evt, NULL); |
| 30 return editor_impl.interpretKeyEvent(keyboardEvent.get()); | 30 return editor_impl.interpretKeyEvent(keyboardEvent.get()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 static inline void SetupKeyDownEvent(WebKeyboardEvent& keyboard_event, | 33 static inline void SetupKeyDownEvent(WebKeyboardEvent& keyboard_event, |
| 34 char key_code, | 34 char key_code, |
| 35 int modifiers) { | 35 int modifiers) { |
| 36 keyboard_event.key_code = key_code; | 36 keyboard_event.key_code = key_code; |
| 37 keyboard_event.key_data = key_code; | |
| 38 keyboard_event.modifiers = modifiers; | 37 keyboard_event.modifiers = modifiers; |
| 39 keyboard_event.type = WebInputEvent::KEY_DOWN; | 38 keyboard_event.type = WebInputEvent::KEY_DOWN; |
| 40 } | 39 } |
| 41 | 40 |
| 42 static inline const char* InterpretCtrlKeyPress(char key_code) { | 41 static inline const char* InterpretCtrlKeyPress(char key_code) { |
| 43 WebKeyboardEvent keyboard_event; | 42 WebKeyboardEvent keyboard_event; |
| 44 SetupKeyDownEvent(keyboard_event, key_code, WebInputEvent::CTRL_KEY); | 43 SetupKeyDownEvent(keyboard_event, key_code, WebInputEvent::CTRL_KEY); |
| 45 | 44 |
| 46 return InterpretKeyEvent(keyboard_event, PlatformKeyboardEvent::RawKeyDown); | 45 return InterpretKeyEvent(keyboard_event, PlatformKeyboardEvent::RawKeyDown); |
| 47 } | 46 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 121 |
| 123 TEST(KeyboardUnitTestKeyPress, TestInsertNewline3) { | 122 TEST(KeyboardUnitTestKeyPress, TestInsertNewline3) { |
| 124 EXPECT_STREQ("InsertNewline", InterpretNewLine(WebInputEvent::ALT_KEY)); | 123 EXPECT_STREQ("InsertNewline", InterpretNewLine(WebInputEvent::ALT_KEY)); |
| 125 } | 124 } |
| 126 | 125 |
| 127 TEST(KeyboardUnitTestKeyPress, TestInsertNewline4) { | 126 TEST(KeyboardUnitTestKeyPress, TestInsertNewline4) { |
| 128 int modifiers = WebInputEvent::ALT_KEY | WebInputEvent::SHIFT_KEY; | 127 int modifiers = WebInputEvent::ALT_KEY | WebInputEvent::SHIFT_KEY; |
| 129 const char* result = InterpretNewLine(modifiers); | 128 const char* result = InterpretNewLine(modifiers); |
| 130 EXPECT_STREQ(result, "InsertNewline"); | 129 EXPECT_STREQ(result, "InsertNewline"); |
| 131 } | 130 } |
| OLD | NEW |