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/editing/commands/TypingCommand.cpp

Issue 2733933003: Move CompositeEditCommand::deleteSelection() to TypingCommand::deleteSelectionIfRange() (Closed)
Patch Set: 2017-03-07T14:29:09 Created 3 years, 9 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/commands/TypingCommand.h ('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/editing/commands/TypingCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
index e47b8b27d0ba607435d0a760bdd461d957cb98f9..239d2ecf2d7bc16c429202d15e71ca9ac56ceddf 100644
--- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -36,6 +36,7 @@
#include "core/editing/VisiblePosition.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/commands/BreakBlockquoteCommand.h"
+#include "core/editing/commands/DeleteSelectionCommand.h"
#include "core/editing/commands/InsertIncrementalTextCommand.h"
#include "core/editing/commands/InsertLineBreakCommand.h"
#include "core/editing/commands/InsertParagraphSeparatorCommand.h"
@@ -175,6 +176,20 @@ void TypingCommand::deleteSelection(Document& document, Options options) {
TypingCommand::create(document, DeleteSelection, "", options)->apply();
}
+void TypingCommand::deleteSelectionIfRange(const VisibleSelection& selection,
+ EditingState* editingState,
+ bool smartDelete,
+ bool mergeBlocksAfterDelete,
+ bool expandForSpecialElements,
+ bool sanitizeMarkup) {
+ if (!selection.isRange())
+ return;
+ applyCommandToComposite(DeleteSelectionCommand::create(
+ selection, smartDelete, mergeBlocksAfterDelete,
+ expandForSpecialElements, sanitizeMarkup),
+ editingState);
+}
+
void TypingCommand::deleteKeyPressed(Document& document,
Options options,
TextGranularity granularity) {
@@ -813,8 +828,7 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity,
if (frame->editor().behavior().shouldUndoOfDeleteSelectText() &&
m_openedByBackwardDelete)
setStartingSelection(selectionAfterUndo);
- CompositeEditCommand::deleteSelection(selectionToDelete, editingState,
- m_smartDelete);
+ deleteSelectionIfRange(selectionToDelete, editingState, m_smartDelete);
if (editingState->isAborted())
return;
setSmartDelete(false);
@@ -941,8 +955,7 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity,
// Make undo select what was deleted on Mac alone
if (frame->editor().behavior().shouldUndoOfDeleteSelectText())
setStartingSelection(selectionAfterUndo);
- CompositeEditCommand::deleteSelection(selectionToDelete, editingState,
- m_smartDelete);
+ deleteSelectionIfRange(selectionToDelete, editingState, m_smartDelete);
if (editingState->isAborted())
return;
setSmartDelete(false);
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/TypingCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698