| 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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 bool Editor::InsertText(const String& text, KeyboardEvent* triggering_event) { | 1064 bool Editor::InsertText(const String& text, KeyboardEvent* triggering_event) { |
| 1065 return GetFrame().GetEventHandler().HandleTextInputEvent(text, | 1065 return GetFrame().GetEventHandler().HandleTextInputEvent(text, |
| 1066 triggering_event); | 1066 triggering_event); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 bool Editor::InsertTextWithoutSendingTextEvent( | 1069 bool Editor::InsertTextWithoutSendingTextEvent( |
| 1070 const String& text, | 1070 const String& text, |
| 1071 bool select_inserted_text, | 1071 bool select_inserted_text, |
| 1072 TextEvent* triggering_event, | 1072 TextEvent* triggering_event, |
| 1073 InputEvent::InputType input_type) { | 1073 InputEvent::InputType input_type) { |
| 1074 if (text.IsEmpty()) | |
| 1075 return false; | |
| 1076 | |
| 1077 const VisibleSelection& selection = SelectionForCommand(triggering_event); | 1074 const VisibleSelection& selection = SelectionForCommand(triggering_event); |
| 1078 if (!selection.IsContentEditable()) | 1075 if (!selection.IsContentEditable()) |
| 1079 return false; | 1076 return false; |
| 1080 | 1077 |
| 1081 GetSpellChecker().UpdateMarkersForWordsAffectedByEditing( | 1078 GetSpellChecker().UpdateMarkersForWordsAffectedByEditing( |
| 1082 IsSpaceOrNewline(text[0])); | 1079 !text.IsEmpty() && IsSpaceOrNewline(text[0])); |
| 1083 | 1080 |
| 1084 // Insert the text | 1081 // Insert the text |
| 1085 TypingCommand::InsertText( | 1082 TypingCommand::InsertText( |
| 1086 *selection.Start().GetDocument(), text, selection.AsSelection(), | 1083 *selection.Start().GetDocument(), text, selection.AsSelection(), |
| 1087 select_inserted_text ? TypingCommand::kSelectInsertedText : 0, | 1084 select_inserted_text ? TypingCommand::kSelectInsertedText : 0, |
| 1088 triggering_event && triggering_event->IsComposition() | 1085 triggering_event && triggering_event->IsComposition() |
| 1089 ? TypingCommand::kTextCompositionConfirm | 1086 ? TypingCommand::kTextCompositionConfirm |
| 1090 : TypingCommand::kTextCompositionNone, | 1087 : TypingCommand::kTextCompositionNone, |
| 1091 false, input_type); | 1088 false, input_type); |
| 1092 | 1089 |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 | 1834 |
| 1838 DEFINE_TRACE(Editor) { | 1835 DEFINE_TRACE(Editor) { |
| 1839 visitor->Trace(frame_); | 1836 visitor->Trace(frame_); |
| 1840 visitor->Trace(last_edit_command_); | 1837 visitor->Trace(last_edit_command_); |
| 1841 visitor->Trace(undo_stack_); | 1838 visitor->Trace(undo_stack_); |
| 1842 visitor->Trace(mark_); | 1839 visitor->Trace(mark_); |
| 1843 visitor->Trace(typing_style_); | 1840 visitor->Trace(typing_style_); |
| 1844 } | 1841 } |
| 1845 | 1842 |
| 1846 } // namespace blink | 1843 } // namespace blink |
| OLD | NEW |