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 40 matching lines...) Loading... |
51 | 51 |
52 // Pass a WebKeyboardEvent into the EditorClient and get back the string | 52 // Pass a WebKeyboardEvent into the EditorClient and get back the string |
53 // name of which editing event that key causes. | 53 // name of which editing event that key causes. |
54 // E.g., sending in the enter key gives back "InsertNewline". | 54 // E.g., sending in the enter key gives back "InsertNewline". |
55 const char* interpretKeyEvent( | 55 const char* interpretKeyEvent( |
56 const WebKeyboardEvent& webKeyboardEvent, | 56 const WebKeyboardEvent& webKeyboardEvent, |
57 PlatformEvent::Type keyType) | 57 PlatformEvent::Type keyType) |
58 { | 58 { |
59 PlatformKeyboardEventBuilder evt(webKeyboardEvent); | 59 PlatformKeyboardEventBuilder evt(webKeyboardEvent); |
60 evt.setKeyType(keyType); | 60 evt.setKeyType(keyType); |
61 RefPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(evt, 0); | 61 RefPtrWillBeRawPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(
evt, 0); |
62 OwnPtr<Settings> settings = Settings::create(); | 62 OwnPtr<Settings> settings = Settings::create(); |
63 EditingBehavior behavior(settings->editingBehaviorType()); | 63 EditingBehavior behavior(settings->editingBehaviorType()); |
64 return behavior.interpretKeyEvent(*keyboardEvent); | 64 return behavior.interpretKeyEvent(*keyboardEvent); |
65 } | 65 } |
66 | 66 |
67 // Set up a WebKeyboardEvent KEY_DOWN event with key code and modifiers. | 67 // Set up a WebKeyboardEvent KEY_DOWN event with key code and modifiers. |
68 void setupKeyDownEvent(WebKeyboardEvent* keyboardEvent, | 68 void setupKeyDownEvent(WebKeyboardEvent* keyboardEvent, |
69 char keyCode, | 69 char keyCode, |
70 int modifiers) | 70 int modifiers) |
71 { | 71 { |
(...skipping 135 matching lines...) Loading... |
207 } | 207 } |
208 | 208 |
209 TEST_F(KeyboardTest, TestInsertNewline4) | 209 TEST_F(KeyboardTest, TestInsertNewline4) |
210 { | 210 { |
211 int modifiers = WebInputEvent::AltKey | WebInputEvent::ShiftKey; | 211 int modifiers = WebInputEvent::AltKey | WebInputEvent::ShiftKey; |
212 const char* result = interpretNewLine(modifiers); | 212 const char* result = interpretNewLine(modifiers); |
213 EXPECT_STREQ("InsertNewline", result); | 213 EXPECT_STREQ("InsertNewline", result); |
214 } | 214 } |
215 | 215 |
216 } // empty namespace | 216 } // empty namespace |
OLD | NEW |