Chromium Code Reviews| 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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 bool Editor::InsertText(const String& text, KeyboardEvent* triggering_event) { | 1048 bool Editor::InsertText(const String& text, KeyboardEvent* triggering_event) { |
| 1049 return GetFrame().GetEventHandler().HandleTextInputEvent(text, | 1049 return GetFrame().GetEventHandler().HandleTextInputEvent(text, |
| 1050 triggering_event); | 1050 triggering_event); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 bool Editor::InsertTextWithoutSendingTextEvent( | 1053 bool Editor::InsertTextWithoutSendingTextEvent( |
| 1054 const String& text, | 1054 const String& text, |
| 1055 bool select_inserted_text, | 1055 bool select_inserted_text, |
| 1056 TextEvent* triggering_event, | 1056 TextEvent* triggering_event, |
| 1057 InputEvent::InputType input_type) { | 1057 InputEvent::InputType input_type) { |
| 1058 if (text.IsEmpty()) | |
| 1059 return false; | |
| 1060 | |
| 1061 const VisibleSelection& selection = SelectionForCommand(triggering_event); | 1058 const VisibleSelection& selection = SelectionForCommand(triggering_event); |
| 1062 if (!selection.IsContentEditable()) | 1059 if (!selection.IsContentEditable()) |
| 1063 return false; | 1060 return false; |
| 1064 | 1061 |
| 1065 GetSpellChecker().UpdateMarkersForWordsAffectedByEditing( | 1062 GetSpellChecker().UpdateMarkersForWordsAffectedByEditing( |
| 1066 IsSpaceOrNewline(text[0])); | 1063 !text.IsEmpty() && IsSpaceOrNewline(text[0])); |
|
yosin_UTC9
2017/05/12 05:06:14
Good catch!
| |
| 1067 | 1064 |
| 1068 // Insert the text | 1065 // Insert the text |
| 1069 TypingCommand::InsertText( | 1066 TypingCommand::InsertText( |
| 1070 *selection.Start().GetDocument(), text, selection.AsSelection(), | 1067 *selection.Start().GetDocument(), text, selection.AsSelection(), |
| 1071 select_inserted_text ? TypingCommand::kSelectInsertedText : 0, | 1068 select_inserted_text ? TypingCommand::kSelectInsertedText : 0, |
| 1072 triggering_event && triggering_event->IsComposition() | 1069 triggering_event && triggering_event->IsComposition() |
| 1073 ? TypingCommand::kTextCompositionConfirm | 1070 ? TypingCommand::kTextCompositionConfirm |
| 1074 : TypingCommand::kTextCompositionNone, | 1071 : TypingCommand::kTextCompositionNone, |
| 1075 false, input_type); | 1072 false, input_type); |
| 1076 | 1073 |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1819 | 1816 |
| 1820 DEFINE_TRACE(Editor) { | 1817 DEFINE_TRACE(Editor) { |
| 1821 visitor->Trace(frame_); | 1818 visitor->Trace(frame_); |
| 1822 visitor->Trace(last_edit_command_); | 1819 visitor->Trace(last_edit_command_); |
| 1823 visitor->Trace(undo_stack_); | 1820 visitor->Trace(undo_stack_); |
| 1824 visitor->Trace(mark_); | 1821 visitor->Trace(mark_); |
| 1825 visitor->Trace(typing_style_); | 1822 visitor->Trace(typing_style_); |
| 1826 } | 1823 } |
| 1827 | 1824 |
| 1828 } // namespace blink | 1825 } // namespace blink |
| OLD | NEW |