| Index: third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp b/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp
|
| index d31d2ecc93bad0d4d442464510f362cee61074a4..e71d80d5d8556426845917e27bce3ba641692111 100644
|
| --- a/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp
|
| @@ -46,6 +46,7 @@ DEFINE_TRACE(WebInputMethodControllerImpl) {
|
| bool WebInputMethodControllerImpl::setComposition(
|
| const WebString& text,
|
| const WebVector<WebCompositionUnderline>& underlines,
|
| + const WebRange& replacementRange,
|
| int selectionStart,
|
| int selectionEnd) {
|
| if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) {
|
| @@ -58,6 +59,10 @@ bool WebInputMethodControllerImpl::setComposition(
|
| if (!frame()->editor().canEdit() && !inputMethodController().hasComposition())
|
| return false;
|
|
|
| + // Select the range to be replaced with the composition later.
|
| + if (!replacementRange.isNull())
|
| + m_webLocalFrame->selectRange(replacementRange);
|
| +
|
| // We should verify the parent node of this IME composition node are
|
| // editable because JavaScript may delete a parent node of the composition
|
| // node. In this case, WebKit crashes while deleting texts from the parent
|
| @@ -118,6 +123,7 @@ bool WebInputMethodControllerImpl::finishComposingText(
|
| bool WebInputMethodControllerImpl::commitText(
|
| const WebString& text,
|
| const WebVector<WebCompositionUnderline>& underlines,
|
| + const WebRange& replacementRange,
|
| int relativeCaretPosition) {
|
| UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
|
| frame()->document(), UserGestureToken::NewGesture));
|
| @@ -125,6 +131,10 @@ bool WebInputMethodControllerImpl::commitText(
|
| if (WebPlugin* plugin = focusedPluginIfInputMethodSupported())
|
| return plugin->commitText(text, underlines, relativeCaretPosition);
|
|
|
| + // Select the range to be replaced with the composition later.
|
| + if (!replacementRange.isNull())
|
| + m_webLocalFrame->selectRange(replacementRange);
|
| +
|
| // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| // needs to be audited. See http://crbug.com/590369 for more details.
|
| frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
|
|