Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/Editor.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp |
| index 6ac01cdf4159227f26899b2694297968b60a8101..72d484ede33cc09c89e368afb99c31af3d808e2d 100644 |
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp |
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
| @@ -49,6 +49,7 @@ |
| #include "core/editing/commands/DeleteSelectionCommand.h" |
| #include "core/editing/commands/IndentOutdentCommand.h" |
| #include "core/editing/commands/InsertListCommand.h" |
| +#include "core/editing/commands/MoveSelectionCommand.h" |
| #include "core/editing/commands/RemoveFormatCommand.h" |
| #include "core/editing/commands/ReplaceSelectionCommand.h" |
| #include "core/editing/commands/SimplifyMarkupCommand.h" |
| @@ -524,6 +525,23 @@ void Editor::replaceSelectionWithText(const String& text, bool selectReplacement |
| replaceSelectionWithFragment(createFragmentFromText(selectedRange(), text), selectReplacement, smartReplace, true); |
| } |
| +// TODO(xiaochengh): Merge it with |replaceSelectionWithFragment()|. |
| +void Editor::replaceSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragment> 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.
|
| +{ |
| + ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting; |
| + if (smartReplace) |
| + options |= ReplaceSelectionCommand::SmartReplace; |
| + if (plainText) |
| + options |= ReplaceSelectionCommand::MatchStyle; |
| + ASSERT(frame().document()); |
| + ReplaceSelectionCommand::create(*frame().document(), fragment, options, EditActionDrag)->apply(); |
| +} |
| + |
| +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
|
| +{ |
| + MoveSelectionCommand::create(fragment, pos, smartInsert, smartDelete)->apply(); |
| +} |
| + |
| EphemeralRange Editor::selectedRange() |
| { |
| return frame().selection().selection().toNormalizedEphemeralRange(); |