Chromium Code Reviews| 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 |