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

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

Issue 2689233006: Fix bug on Android causing composition underlines to appear in the wrong place (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
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eedf26046cc6765274d95f26be938f1ba1cd3882..a663c1eec032326508173a6bb2be2ce1f3cd6efe 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -352,15 +352,14 @@ static int computeAbsoluteCaretPosition(size_t textStart,
void InputMethodController::addCompositionUnderlines(
const Vector<CompositionUnderline>& underlines,
- ContainerNode* rootEditableElement,
- unsigned offset) {
+ ContainerNode* baseElement,
+ unsigned offsetInPlainChars) {
for (const auto& underline : underlines) {
- unsigned underlineStart = offset + underline.startOffset();
- unsigned underlineEnd = offset + underline.endOffset();
+ unsigned underlineStart = offsetInPlainChars + underline.startOffset();
+ unsigned underlineEnd = offsetInPlainChars + underline.endOffset();
EphemeralRange ephemeralLineRange =
- PlainTextRange(underlineStart, underlineEnd)
- .createRange(*rootEditableElement);
+ PlainTextRange(underlineStart, underlineEnd).createRange(*baseElement);
if (ephemeralLineRange.isNull())
continue;
@@ -608,7 +607,10 @@ void InputMethodController::setComposition(
return;
}
- addCompositionUnderlines(underlines, baseNode->parentNode(), baseOffset);
+ PlainTextRange compositionPlainTextRange =
+ PlainTextRange::create(*baseNode->parentNode(), *m_compositionRange);
+ addCompositionUnderlines(underlines, baseNode->parentNode(),
rlanday 2017/02/16 00:37:54 Unfortunately I can't just work with baseNode dire
+ compositionPlainTextRange.start());
}
PlainTextRange InputMethodController::createSelectionRangeForSetComposition(
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698