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

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

Issue 2664603002: Remove replaceComposition() calls in finishComposingText. (Closed)
Patch Set: Rebase Created 3 years, 10 months 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
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 6678945ae9d9f44b016017d717c74d0514d95c4c..e144382666975d00c41e0f84d873f985e27f75c0 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -264,22 +264,37 @@ bool InputMethodController::finishComposingText(
if (!hasComposition())
return false;
+ const String& composing = composingText();
+
if (confirmBehavior == KeepSelection) {
PlainTextRange oldOffsets = getSelectionOffsets();
Editor::RevealSelectionScope revealSelectionScope(&editor());
- bool result = replaceComposition(composingText());
+ clear();
+ dispatchCompositionEndEvent(frame(), composing);
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. see http://crbug.com/590369 for more details.
document().updateStyleAndLayoutIgnorePendingStylesheets();
-
setSelectionOffsets(oldOffsets);
- return result;
+ return true;
}
- return replaceCompositionAndMoveCaret(composingText(), 0,
- Vector<CompositionUnderline>());
+ Element* rootEditableElement = frame().selection().rootEditableElement();
+ if (!rootEditableElement)
+ return false;
+ PlainTextRange compositionRange =
+ PlainTextRange::create(*rootEditableElement, *m_compositionRange);
+ if (compositionRange.isNull())
+ return false;
+
+ clear();
+
+ if (!moveCaret(compositionRange.end()))
+ return false;
+
+ dispatchCompositionEndEvent(frame(), composing);
+ return true;
}
bool InputMethodController::commitText(

Powered by Google App Engine
This is Rietveld 408576698