| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 if (!focusedElement->containsIncludingHostElements( | 68 if (!focusedElement->containsIncludingHostElements( |
| 69 *m_frame->selection().start().computeContainerNode())) { | 69 *m_frame->selection().start().computeContainerNode())) { |
| 70 // We should not insert text at selection start if selection doesn't have | 70 // We should not insert text at selection start if selection doesn't have |
| 71 // focus. See http://crbug.com/89026 | 71 // focus. See http://crbug.com/89026 |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Return true to prevent default action. e.g. Space key scroll. | 75 // Return true to prevent default action. e.g. Space key scroll. |
| 76 if (dispatchBeforeInputInsertText(evt->target(), keyEvent->text) != | 76 if (dispatchBeforeInputInsertText(evt->target()->toNode(), keyEvent->text) != |
| 77 DispatchEventResult::NotCanceled) | 77 DispatchEventResult::NotCanceled) |
| 78 return true; | 78 return true; |
| 79 | 79 |
| 80 return insertText(keyEvent->text, evt); | 80 return insertText(keyEvent->text, evt); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void Editor::handleKeyboardEvent(KeyboardEvent* evt) { | 83 void Editor::handleKeyboardEvent(KeyboardEvent* evt) { |
| 84 // Give the embedder a chance to handle the keyboard event. | 84 // Give the embedder a chance to handle the keyboard event. |
| 85 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt)) | 85 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt)) |
| 86 evt->setDefaultHandled(); | 86 evt->setDefaultHandled(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |