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

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

Issue 2681023003: Remove replaceComposition() calls in finishComposingText. (Closed)
Patch Set: 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 50c4d95d121410f20ccfe36e4d0942ff890e6f28..46b1370c1fb8f47cc5848930a7b22cf62f60314f 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -247,22 +247,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