Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 1773443002: Revert of Simplify TypingCommand::insertText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/TextInsertionBaseCommand.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 789
790 bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectIn sertedText, TextEvent* triggeringEvent) 790 bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectIn sertedText, TextEvent* triggeringEvent)
791 { 791 {
792 if (text.isEmpty()) 792 if (text.isEmpty())
793 return false; 793 return false;
794 794
795 const VisibleSelection& selection = selectionForCommand(triggeringEvent); 795 const VisibleSelection& selection = selectionForCommand(triggeringEvent);
796 if (!selection.isContentEditable()) 796 if (!selection.isContentEditable())
797 return false; 797 return false;
798 798
799 frame().selection().setSelection(selection); 799 spellChecker().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[ 0]));
800
800 // Insert the text 801 // Insert the text
801 TypingCommand::insertText(*selection.start().document(), text, 802 TypingCommand::insertText(*selection.start().document(), text, selection,
802 selectInsertedText ? TypingCommand::SelectInsertedText : 0, 803 selectInsertedText ? TypingCommand::SelectInsertedText : 0,
803 triggeringEvent && triggeringEvent->isComposition() ? TypingCommand::Tex tCompositionConfirm : TypingCommand::TextCompositionNone); 804 triggeringEvent && triggeringEvent->isComposition() ? TypingCommand::Tex tCompositionConfirm : TypingCommand::TextCompositionNone);
804 805
805 // Reveal the current selection 806 // Reveal the current selection
806 if (LocalFrame* editedFrame = selection.start().document()->frame()) { 807 if (LocalFrame* editedFrame = selection.start().document()->frame()) {
807 if (Page* page = editedFrame->page()) 808 if (Page* page = editedFrame->page())
808 toLocalFrame(page->focusController().focusedOrMainFrame())->selectio n().revealSelection(ScrollAlignment::alignCenterIfNeeded); 809 toLocalFrame(page->focusController().focusedOrMainFrame())->selectio n().revealSelection(ScrollAlignment::alignCenterIfNeeded);
809 } 810 }
810 811
811 return true; 812 return true;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 } 1367 }
1367 1368
1368 DEFINE_TRACE(Editor) 1369 DEFINE_TRACE(Editor)
1369 { 1370 {
1370 visitor->trace(m_frame); 1371 visitor->trace(m_frame);
1371 visitor->trace(m_lastEditCommand); 1372 visitor->trace(m_lastEditCommand);
1372 visitor->trace(m_mark); 1373 visitor->trace(m_mark);
1373 } 1374 }
1374 1375
1375 } // namespace blink 1376 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/TextInsertionBaseCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698