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

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

Issue 2689233006: Fix bug on Android causing composition underlines to appear in the wrong place (Closed)
Patch Set: Don't change param names 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.cpp ('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/InputMethodControllerTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
index eb342fb71ba02c2ded8f4f3f5f734ed710489f48..d01a00c61eb36ff518e6f4734ada769988c94463 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -1204,4 +1204,38 @@ TEST_F(InputMethodControllerTest, CommitPlainTextWithUnderlineReplace) {
EXPECT_EQ(15u, document().markers().markers()[0]->endOffset());
}
+TEST_F(InputMethodControllerTest,
+ CompositionUnderlineAppearsCorrectlyAfterNewline) {
+ Element* div =
+ insertHTMLElement("<div id='sample' contenteditable></div>", "sample");
+
+ Vector<CompositionUnderline> underlines;
+ controller().setComposition(String("hello"), underlines, 6, 6);
+ controller().finishComposingText(InputMethodController::KeepSelection);
+ frame().editor().insertLineBreak();
+
+ controller().setCompositionFromExistingText(underlines, 8, 8);
+
+ underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0));
+ controller().setComposition(String("world"), underlines, 0, 0);
+ ASSERT_EQ(1u, document().markers().markers().size());
+
+ // Verify composition underline shows up on the second line, not the first
+ ASSERT_EQ(0u, document()
+ .markers()
+ .markersInRange(PlainTextRange(0, 5).createRange(*div),
+ DocumentMarker::AllMarkers())
+ .size());
+ ASSERT_EQ(1u, document()
+ .markers()
+ .markersInRange(PlainTextRange(6, 11).createRange(*div),
+ DocumentMarker::AllMarkers())
+ .size());
+
+ // Verify marker has correct start/end offsets (measured from the beginning
+ // of the node, which is the beginning of the line)
+ EXPECT_EQ(0u, document().markers().markers()[0]->startOffset());
+ EXPECT_EQ(5u, document().markers().markers()[0]->endOffset());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698