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

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

Issue 2493703002: Make "compositionend" event fired after setting caret position (Closed)
Patch Set: format Created 4 years, 1 month 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 | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/InputMethodController.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
index e9fca6b74ee1c78840bd09ff84ce011d7b104b71..d85c64584614165e2271ed66e51ba93be7de6f1a 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -223,13 +223,18 @@ bool InputMethodController::finishComposingText(
PlainTextRange oldOffsets = getSelectionOffsets();
Editor::RevealSelectionScope revealSelectionScope(&editor());
- bool result = replaceComposition(composingText());
+ const String& composing = composingText();
+ const bool result = replaceComposition(composing);
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. see http://crbug.com/590369 for more details.
document().updateStyleAndLayoutIgnorePendingStylesheets();
setSelectionOffsets(oldOffsets);
+
+ // No DOM update after 'compositionend'.
+ dispatchCompositionEndEvent(frame(), composing);
+
return result;
}
@@ -286,9 +291,6 @@ bool InputMethodController::replaceComposition(const String& text) {
if (!isAvailable())
return false;
- // No DOM update after 'compositionend'.
- dispatchCompositionEndEvent(frame(), text);
-
return true;
}
@@ -316,7 +318,13 @@ bool InputMethodController::replaceCompositionAndMoveCaret(
int absoluteCaretPosition = computeAbsoluteCaretPosition(
textStart, text.length(), relativeCaretPosition);
- return moveCaret(absoluteCaretPosition);
+ if (!moveCaret(absoluteCaretPosition))
+ return false;
+
+ // No DOM update after 'compositionend'.
+ dispatchCompositionEndEvent(frame(), text);
+
+ return true;
}
bool InputMethodController::insertText(const String& text) {
@@ -627,7 +635,9 @@ void InputMethodController::setComposition(
document().updateStyleAndLayoutIgnorePendingStylesheets();
setEditableSelectionOffsets(selectedRange);
- return;
+
+ // No DOM update after 'compositionend'.
+ return dispatchCompositionEndEvent(frame(), text);
aelias_OOO_until_Jul13 2017/01/27 02:23:40 This was reverted due to http://crbug.com/674295.
}
// We should send a 'compositionstart' event only when the given text is not
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698