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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |