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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Pass a WebKeyboardEvent into the EditorClient and get back the string | 46 // Pass a WebKeyboardEvent into the EditorClient and get back the string |
47 // name of which editing event that key causes. | 47 // name of which editing event that key causes. |
48 // E.g., sending in the enter key gives back "InsertNewline". | 48 // E.g., sending in the enter key gives back "InsertNewline". |
49 const char* interpretKeyEvent( | 49 const char* interpretKeyEvent( |
50 const WebKeyboardEvent& webKeyboardEvent, | 50 const WebKeyboardEvent& webKeyboardEvent, |
51 PlatformEvent::EventType keyType) | 51 PlatformEvent::EventType keyType) |
52 { | 52 { |
53 PlatformKeyboardEventBuilder evt(webKeyboardEvent); | 53 PlatformKeyboardEventBuilder evt(webKeyboardEvent); |
54 evt.setKeyType(keyType); | 54 evt.setKeyType(keyType); |
55 RawPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(evt, 0); | 55 KeyboardEvent* keyboardEvent = KeyboardEvent::create(evt, 0); |
56 OwnPtr<Settings> settings = Settings::create(); | 56 OwnPtr<Settings> settings = Settings::create(); |
57 EditingBehavior behavior(settings->editingBehaviorType()); | 57 EditingBehavior behavior(settings->editingBehaviorType()); |
58 return behavior.interpretKeyEvent(*keyboardEvent); | 58 return behavior.interpretKeyEvent(*keyboardEvent); |
59 } | 59 } |
60 | 60 |
61 // Set up a WebKeyboardEvent KEY_DOWN event with key code and modifiers. | 61 // Set up a WebKeyboardEvent KEY_DOWN event with key code and modifiers. |
62 void setupKeyDownEvent(WebKeyboardEvent* keyboardEvent, | 62 void setupKeyDownEvent(WebKeyboardEvent* keyboardEvent, |
63 char keyCode, | 63 char keyCode, |
64 int modifiers) | 64 int modifiers) |
65 { | 65 { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 | 202 |
203 TEST_F(KeyboardTest, TestInsertNewline4) | 203 TEST_F(KeyboardTest, TestInsertNewline4) |
204 { | 204 { |
205 int modifiers = WebInputEvent::AltKey | WebInputEvent::ShiftKey; | 205 int modifiers = WebInputEvent::AltKey | WebInputEvent::ShiftKey; |
206 const char* result = interpretNewLine(modifiers); | 206 const char* result = interpretNewLine(modifiers); |
207 EXPECT_STREQ("InsertNewline", result); | 207 EXPECT_STREQ("InsertNewline", result); |
208 } | 208 } |
209 | 209 |
210 } // namespace blink | 210 } // namespace blink |
OLD | NEW |