| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 m_shouldStyleWithCSS = false; | 1021 m_shouldStyleWithCSS = false; |
| 1022 m_defaultParagraphSeparator = EditorParagraphSeparatorIsDiv; | 1022 m_defaultParagraphSeparator = EditorParagraphSeparatorIsDiv; |
| 1023 m_lastEditCommand = nullptr; | 1023 m_lastEditCommand = nullptr; |
| 1024 m_undoStack->clear(); | 1024 m_undoStack->clear(); |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 bool Editor::insertText(const String& text, KeyboardEvent* triggeringEvent) { | 1027 bool Editor::insertText(const String& text, KeyboardEvent* triggeringEvent) { |
| 1028 return frame().eventHandler().handleTextInputEvent(text, triggeringEvent); | 1028 return frame().eventHandler().handleTextInputEvent(text, triggeringEvent); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 bool Editor::insertTextWithoutSendingTextEvent(const String& text, | 1031 bool Editor::insertTextWithoutSendingTextEvent( |
| 1032 bool selectInsertedText, | 1032 const String& text, |
| 1033 TextEvent* triggeringEvent) { | 1033 bool selectInsertedText, |
| 1034 TextEvent* triggeringEvent, |
| 1035 InputEvent::InputType inputType) { |
| 1034 if (text.isEmpty()) | 1036 if (text.isEmpty()) |
| 1035 return false; | 1037 return false; |
| 1036 | 1038 |
| 1037 const VisibleSelection& selection = selectionForCommand(triggeringEvent); | 1039 const VisibleSelection& selection = selectionForCommand(triggeringEvent); |
| 1038 if (!selection.isContentEditable()) | 1040 if (!selection.isContentEditable()) |
| 1039 return false; | 1041 return false; |
| 1040 | 1042 |
| 1041 spellChecker().updateMarkersForWordsAffectedByEditing( | 1043 spellChecker().updateMarkersForWordsAffectedByEditing( |
| 1042 isSpaceOrNewline(text[0])); | 1044 isSpaceOrNewline(text[0])); |
| 1043 | 1045 |
| 1044 // Insert the text | 1046 // Insert the text |
| 1045 TypingCommand::insertText( | 1047 TypingCommand::insertText( |
| 1046 *selection.start().document(), text, selection.asSelection(), | 1048 *selection.start().document(), text, selection.asSelection(), |
| 1047 selectInsertedText ? TypingCommand::SelectInsertedText : 0, | 1049 selectInsertedText ? TypingCommand::SelectInsertedText : 0, |
| 1048 triggeringEvent && triggeringEvent->isComposition() | 1050 triggeringEvent && triggeringEvent->isComposition() |
| 1049 ? TypingCommand::TextCompositionConfirm | 1051 ? TypingCommand::TextCompositionConfirm |
| 1050 : TypingCommand::TextCompositionNone); | 1052 : TypingCommand::TextCompositionNone, |
| 1053 false, inputType); |
| 1051 | 1054 |
| 1052 // Reveal the current selection | 1055 // Reveal the current selection |
| 1053 if (LocalFrame* editedFrame = selection.start().document()->frame()) { | 1056 if (LocalFrame* editedFrame = selection.start().document()->frame()) { |
| 1054 if (Page* page = editedFrame->page()) { | 1057 if (Page* page = editedFrame->page()) { |
| 1055 LocalFrame* focusedOrMainFrame = | 1058 LocalFrame* focusedOrMainFrame = |
| 1056 toLocalFrame(page->focusController().focusedOrMainFrame()); | 1059 toLocalFrame(page->focusController().focusedOrMainFrame()); |
| 1057 focusedOrMainFrame->selection().revealSelection( | 1060 focusedOrMainFrame->selection().revealSelection( |
| 1058 ScrollAlignment::alignCenterIfNeeded); | 1061 ScrollAlignment::alignCenterIfNeeded); |
| 1059 } | 1062 } |
| 1060 } | 1063 } |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 | 1779 |
| 1777 DEFINE_TRACE(Editor) { | 1780 DEFINE_TRACE(Editor) { |
| 1778 visitor->trace(m_frame); | 1781 visitor->trace(m_frame); |
| 1779 visitor->trace(m_lastEditCommand); | 1782 visitor->trace(m_lastEditCommand); |
| 1780 visitor->trace(m_undoStack); | 1783 visitor->trace(m_undoStack); |
| 1781 visitor->trace(m_mark); | 1784 visitor->trace(m_mark); |
| 1782 visitor->trace(m_typingStyle); | 1785 visitor->trace(m_typingStyle); |
| 1783 } | 1786 } |
| 1784 | 1787 |
| 1785 } // namespace blink | 1788 } // namespace blink |
| OLD | NEW |