| 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 a513291747f6eaa0a1eee67c1c366aad8adcba99..75b964f6bde2e53271643e0fb0857f5a0101d1cf 100644
|
| --- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| @@ -251,8 +251,10 @@ bool InputMethodController::finishComposingText(
|
| return replaceCompositionAndMoveCaret(composingText(), 0);
|
| }
|
|
|
| -bool InputMethodController::commitText(const String& text,
|
| - int relativeCaretPosition) {
|
| +bool InputMethodController::commitText(
|
| + const String& text,
|
| + const Vector<CompositionUnderline>& underlines,
|
| + int relativeCaretPosition) {
|
| if (hasComposition())
|
| return replaceCompositionAndMoveCaret(text, relativeCaretPosition);
|
|
|
| @@ -262,7 +264,32 @@ bool InputMethodController::commitText(const String& text,
|
| // duplicate selection change event.
|
| if (!text.length() && !relativeCaretPosition)
|
| return false;
|
| - return insertTextAndMoveCaret(text, relativeCaretPosition);
|
| +
|
| + if (!insertTextAndMoveCaret(text, relativeCaretPosition))
|
| + return false;
|
| +
|
| + Position base = mostForwardCaretPosition(frame().selection().base());
|
| + Node* baseNode = base.anchorNode();
|
| +
|
| + if (!baseNode || !baseNode->isTextNode())
|
| + return true;
|
| +
|
| + unsigned baseOffset = base.computeOffsetInContainerNode();
|
| +
|
| + for (const auto& underline : underlines) {
|
| + unsigned underlineStart = baseOffset + underline.startOffset();
|
| + unsigned underlineEnd = baseOffset + underline.endOffset();
|
| +
|
| + EphemeralRange ephemeralLineRange = EphemeralRange(
|
| + Position(baseNode, underlineStart), Position(baseNode, underlineEnd));
|
| + if (ephemeralLineRange.isNull())
|
| + continue;
|
| + document().markers().addCompositionMarker(
|
| + ephemeralLineRange.startPosition(), ephemeralLineRange.endPosition(),
|
| + underline.color(), underline.thick(), underline.backgroundColor());
|
| + }
|
| +
|
| + return true;
|
| }
|
|
|
| bool InputMethodController::replaceComposition(const String& text) {
|
|
|