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 7e84c28e961275ba27bf179d8acb45b8db3fe55b..c6f54fc863f1f09f95170644818da2c28a3a9022 100644 |
| --- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp |
| +++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp |
| @@ -214,13 +214,18 @@ bool InputMethodController::finishComposingText( |
| PlainTextRange oldOffsets = getSelectionOffsets(); |
| Editor::RevealSelectionScope revealSelectionScope(&editor()); |
| - bool result = replaceComposition(composingText()); |
| + const String& composing = composingText(); |
| + bool result = replaceComposition(composing); |
|
yosin_UTC9
2016/11/15 02:27:04
nit: s/bool/const bool/
yabinh
2016/11/15 19:47:36
Done.
|
| // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| // needs to be audited. see http://crbug.com/590369 for more details. |
| frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| setSelectionOffsets(oldOffsets); |
| + |
| + // No DOM update after 'compositionend'. |
| + dispatchCompositionEndEvent(frame(), composing); |
| + |
| return result; |
| } |
| @@ -277,9 +282,6 @@ bool InputMethodController::replaceComposition(const String& text) { |
| if (!frame().document()) |
| return false; |
| - // No DOM update after 'compositionend'. |
| - dispatchCompositionEndEvent(frame(), text); |
| - |
| return true; |
| } |
| @@ -307,7 +309,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) { |
| @@ -618,7 +626,9 @@ void InputMethodController::setComposition( |
| frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| setEditableSelectionOffsets(selectedRange); |
| - return; |
| + |
| + // No DOM update after 'compositionend'. |
| + return dispatchCompositionEndEvent(frame(), text); |
| } |
| // We should send a 'compositionstart' event only when the given text is not |