OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return false; | 53 return false; |
54 return command.execute(evt); | 54 return command.execute(evt); |
55 } | 55 } |
56 | 56 |
57 if (command.execute(evt)) | 57 if (command.execute(evt)) |
58 return true; | 58 return true; |
59 | 59 |
60 if (!behavior().shouldInsertCharacter(*evt) || !canEdit()) | 60 if (!behavior().shouldInsertCharacter(*evt) || !canEdit()) |
61 return false; | 61 return false; |
62 | 62 |
63 // Return true to prevent default action. e.g. Space key scroll. | |
64 if (dispatchBeforeInputInsertText(evt->target(), keyEvent->text) != | |
65 DispatchEventResult::NotCanceled) | |
66 return true; | |
67 | |
68 return insertText(keyEvent->text, evt); | 63 return insertText(keyEvent->text, evt); |
69 } | 64 } |
70 | 65 |
71 void Editor::handleKeyboardEvent(KeyboardEvent* evt) { | 66 void Editor::handleKeyboardEvent(KeyboardEvent* evt) { |
72 // Give the embedder a chance to handle the keyboard event. | 67 // Give the embedder a chance to handle the keyboard event. |
73 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt)) | 68 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt)) |
74 evt->setDefaultHandled(); | 69 evt->setDefaultHandled(); |
75 } | 70 } |
76 | 71 |
77 } // namespace blink | 72 } // namespace blink |
OLD | NEW |