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

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

Issue 1620653002: Pass Only the Pasted Text to Spellchecker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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) 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (smartReplace) 505 if (smartReplace)
506 options |= ReplaceSelectionCommand::SmartReplace; 506 options |= ReplaceSelectionCommand::SmartReplace;
507 if (matchStyle) 507 if (matchStyle)
508 options |= ReplaceSelectionCommand::MatchStyle; 508 options |= ReplaceSelectionCommand::MatchStyle;
509 ASSERT(frame().document()); 509 ASSERT(frame().document());
510 ReplaceSelectionCommand::create(*frame().document(), fragment, options, Edit ActionPaste)->apply(); 510 ReplaceSelectionCommand::create(*frame().document(), fragment, options, Edit ActionPaste)->apply();
511 revealSelectionAfterEditingOperation(); 511 revealSelectionAfterEditingOperation();
512 512
513 if (frame().selection().isInPasswordField() || !spellChecker().isContinuousS pellCheckingEnabled()) 513 if (frame().selection().isInPasswordField() || !spellChecker().isContinuousS pellCheckingEnabled())
514 return; 514 return;
515 spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(frame().selection(). rootEditableElement()); 515
516 ASSERT(lastEditCommand()->isReplaceSelectionCommand());
517 const EphemeralRange& insertedRange = toReplaceSelectionCommand(lastEditComm and())->insertedRange();
518 if (insertedRange.isNotNull())
yosin_UTC9 2016/01/22 09:56:55 nit: early return style is better.
Xiaocheng 2016/01/22 10:24:37 Done.
519 spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(frame().selectio n().rootEditableElement(), insertedRange);
516 } 520 }
517 521
518 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement , bool smartReplace) 522 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement , bool smartReplace)
519 { 523 {
520 replaceSelectionWithFragment(createFragmentFromText(selectedRange(), text), selectReplacement, smartReplace, true); 524 replaceSelectionWithFragment(createFragmentFromText(selectedRange(), text), selectReplacement, smartReplace, true);
521 } 525 }
522 526
523 EphemeralRange Editor::selectedRange() 527 EphemeralRange Editor::selectedRange()
524 { 528 {
525 return frame().selection().selection().toNormalizedEphemeralRange(); 529 return frame().selection().selection().toNormalizedEphemeralRange();
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 } 1304 }
1301 1305
1302 DEFINE_TRACE(Editor) 1306 DEFINE_TRACE(Editor)
1303 { 1307 {
1304 visitor->trace(m_frame); 1308 visitor->trace(m_frame);
1305 visitor->trace(m_lastEditCommand); 1309 visitor->trace(m_lastEditCommand);
1306 visitor->trace(m_mark); 1310 visitor->trace(m_mark);
1307 } 1311 }
1308 1312
1309 } // namespace blink 1313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698