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

Unified Diff: Source/core/editing/TypingCommand.cpp

Issue 43143003: Undo of delete/forward-delete of text should not select the deleted text on non-mac platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Function name modified and Tests/Expectations updated Created 7 years, 2 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 | « Source/core/editing/EditingBehavior.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/TypingCommand.cpp
diff --git a/Source/core/editing/TypingCommand.cpp b/Source/core/editing/TypingCommand.cpp
index 596265bf2d16b171d3a52dfcd39a28fb315175c2..042d0a84c85b449a456b70578e4d3690aceb92fc 100644
--- a/Source/core/editing/TypingCommand.cpp
+++ b/Source/core/editing/TypingCommand.cpp
@@ -484,10 +484,10 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
if (killRing)
frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
- // Make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
+ // On Mac, make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
// FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete
// more text than you insert. In that case all of the text that was around originally should be selected.
- if (m_openedByBackwardDelete)
+ if (frame->editor().behavior().shouldUndoOfDeleteSelectText() && m_openedByBackwardDelete)
setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
setSmartDelete(false);
@@ -577,8 +577,9 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool ki
if (killRing)
frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
- // make undo select what was deleted
- setStartingSelection(selectionAfterUndo);
+ // Make undo select what was deleted on Mac alone
+ if (frame->editor().behavior().shouldUndoOfDeleteSelectText())
+ setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
setSmartDelete(false);
typingAddedToOpenCommand(ForwardDeleteKey);
« no previous file with comments | « Source/core/editing/EditingBehavior.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698