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

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

Issue 1847583003: Fix setComposingText when newCursorPosition != 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix setComposingText when newCursorPosition < 1 Created 4 years, 9 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 7aeb0d1f45878ec10d499195a6e38f8e40180923..89d9017dd73a84876001fe0f70e4733a8e58534d 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -231,7 +231,7 @@ void InputMethodController::cancelCompositionIfSelectionIsInvalid()
frame().chromeClient().didCancelCompositionOnSelectionChange();
}
-void InputMethodController::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd)
+void InputMethodController::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, int selectionStart, int selectionEnd)
{
Editor::RevealSelectionScope revealSelectionScope(&editor());
@@ -319,8 +319,8 @@ void InputMethodController::setComposition(const String& text, const Vector<Comp
if (baseNode->layoutObject())
baseNode->layoutObject()->setShouldDoFullPaintInvalidation();
- unsigned start = std::min(baseOffset + selectionStart, extentOffset);
- unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);
+ int start = std::min(std::max((int)baseOffset + selectionStart, 0), (int)extentOffset);
Changwan Ryu 2016/04/01 00:37:26 baseOffset >= 0 so you just need to make sure sele
yabinh 2016/04/01 04:14:17 selectionStart can be negative, because it is the
Changwan Ryu 2016/04/01 05:36:15 I see. Thanks for clarification. By the way, we pr
+ int end = std::min(std::max((int)baseOffset + selectionEnd, start), (int)extentOffset);
RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->document(), baseNode, start, baseNode, end);
frame().selection().setSelectedRange(selectedRange.get(), TextAffinity::Downstream, SelectionDirectionalMode::NonDirectional, NotUserTriggered);

Powered by Google App Engine
This is Rietveld 408576698