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

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

Issue 2779813002: [InputEvent] Don't modify selection when transpose was canceled (Closed)
Patch Set: 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/EditingUtilities.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/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 5d0c85686a345b6edbb41d7c3b46bb40eaa3ee0f..91de813592fa2e34996ae4f5af0ec5dbb9b201a9 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -1407,14 +1407,10 @@ void Editor::transpose() {
return;
String transposed = text.right(1) + text.left(1);
- // Select the two characters.
- if (createVisibleSelection(newSelection) !=
- frame().selection().computeVisibleSelectionInDOMTreeDeprecated())
- frame().selection().setSelection(newSelection);
-
if (dispatchBeforeInputInsertText(
eventTargetNodeForDocument(frame().document()), transposed,
- InputEvent::InputType::InsertTranspose) !=
+ InputEvent::InputType::InsertTranspose,
+ new StaticRangeVector(1, StaticRange::create(range))) !=
DispatchEventResult::NotCanceled)
return;
@@ -1426,6 +1422,11 @@ void Editor::transpose() {
// needs to be audited. see http://crbug.com/590369 for more details.
frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+ // Select the two characters.
+ if (createVisibleSelection(newSelection) !=
+ frame().selection().computeVisibleSelectionInDOMTreeDeprecated())
yosin_UTC9 2017/03/28 07:08:35 nit: Since L1423 update layout, we don't need to u
chongz 2017/03/28 20:46:47 Done.
+ frame().selection().setSelection(newSelection);
+
// Insert the transposed characters.
replaceSelectionWithText(transposed, false, false,
InputEvent::InputType::InsertTranspose);
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698