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

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

Issue 2211813002: Revert removal of grammar checking and marking code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 if (startOfParagraphToMove.deepEquivalent() == endOfParagraphToMove.deepEqui valent() && shouldPreserveStyle == PreserveStyle) { 1329 if (startOfParagraphToMove.deepEquivalent() == endOfParagraphToMove.deepEqui valent() && shouldPreserveStyle == PreserveStyle) {
1330 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep Equivalent()); 1330 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep Equivalent());
1331 styleInEmptyParagraph->mergeTypingStyle(&document()); 1331 styleInEmptyParagraph->mergeTypingStyle(&document());
1332 // The moved paragraph should assume the block style of the destination. 1332 // The moved paragraph should assume the block style of the destination.
1333 styleInEmptyParagraph->removeBlockProperties(); 1333 styleInEmptyParagraph->removeBlockProperties();
1334 } 1334 }
1335 1335
1336 // FIXME (5098931): We should add a new insert action "WebViewInsertActionMo ved" and call shouldInsertFragment here. 1336 // FIXME (5098931): We should add a new insert action "WebViewInsertActionMo ved" and call shouldInsertFragment here.
1337 1337
1338 setEndingSelection(VisibleSelection(start, end)); 1338 setEndingSelection(VisibleSelection(start, end));
1339 document().frame()->spellChecker().clearMisspellings(endingSelection()); 1339 document().frame()->spellChecker().clearMisspellingsAndBadGrammar(endingSele ction());
1340 deleteSelection(editingState, false, false, false); 1340 deleteSelection(editingState, false, false, false);
1341 if (editingState->isAborted()) 1341 if (editingState->isAborted())
1342 return; 1342 return;
1343 1343
1344 DCHECK(destination.deepEquivalent().isConnected()) << destination; 1344 DCHECK(destination.deepEquivalent().isConnected()) << destination;
1345 cleanupAfterDeletion(editingState, destination); 1345 cleanupAfterDeletion(editingState, destination);
1346 if (editingState->isAborted()) 1346 if (editingState->isAborted())
1347 return; 1347 return;
1348 DCHECK(destination.deepEquivalent().isConnected()) << destination; 1348 DCHECK(destination.deepEquivalent().isConnected()) << destination;
1349 1349
(...skipping 24 matching lines...) Expand all
1374 return; 1374 return;
1375 } 1375 }
1376 setEndingSelection(destinationSelection); 1376 setEndingSelection(destinationSelection);
1377 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S electReplacement | ReplaceSelectionCommand::MovingParagraph; 1377 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S electReplacement | ReplaceSelectionCommand::MovingParagraph;
1378 if (shouldPreserveStyle == DoNotPreserveStyle) 1378 if (shouldPreserveStyle == DoNotPreserveStyle)
1379 options |= ReplaceSelectionCommand::MatchStyle; 1379 options |= ReplaceSelectionCommand::MatchStyle;
1380 applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment , options), editingState); 1380 applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment , options), editingState);
1381 if (editingState->isAborted()) 1381 if (editingState->isAborted())
1382 return; 1382 return;
1383 1383
1384 document().frame()->spellChecker().markMisspellings(endingSelection()); 1384 document().frame()->spellChecker().markMisspellingsAndBadGrammar(endingSelec tion());
1385 1385
1386 // If the selection is in an empty paragraph, restore styles from the old em pty paragraph to the new empty paragraph. 1386 // If the selection is in an empty paragraph, restore styles from the old em pty paragraph to the new empty paragraph.
1387 bool selectionIsEmptyParagraph = endingSelection().isCaret() && isStartOfPar agraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().v isibleStart()); 1387 bool selectionIsEmptyParagraph = endingSelection().isCaret() && isStartOfPar agraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().v isibleStart());
1388 if (styleInEmptyParagraph && selectionIsEmptyParagraph) { 1388 if (styleInEmptyParagraph && selectionIsEmptyParagraph) {
1389 applyStyle(styleInEmptyParagraph, editingState); 1389 applyStyle(styleInEmptyParagraph, editingState);
1390 if (editingState->isAborted()) 1390 if (editingState->isAborted())
1391 return; 1391 return;
1392 } 1392 }
1393 1393
1394 if (shouldPreserveSelection == DoNotPreserveSelection || startIndex == -1) 1394 if (shouldPreserveSelection == DoNotPreserveSelection || startIndex == -1)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 } 1654 }
1655 1655
1656 DEFINE_TRACE(CompositeEditCommand) 1656 DEFINE_TRACE(CompositeEditCommand)
1657 { 1657 {
1658 visitor->trace(m_commands); 1658 visitor->trace(m_commands);
1659 visitor->trace(m_composition); 1659 visitor->trace(m_composition);
1660 EditCommand::trace(visitor); 1660 EditCommand::trace(visitor);
1661 } 1661 }
1662 1662
1663 } // namespace blink 1663 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698