3 <script src=
"../../resources/js-test.js"></script>
4 <script src=
"../../editing/editing.js"></script>
9 border:
1px solid black;
12 transform: translateZ(
0);
17 unicode-bidi: bidi-override;
21 text-overflow:ellipsis;
29 description("This tests the correct placement of inline spelling and grammar "
30 + "markers in text. Spelling markers should line up exactly under misspelled "
31 + "words in all cases.");
35 if (window
.internals
) {
36 internals
.settings
.setUnifiedTextCheckerEnabled(true);
37 internals
.settings
.setAsynchronousSpellCheckingEnabled(true);
42 <div id=
"testLTR" class=
"testDiv" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
45 <div id=
"testRTL" class=
"testDiv forcertl" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
47 LTR (text-overflow:ellipses)
48 <div id=
"testLTREllipses" class=
"testDiv ellipses" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
50 RTL (text-overflow:ellipses)
51 <div id=
"testRTLEllipses" class=
"testDiv forcertl ellipses" contenteditable=
"true">the the adlj adaasj sdklj. there there
</div>
54 function moveCursorOverAllWords(id
)
56 div
= document
.getElementById(id
);
60 // Move cursor over all words so inline spellchecking is activated for all.
61 for (var i
= 0; i
< div
.innerHTML
.length
; i
++)
62 moveSelectionForwardByWordCommand();
67 function verifyMarkers()
69 if (!window
.internals
)
72 // Take care of spelling markers first.
73 shouldBecomeEqual('internals.hasSpellingMarker(document, 8, 4)', 'true', function() { // Verifies 'adlj'.
74 shouldBecomeEqual('internals.hasSpellingMarker(document, 13, 6)', 'true', function() { // Verifies 'adaasj'.
75 shouldBecomeEqual('internals.hasSpellingMarker(document, 20, 5)', 'true', verifyGrammarMarkers
) // Verifies 'sdklj'.
79 function verifyGrammarMarkers() {
80 shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', function() { // Verifies second 'the'.
81 shouldBecomeEqual('internals.hasGrammarMarker(document, 33, 5)', 'true', function() { // Verifies second 'there'.
82 // Markers of next element can not be found after modification selection without blur event.
90 var tests
= [ function() { moveCursorOverAllWords('testLTR'); },
91 function() { moveCursorOverAllWords('testRTL'); },
92 function() { moveCursorOverAllWords('testLTREllipses'); },
93 function() { moveCursorOverAllWords('testRTLEllipses'); } ];
97 var next
= tests
.shift();
99 return window
.setTimeout(next
, 0);
104 if (window
.testRunner
) {
105 testRunner
.dumpAsTextWithPixelResults();
106 testRunner
.setBackingScaleFactor(2, function () {