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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "core/dom/ParserContentPolicy.h" | 42 #include "core/dom/ParserContentPolicy.h" |
| 43 #include "core/dom/Text.h" | 43 #include "core/dom/Text.h" |
| 44 #include "core/editing/EditingUtilities.h" | 44 #include "core/editing/EditingUtilities.h" |
| 45 #include "core/editing/InputMethodController.h" | 45 #include "core/editing/InputMethodController.h" |
| 46 #include "core/editing/RenderedPosition.h" | 46 #include "core/editing/RenderedPosition.h" |
| 47 #include "core/editing/VisibleUnits.h" | 47 #include "core/editing/VisibleUnits.h" |
| 48 #include "core/editing/commands/ApplyStyleCommand.h" | 48 #include "core/editing/commands/ApplyStyleCommand.h" |
| 49 #include "core/editing/commands/DeleteSelectionCommand.h" | 49 #include "core/editing/commands/DeleteSelectionCommand.h" |
| 50 #include "core/editing/commands/IndentOutdentCommand.h" | 50 #include "core/editing/commands/IndentOutdentCommand.h" |
| 51 #include "core/editing/commands/InsertListCommand.h" | 51 #include "core/editing/commands/InsertListCommand.h" |
| 52 #include "core/editing/commands/MoveSelectionCommand.h" | |
| 52 #include "core/editing/commands/RemoveFormatCommand.h" | 53 #include "core/editing/commands/RemoveFormatCommand.h" |
| 53 #include "core/editing/commands/ReplaceSelectionCommand.h" | 54 #include "core/editing/commands/ReplaceSelectionCommand.h" |
| 54 #include "core/editing/commands/SimplifyMarkupCommand.h" | 55 #include "core/editing/commands/SimplifyMarkupCommand.h" |
| 55 #include "core/editing/commands/TypingCommand.h" | 56 #include "core/editing/commands/TypingCommand.h" |
| 56 #include "core/editing/commands/UndoStack.h" | 57 #include "core/editing/commands/UndoStack.h" |
| 57 #include "core/editing/iterators/SearchBuffer.h" | 58 #include "core/editing/iterators/SearchBuffer.h" |
| 58 #include "core/editing/markers/DocumentMarkerController.h" | 59 #include "core/editing/markers/DocumentMarkerController.h" |
| 59 #include "core/editing/serializers/Serialization.h" | 60 #include "core/editing/serializers/Serialization.h" |
| 60 #include "core/editing/spellcheck/SpellChecker.h" | 61 #include "core/editing/spellcheck/SpellChecker.h" |
| 61 #include "core/events/ClipboardEvent.h" | 62 #include "core/events/ClipboardEvent.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 if (insertedRange.isNull()) | 518 if (insertedRange.isNull()) |
| 518 return; | 519 return; |
| 519 spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(frame().selection(). rootEditableElement(), insertedRange); | 520 spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(frame().selection(). rootEditableElement(), insertedRange); |
| 520 } | 521 } |
| 521 | 522 |
| 522 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement , bool smartReplace) | 523 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement , bool smartReplace) |
| 523 { | 524 { |
| 524 replaceSelectionWithFragment(createFragmentFromText(selectedRange(), text), selectReplacement, smartReplace, true); | 525 replaceSelectionWithFragment(createFragmentFromText(selectedRange(), text), selectReplacement, smartReplace, true); |
| 525 } | 526 } |
| 526 | 527 |
| 528 // TODO(xiaochengh): Merge it with |replaceSelectionWithFragment()|. | |
| 529 void Editor::replaceSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragme nt> fragment, bool smartReplace, bool plainText) | |
|
yosin_UTC9
2016/01/27 02:23:03
Please add TODO comment to replace |bool| paramete
Xiaocheng
2016/01/27 03:16:02
Added in Editor.h.
| |
| 530 { | |
| 531 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S electReplacement | ReplaceSelectionCommand::PreventNesting; | |
| 532 if (smartReplace) | |
| 533 options |= ReplaceSelectionCommand::SmartReplace; | |
| 534 if (plainText) | |
| 535 options |= ReplaceSelectionCommand::MatchStyle; | |
| 536 ASSERT(frame().document()); | |
| 537 ReplaceSelectionCommand::create(*frame().document(), fragment, options, Edit ActionDrag)->apply(); | |
| 538 } | |
| 539 | |
| 540 void Editor::moveSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragment> fragment, const Position& pos, bool smartInsert, bool smartDelete) | |
|
yosin_UTC9
2016/01/27 02:23:02
Please add TODO comment to replace |bool| paramete
| |
| 541 { | |
| 542 MoveSelectionCommand::create(fragment, pos, smartInsert, smartDelete)->apply (); | |
| 543 } | |
| 544 | |
| 527 EphemeralRange Editor::selectedRange() | 545 EphemeralRange Editor::selectedRange() |
| 528 { | 546 { |
| 529 return frame().selection().selection().toNormalizedEphemeralRange(); | 547 return frame().selection().selection().toNormalizedEphemeralRange(); |
| 530 } | 548 } |
| 531 | 549 |
| 532 bool Editor::shouldDeleteRange(const EphemeralRange& range) const | 550 bool Editor::shouldDeleteRange(const EphemeralRange& range) const |
| 533 { | 551 { |
| 534 if (range.isCollapsed()) | 552 if (range.isCollapsed()) |
| 535 return false; | 553 return false; |
| 536 | 554 |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 } | 1322 } |
| 1305 | 1323 |
| 1306 DEFINE_TRACE(Editor) | 1324 DEFINE_TRACE(Editor) |
| 1307 { | 1325 { |
| 1308 visitor->trace(m_frame); | 1326 visitor->trace(m_frame); |
| 1309 visitor->trace(m_lastEditCommand); | 1327 visitor->trace(m_lastEditCommand); |
| 1310 visitor->trace(m_mark); | 1328 visitor->trace(m_mark); |
| 1311 } | 1329 } |
| 1312 | 1330 |
| 1313 } // namespace blink | 1331 } // namespace blink |
| OLD | NEW |