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

Unified Diff: third_party/WebKit/Source/core/page/DragController.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
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/DragController.cpp
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp
index cd5db69054923e406dfdbe8d4f841baababf622c..b1a938d8894eac1ad339103398e0cab414d0bffd 100644
--- a/third_party/WebKit/Source/core/page/DragController.cpp
+++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -42,8 +42,6 @@
#include "core/editing/EditingUtilities.h"
#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
-#include "core/editing/commands/MoveSelectionCommand.h"
-#include "core/editing/commands/ReplaceSelectionCommand.h"
#include "core/editing/serializers/Serialization.h"
#include "core/events/TextEvent.h"
#include "core/fetch/ImageResource.h"
@@ -503,16 +501,11 @@ bool DragController::concludeEditDrag(DragData* dragData)
// but only to smart insert if the selection granularity is word granularity.
bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled();
bool smartInsert = smartDelete && innerFrame->selection().granularity() == WordGranularity && dragData->canSmartReplace();
- MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert, smartDelete)->apply();
+ innerFrame->editor().moveSelectionAfterDragging(fragment, dragCaret.base(), smartInsert, smartDelete);
} else {
if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) {
- ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
- if (dragData->canSmartReplace())
- options |= ReplaceSelectionCommand::SmartReplace;
- if (chosePlainText)
- options |= ReplaceSelectionCommand::MatchStyle;
ASSERT(m_documentUnderMouse);
- ReplaceSelectionCommand::create(*m_documentUnderMouse.get(), fragment, options, EditActionDrag)->apply();
+ m_documentUnderMouse->frame()->editor().replaceSelectionAfterDragging(fragment, dragData->canSmartReplace(), chosePlainText);
}
}
} else {
@@ -521,8 +514,10 @@ bool DragController::concludeEditDrag(DragData* dragData)
return false;
if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) {
+ const bool canSmartReplace = false;
+ const bool chosePlainText = true;
ASSERT(m_documentUnderMouse);
- ReplaceSelectionCommand::create(*m_documentUnderMouse.get(), createFragmentFromText(EphemeralRange(range.get()), text), ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting, EditActionDrag)->apply();
+ m_documentUnderMouse->frame()->editor().replaceSelectionAfterDragging(createFragmentFromText(EphemeralRange(range.get()), text), canSmartReplace, chosePlainText);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698