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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 1634603003: Hide editing commands from DragController (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 side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698